Latex常用符号和技巧
随笔记录,不分顺序
一些有用的Latex资源
https://www.latexstudio.net/articles/
IEEE相关文件(包括IEEETransaction Latex模板,参考文件模板,相关文件和个人搜集的Latex说明文件等)
链接:https://pan.baidu.com/s/1NJe_rgBL55YyT9CtlZc-8w
提取码:8az7
IEEELatex模板下载及文件说明
参考文献模板下载地址(如果下载不了可以从上面百度网盘下载):https://ieeeauthor.wpengine.com/wp-content/uploads/Transactions-WIN-and-MAC-Bibliography-File.zip
Latex模板文件说明:
IEEEtran.cls - IEEEtran LaTeX class文件.
IEEEtran_HOWTO.pdf - 用户手册.
bare_conf.tex - 会议文章模板.
bare_conf_compsoc.tex - 特殊会议模板for IEEE Computer Society conference papers.
bare_jrnl.tex - 正常期刊模板(这个一般就是我们要用的Trans期刊模板.
bare_jrnl_comsoc.tex - 特殊期刊模板for IEEE Communications Society journal papers.
bare_jrnl_compsoc.tex - 特殊期刊模板for IEEE Computer Society journal papers.
bare_jrnl_transmag.tex - 特殊期刊模板for IEEE Transactions on Magnetics journal papers.
bare_adv.tex - 一个先进的demo模板of IEEEtran.cls for IEEE Computer Society Journals
常用符号
公式技巧
长公式换行
代码:
\begin{equation}
\begin{aligned}
R(S_2) &= p_2\cdot S_2=\sum_{i\in \mathcal{I}^+(p_2)}B_i+\beta B_{l'} \\
&\leq \sum_{i\in \mathcal{I}^+(p_2)}B_i+B_{l'}\leq \sum_{i\in \mathcal{I}^+(p_1)}B_i \\
&\leq \sum_{i\in \mathcal{I}^+(p_1)}B_i+\alpha B_l=R(S_1)
\end{aligned}
\end{equation}
效果如下:
子公式换行
代码:
$$\sum_{\substack{\beta=k\\|\alpha|+|\beta|\le N}}$$
效果如下:
括号内换行
在括号内换行需要在换行出添加"\right.","\phantom{=;;}" 和 "\left."
代码:
\begin{align}
\min \left(1+2+3+4+5
\notag\right.
\\
\phantom{=\;\;}
\left.+6+7+8+9+10\right)
\end{align}
效果如下:
Latex插入定理、定义、引理、推论和证明
在头部引导区引入相关包:
\usepackage{amsthm} % 使用证明需要用到
\newtheorem{theorem}{Theorem} % 定理
\newtheorem{definition}{Definition} % 定义
\newtheorem{lemma}{Lemma} % 引理
\newtheorem{corollary}{Corollary} % 推论
在正文区使用示例:
% 引理1
\begin{lemma}
here is lemma 1
\end{lemma}
\begin{proof}
here is the proof of lemma 1
\end{proof}
% 定理1
\begin{theorem}
here is theorem 1
\end{theorem}
\begin{proof}
here is the proof of theorem 1
\end{proof}
\begin{definition}[Fibration]
A fibration is a mapping between two topological spaces that has the homotopy lifting property for every space $X$.
\end{definition}
效果:
LaTeX使用IEEE模板 相邻参考文献为相同作者 默认用横线代替
问题:
从IEEE官网下载的latex和参考文献模板,但是插入的相邻参考文献作者重名时,只有第一个作者正常显示,其余均被用“——”代替,原因是下载的IEEE.bst文件中设置了重名作者的处理开关。
解决办法:
1.打开IEEE.bst文件
2.找到下面这段内容:
% #0 turns off the "dashification" of repeated (i.e., identical to those
% of the previous entry) names. IEEE normally does this.
% #1 enables
FUNCTION {default.is.dash.repeated.names} { #1 }
上面的注释已经说明了,
0-关闭重复(即与上一条相同)名称的“破折号化”。IEEE通常会这样做。
1-开启
3.将#1改为#0,然后重新编译(如果不行就多编译几次)
在双栏排版中让通栏图表出现在页面底端
导言区加入:\usepackage
# 插图的话使用如下环境:
\begin{figure*}[bp]
...
\end{figure*}
# 表格类似使用
\begin{table*}[bp]
...
\end{table*}
IEEEbiography作者简介调整间距
在两个作者简介中间使用\vspace{-4em}
调整间距大小,负数表示缩小间距,正数表示增加间距,具体如下:
\begin{IEEEbiography}[{\includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{figures/author1}}]{author1}
author 1 xxx.
\end{IEEEbiography}
# 在上一个作者\end和下一个作者\begin之间使用vspace进行调整
\vspace{-4em}
\begin{IEEEbiography}[{\includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{figures/author2}}]{author2}
author 2 xxx.
\end{IEEEbiography}
其他疑难杂症
latex节标题中使用数学符号
有些时候需要在节标题中使用一些数学符号或者公式,如使用绝对值、反斜杠标记等等,这时编译后可以正常显示,但是系统会给出警告:
Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `math shift' on input line 651.
# 或者
Package hyperref Warning: Token not allowed in a PDF string (Unicode): removing `\cup' on input line 651.
这时可以用latex提供的\texorpdfstring{}{}
标记来解决,使用方法是用上述标记的第一个括号包裹所需添加的数学符号或公式,如下所示:
\subsection{Comparison with Three Online Algorithms with \texorpdfstring{$\cup$ and $\cap$}{}}
至于第二个括号是干啥的,我也没查到,感兴趣的自行摸索一下吧,摸索明白了可以来此评论一下。
latex表格内单元格强制换行
在使用latex编辑表格时,有时会超出纸张宽度限制,而超出部分latex不会自动换行显示,而需要我们手动换行。
直接说怎么用吧
上图中第一列与第二列顶端对齐,这种效果实现起来最简单,对应的代码如下:
\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{show tabel.}%标注该表格,用于在文章内引用
\label{table1}
\centering
\begin{tabular}{cl}
\toprule
A title & this is first line then this is \\
& second line \\
B title & this is first line then this is \\
& second line \\
\bottomrule
\end{tabular}
\end{table}
如果要实现第一列与第二列居中对齐,如下图所示的效果:
则使用如下代码:
\begin{table}[!t]
\renewcommand{\arraystretch}{1.3}
\caption{show tabel.}
\label{table2}
\centering
\begin{tabular}{cl}
\toprule
A title & \begin{tabular}[c]{@{}l@{}}this is first line then this is\\second line\end{tabular} \\
B title & \begin{tabular}[c]{@{}l@{}}this is first line then this is\\second line\end{tabular} \\
\bottomrule
\end{tabular}
\end{table}
参考:http://www.mohu.org/info/lshort-cn.pdf
http://mohu.org/info/symbols/symbols.htm
http://blog.sciencenet.cn/blog-2578568-1122432.html
http://blog.sina.com.cn/s/blog_5e16f1770102eael.html
【持续更新中。。。】
评论区