Reference
- http://www.math.pku.edu.cn/te... 北大李东风老师的Latex排版心得,但是是11年的文章了,使用的CJK,可以当作一个小的参考
- 一份其实很短的 LaTeX 入门文档 基于CTEX的教程,CTEX维护大佬
关于 LaTeX 的中文支持,首先要说的是:在现在,一切教你使用 CJK 宏包的模板、人、网页、书,都是糟糕的、有害的、恼人的、邪恶的和应该摒弃的。
笔记
下边好多内容并不是亲手实践过,只是记下来,切记。
version 1, 5/31/2019
编译选项
% !TEX encoding = System
,使用Unicode, System改为utf8。% !TeX program = xelatex
,指定编译器。% !TeX root = mypap.tex
,子文件指定主文件。
文档格式
\documentclass{article} \begin{document}...\end{document}
\documentclass{...}
是文档模板,常用的有article、book、report、beamer等。
document子环境里是文档内容。两者之间的是序言。
常用宏包
包名 | 用途 | 注释 |
---|---|---|
graphicx | 插图 | |
amsmath | 数学公式 |
命令
\\
段内换行\newpage
强制换页\-
单词中的这个符号表明可以在这里换行章节标题
\maketitle
添加作者,\title
\author
\data
\section
\subsection
\subsubsection
\paragraph
\subparagraph
\appendix
附录\tableofcontents
章节
emph{...}
强调,变成花体\footnote{...}
后边的内容是脚注\label{...}
\ref{...}
\pageref{...}
环境
\begin{...}
和\end{...}
itemize
列表enumerate
有序列表center
居中table
表格浮动环境。tabular
表格环境,通常嵌入到表格浮动环境中。参数{...}
如ccc
,表示有三列,居中对齐。l
表示左对齐,r
表示右对齐,|
表示增加一条竖线。\\
换行,&
对齐,\hline
行间横线。\multicolumn{3}{l}{...}
插入多行环境,可以使用这个生成代码段。figure
图形浮动环境- 通常包含一个center环境居中,然后使用
\includegraphics{...}
导入图形。h表示当前位置,t是top,b是bottom,p是图形单独一页,label在caption内部比较保险 \DeclareGraphicsExtensions{.pdf,.jpg,.png}
使用这个命令指定导入图形的后缀,在导入时直接写名字就行,不用写后缀\graphicspath{{figs/}{grs/}}
指定图形路径
- 通常包含一个center环境居中,然后使用
\begin{figure}[htbp] \centering \includegraphics[width=\textwidth]{img01} \caption{例子,这里是图的题注\label{fig:figfloat1}} \end{figure}\begin{figure}[htbp] \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=\textwidth]{img01} \caption{左图\label{fig:float2-1}} \end{minipage} \hfill \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=\textwidth]{img02} \caption{右图\label{fig:float2-2}} \end{minipage} \end{figure}
eqution
自动编号公式
tricks
- 中文连字符可使用
--
,中文破折号---
。 - 把文档拆分成多文件,使用
\include{...}
导入。这个命令会在插入内容的前后换页。使用\includeonly{...}
文件清单,只有清单里的文件才会被导入。 - 书签
\usepackage[pdftex]{hyperref}
- 版式设置,
pagestyle{plain}
产生只有页号的页,pagestyle{headings}
页码在页眉的页面。 - 花体字、空心字见1