学习LaTeX的第一天
目录
一、LaTeX基础知识
1.文档类
\documentclass[options]{class-name}
其中 class-name 为文档类的名称,如 article, report, book,此外支持中文排版的 如ctexart / ctexrep / ctexbook,或者一些有其它功能的文档类, 如 moderncv / beamer 等。
可选参数 options 为文档类指定选项,以全局地规定一些排版的参数,如字号、纸张大小、 单双面等等,如果要显示中文要在此写入UTF8。
举例:
1、无特殊要求
\documentclass{article}
2、输出中文
\documentclass[UTF8]{ctexart}
二、基础语法
1.文章段落
例子如下:
\documentclass[UTF8]{ctexart}
\title{学习LaTex第一天}
\author{qiuqiu}
\date{\today}
\begin{document}
\maketitle
你好!!!
\textbf{加粗的字体}还有\textit{倾斜的字体}\underline{画线的句子}
两个换行符才能换行!
\end{document}
2.文字
1.加粗字体
\textbf{加粗的字体}
2.倾斜字体
\textit{倾斜的字体}
3.划线句子
\underline{划线句子}
4.换行要两个换行
3.章和节
示例:
\documentclass[UTF8]{ctexart}
\begin{document}
\section{这是第一个章节}
这是第一章节的内容
\section{这是第二个章节}
这是第二章节的内容
\subsection{我是一个三级章节}
\end{document}
例子如下: 若在此处要加入第几章,则把article更换为ctexbook
4.图片
例子:
\documentclass{ctexart}
\usepackage{graphicx} %引入
\begin{document}
%给文件添加标题先把图片嵌套在figure
\begin{figure}
\centering%居中显示
\includegraphics[width=0.5\textwidth]{earth} %earth为图片名称
\caption{地球}%图片标题
\end{figure}
\end{document}
示例: