1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
% 导言区 preamble 指定文档格式,页面尺寸,导入的宏包
\documentclass [UTF8]{ctexart} % 支持中文和英文混排
\usepackage{graphicx} %插入图片前先导入包
\title{标题}
\author{作者}
%\date{2023.9.14}
\date{\today} %自动生成当天日期
%正文 body
\begin {document}
\maketitle %在当前位置生成文档的标题
你好,latex!!!
\textbf{加粗文字abc}
\textit{斜体abc}
\underline{下划线abc1}
两个回车换行符,单个换行符空格
换行
\section{章节名1}
第一章内容
\subsection{二级章节}
121
\subsubsection{三级章节}
23424
\section{章节名2}
第二章内容
添加图片先嵌套figure,centering 图片居中对齐,括号中为文件名可以省略扩展名。width指定长度,0.5倍的textwidth,代表当前文本区域的宽度--图片的位置好像在下一页开头
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]{test}
\caption{图片名}
\end{figure}
创建无序列表
\begin{itemize}
\item 列表项1
\item 列表项2
\item 列表项3
\end{itemize}
创建有序列表
\begin{enumerate}
\item 列表项1
\item 列表项2
\item 列表项3
\end{enumerate}
添加行内公式:$E=mc^2$
公式单独一行,
\begin{displaymath}
E=mc^2
\end{displaymath}
%可以简写为\[ \]
\[
E=mc^2
\]
为公式编号
\begin{equation}
E=mc^2
\end{equation}
创建表格,括号中ccc代表表格有三列,其中每一列的内容都居中对齐,l左r右;添加竖线为表格添加竖直的边框;c改成p可以指定列宽;添加标题需要嵌套table环境
\begin{table}
\center%表格居中显示
%\begin{tabular}{| c | c | c | }
\begin{tabular}{| p{2cm} | c | c | }
\hline%添加横线
单元格1 & 单元格2 & 单元格3 \\ %每一列数据用&隔开,每一行以\\隔开
\hline\hline%添加双横线
单元格4 & 单元格5 & 单元格6 \\
\hline
单元格7 & 单元格8 & 单元格9 \\
\hline
\end{tabular}
\caption{表名}
\end{table}
\end {document}
|