Latex 语法
为了参加美赛,开始研究Latex。国赛真是被word排版搞崩了,美赛就准备用Latex。
新手快速入门:
http://www.latexstudio.net/archives/9377.html
latex 头文件
\documentclass{article}
\usepackage{minted}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{a4paper,left=2cm,right=2cm,top=2cm,bottom=2cm}
\usepackage{booktabs}
\usepackage{float}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{proof}{Proof}[section]
\usepackage[colorlinks,linkcolor=blue]{hyperref}
\author{Zheng Ying \\ \href{mailto:yingzhengttt@gmail.com}{yingzhengttt@gmail.com}}
数学公式
\usepackage{amsmath}
行内公式
$a+b=c+d$
$\text{at1}-\text{at1}=\text{at2}$
独立公式
\[a^2+b^2=c^2\]
\begin{equation}
a+b=c+d
\end{equation}
会产生序号
自动化工具
生成目录
% !TEX program = xelatex
\documentclass{article}
\begin{document}
\tableofcontents
\section{Foo}
\subsection{blah}
\section{Bar}
\end{document}
之后进行两次编译即可生成目录,(第一次编译是收集目录,第二次编译才能生成)
atricle的三级目录为 \section
\subsection
\subsubsection
目录格式宏包 tocloft , titletoc
交叉引用
\label{label_name}
创建标签链接
ref{label_name}
显示链接名
pageref{label_name}
显示链接所在的页数
BIBTEX和文献数据库
具体使用参照:
https://blog.csdn.net/m0_37041325/article/details/81171736
\bibliography{tex}
\bibliographystyle{plain}
其中的plain可以为
- plain :格式按作者、日期、标题排序
- unsrt : 不排序(保留引用的次序)
- alpha : 使用三个字母缩写的方式编号并按作者排序
- abbrv : 基本与plain类似
cite{}
在文中引用需要的文献
nocite{}
没有明确指明引用,但仍需要列出的文献标签
表格的生成
tabular (数学模式或文本模式)/ array (用于数学模式下)
tabular格式:
\begin{tabular}[{对齐方式}]{列格式}
<表项> & <表项> & <表项> \\ [\hline]
<表项> & <表项> & <表项> \\ [\hline]
\end{tabular}
对齐方式:
- t 顶部对齐
- b 底部对齐
列格式:
- l c r |
- p{4em} 固定宽度
- @{} 在列中添加内容,同时取消表列间距
- *{< times>}{< doc>} 列格式说明符的多次重复
例如:
% !TEX program = xelatex
\documentclass{article}
\begin{document}
\begin{tabular}{t}{l|c|r}
left & center & right \\ \hline
111 & 222 & 333 \\
\end{tabular}
\end{document}
宏包 dcolumn
表格的合并
\multicolumn
\begin{tabular}{|r|r|}
\firsthline
\multicolumn{2}{|c|}{sorce} \\ \hline
English & Math \\ \hline
100 & 99 \\ \hline
\end{tabular}
- \cline
cline{2-3}
- \hline
diagbox
插入图片
\usepackage{graphics}
or
\usepackage{graphicx}
\includegraphics[width=2em]{a.jpg}
[width=2em]
[width=1cm]
[scale=0.5]