latex学习

格式

  • 首先\documentclass[UTF8]{ctexart}

    ….(宏包)

    \begin{document}

    ……

    \end{document}

  • 行内要用$$括起来 行间要用$$$$括起来

  • 公式对齐 不同的环境语法不同 eqnarray是&=&;align是&=

  • 分段函数 cases环境 使用& 对齐 \\换行

  • 矩阵 array begin后面加{ccc}表示格式 需要$$$$和自己加括号

  • 要表示带省略号的矩阵 用pmatrix环境

  • 表格 数字表格即矩阵加|,带汉字的要使用tabular环境。表格的横线为\hline

  • 插图 \includegraphics[scale=] [width=][height=*]{.png}

    或使用\figure环境

    \begin{figure}[H]

    \centering

    % Requires \usepackage{graphicx}

    \includegraphics[width=12pt]{.png}\

    \caption{图1}

    \end{figure}

正文部分

  • \textbf{}加粗
  • \textit{}斜体
  • underline 下划线

章节

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
\documentclass[UTF8]{ctexart}

\begin{document} //正文

\part{A} // 该部分标题为A 并且开始一个部分 直到下一个部分

\chapter{B} //该章节标题为B 并且开始一个部分 直到下一个部分

\section{C} //该章节标题为C 并且开始一个部分 直到下一个部分

\subsection{D} //创建子章节

\subsubsection //.

\end{document}

图片

1
2
3
4
5
6
7
8
9
10
11
\documentclass[UTF8]{ctexart}
\usepackage{graphicx} //引入宏包
\begin{document}

\begin{figure}
\centering // 居中
\includegraphics[width=0.5\textwidth]{head}
\caption{...} //图片标题
\end{figure}

\end{document}

列表

1
2
3
4
5
6
7
8
9
10
\documentclass[UTF8]{ctexart}
\begin{document}

//无序列表环境为itemize
\begin{enumerate}
\item 列表项1
\item 列表项2
\end{enumerate}

\end{document}

公式

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
\documentclass[UTF8]{ctexart}

\begin{document}

// 行内公式
AAAAA $E = mc^2$
// 行间公式
// 使用equation环境
\begin{equation}
E = mc^2
\end{equation}
// 或者用\[\]
\[
E = mc^2
\]
\end{document}

表 格

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
\documentclass[UTF8]{ctexart}
\begin{document}

\begin{table}// 需要标题和居中的时候要把表格放在table环境中

\center

\begin{tabular}{c c c} // c | c c代表表格共三列 每列内容都居中对齐 用l表示左对齐 r右 添加竖线代表竖边框 水平边框通过\hline添加 每格之间用&隔开 每行之间用\\隔开
// 把c改成p{2cm}自定义列宽
\hline
单元格1 & 单元格2 & 单元格3 \\
\hline //双横线
\hline
单元格4 & 单元格5 & 单元格6 \\
单元格7 & 单元格8 & 单元格9
\end{tabular}

\caption{title}

\end{table}

\end{document}
1
2
20.205.243.166 github.com
185.199.108.153 br

latex学习
https://brtulien.github.io/2023/08/02/latex学习/
作者
Brtulien
发布于
2023年8月3日
更新于
2024年7月1日
许可协议