- 参考:https://snaildove.github.io/2017/08/20/LaTeX_symbols/
- https://github.com/davidstutz/latex-resources
数学符号
图例
表格
伪代码
图表混排
- 使用
minipage进行布局,图例使用\usepackage{caption} - 代码示例
\begin{minipage}{\textwidth}
\begin{minipage}{0.22\textwidth}
\centering
\includegraphics[width=0.9\textwidth]{figures/1.png}
\captionof{figure}{Figure caption.}\label{fig:1}
\end{minipage}
\begin{minipage}{0.70\textwidth}
\centering
\begin{tabular}{p{1.9cm}p{1.75cm}p{1.75cm}p{1.75cm}p{1.75cm}p{2.1cm}}
\hline\noalign{\smallskip}
a & b & c & d & e \\
\noalign{\smallskip}\svhline\noalign{\smallskip}
1 & 2 & 3 & 4 & 5 \\
\noalign{\smallskip}\hline\noalign{\smallskip}
\end{tabular}
\captionof{table}{Table caption.}\label{tab:1}
\end{minipage}
\end{minipage}定义、定理、证明和备注/标注
- 假设Assumption、引理Lemma、定理Theorem、证明Proof、备注/注释Remark、推论Corollary
- 在
\begin{document}之前声明\newtheorem{theorem}{Theorem},然后可以用
\begin{theorem}
\label{thm:thm1}
...
\end{theorem}- 如果theorem定义方式为
\newtheorem{theorem}{Theorem}[section],则不会直接用数字标识序号,而是章节对应的数字,点,序号,如Theorem 2.1 - 定义
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\begin{document}
\begin{definition}
\label{def:def1}
...
\end{definition}- 报错:
\theoremstyle未定义:使用theoremstyle前要先声明amsthm包\usepackage{amsthm}- 声明
amsthm包后报错\proof重复定义:在\usepackage{amsthm}之前使用\let\proof\relax和\let\endproof\relax
文本
特殊字符(TIPA)
- 使用
\usepackage{tipa}TIPA包
波浪号
- 声明新命令
\textapprox
\usepackage{textcomp}
\newcommand{\textapprox}{\raisebox{0.5ex}{\texttildelow}}字体颜色(xcolor)
- 方法一:
- 引用
\usepackage{xcolor} - 调用
\textcolor{red}{YOUR TEXT HERE}
- 引用
- 方法二:
- 引用
\usepackage{xcolor} - 创建一个新的命令
\newcommand{\yourCommandName}[1]{\textcolor{red}{#1}}
- 引用
- 都放在
\title之前
正确使用引号
- latex中的双引号、单引号应使用
而不是
``text'' and `text'"与'
避免断行:
- 引用时:
Fig.~\ref{fig1} - 避免短横线换行
\nobreakdash:\usepackage{amsmath} A re\nobreakdash-creation.
划掉线
- 使用
ulem包或soul包
ulem包
normalem是为了避免改变\emph{}的默认行为,如果不加的话可能会导致引用文献列表中文字下方出现横线\usepackage[normalem]{ulem} not removed, \sout{removed}, not removed
soul包(不推荐)
```latex
\usepackage{soul}
\st{Hello World}
```
将多个段落设置为同一颜色:
- 使用
newenvironment\newenvironment{cyan_block}{\par\color{cyan}}{\par} \begin{cyan_block} Paragraph 1. Paragraph 2. \end{cyan_block}
随机生成一些文本
- 使用
\usepackage{lipsum},可以选取其中某一段的某一句
\usepackage{lipsum}
\lipsum[1][3]\parTODO list和旁注
- 参考
- 使用包
\usepackage[colorinlistoftodos]{todonotes} - 列出所有Todo:
\listoftodos - 添加旁注:
\todo{Plain todonotes.}添加不同颜色的旁注:\todo[color=blue!40]{Todonote with a different color.}添加行内旁注:\todo[inline]{testing testing}行内旁注,不同颜色:\todo[inline, color=red!50]{Inline todonotes.}旁注不放入列表中:\todo[nolist]{Todonote that is only shown in the margin and not in the list of todos.}旁注不与特定正文内容相关:\todo[noline]{A note with no line back to the text.} - 颜色:
red!50,green!40,blue!40等
多列布局的对齐
- 引用
flushend包:\usepackage{flushend}
列表
- 仅有首行缩进
\let\labelindent\relax %if the template defined itemize previously
\usepackage{enumitem}
\begin{itemize}[wide]
\item aaa
\item bbb
\end{itemize引用
使用Cref进行交叉引用/提及某一章节
- 引用包
\usepackage{cleveref} - 为章节增加标签
\section{Section to quote}\labe{section:quote_section} - 引用章节时
\Cref{section:quote_section} - 引用多个标签时直接使用
,分隔,如果有额外的空格会报错。例\Cref{section:intro,section:method,section:approach}
添加页眉(header)页脚(footer)
参考示例
- 首页的页眉页脚与后面的页面是分别添加的(参考)
The
IEEEtranclass uses a specific page style for the first page, so it’s enough to modify it; loadingfancyhdris not the answer: the copy editors won’t be happy with it.
首页页眉页脚的添加
方法一,使用eso-pic
- 首页添加时需要引用
eso-pic包:\usepackage{eso-pic}然后再\begin{document}后通过\AddToShipoutPictureBG*添加所需的部件 makebox内无法换行,多行可参见方法二
\usepackage{eso-pic}
\begin{document}
\AddToShipoutPictureBG*{%
\AtPageUpperLeft{%
\setlength\unitlength{1in}%
\hspace*{\dimexpr0.5\paperwidth\relax}%% change \dimexpr0.5\paperwidth\relax appropriately
\makebox(0,-0.75)[c]{\Large Conference on \LaTeX}%
}}
\AddToShipoutPictureBG*{%
\AtPageLowerLeft{%
\setlength\unitlength{1in}%
\hspace*{\dimexpr0.5\paperwidth\relax}%% change \dimexpr0.5\paperwidth\relax appropriately
\makebox(0,0.75)[c]{\Large Notice}%
}}
% paper title
\title{Bare Demo of IEEEtran.cls for Conferences}
\author{\authorblockN{Name}
\authorblockA{something}}
\maketitle
\begin{abstract}
something
\end{abstract}
\end{document}方法二,使用tikz(推荐)
- 注意其紧随
\section{Introduction}第一段之后效果最好(不需要换行),放在\begin{abstract}前会出现空行,放在\section的内容之前会出现额外的空格 - 多行是由控制
text width改变node的宽度变相完成的
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\maketitle
\begin{abstract}ABSTRCT\end{abstract}
\section{Introduction}
YOUR TEXT HERE\begin{tikzpicture}[remember picture, overlay]\node at ($(current page.north) + (0,-0.5in)$)[text width=19.5cm] {\Large This work has been submitted to the IEEE for possible publication.\\ Copyright may be transferred without notice, after which this version may no longer be accessible.};
\end{tikzpicture}
\end{document}第二页及其后的页眉页脚的添加(未测试)
- 可能需要引用
fancyhdr?\usepackage{fancyhdr} - 需要通过调用
\pagestyle{fancy}应用格式\fancyhf{} \fancyfoot[C]{SCEES} %%% change C to L or R as needed \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \fancypagestyle{plain}{ \fancyhf{} \fancyhead[C]{Conference on \LaTeX} %% C or L or R. \fancyfoot[L]{This is a notice}% %% C or L or R. \renewcommand{\footrulewidth}{0pt} \renewcommand{\headrulewidth}{0pt} } \begin{document} % paper title \title{Bare Demo of IEEEtran.cls for Conferences} \author{\authorblockN{Name} \authorblockA{something}} \maketitle \begin{abstract} something \end{abstract} \IEEEpeerreviewmaketitle \pagestyle{fancy} something else \end{document}
超过页数限制时的应对方法
- 适当的压缩图片的尺寸效果明显,如
width=.45改为width=.42,可以使用\quad代替\hfill填充图片之间的间隙(垂直方向),使排版更美观
引用
- BibTex中作者人数过多时,使用
and others会转为et al.
title = {{RT}-1: {Robotics} {Transformer} for {Real}-{World} {Control} at {Scale}},
shorttitle = {{RT}-1},
url = {http://arxiv.org/abs/2212.06817},
doi = {10.48550/arXiv.2212.06817},
urldate = {2025-07-22},
publisher = {arXiv},
author = {Brohan, Anthony and others},
month = aug,
year = {2023},
}