论文排版之latex使用

admin 2023年12月25日14:01:13评论21 views字数 3529阅读11分45秒阅读模式

Windows安装Texlive2021

下载texlive

1
https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/

右键texlive.iso装载进入虚拟磁盘,运行install-tl-windows.bat,根据需要修改安装路径。

同时还可以修改“Customize”,应为里面有很多用不到的语言,比如说French、German、Japanese、Polish、Korean、Czech(捷克)等,这会少掉很多不必要的语言包。

点击安装,看到以下界面表示安装成功

论文排版之latex使用

通过命令行输入tex -v检测环境变量是否配置好

论文排版之latex使用

编辑器,我这里用的vscode,安装插件

论文排版之latex使用

配置setting.json

参考https://zhuanlan.zhihu.com/p/166523064和https://zhuanlan.zhihu.com/p/362275032

elsarticle模板使用

https://www.elsevier.com/authors/policies-and-guidelines/latex-instructions

普通模板下载

https://ctan.org/tex-archive/macros/latex/contrib/elsarticle

要从*.dtx中提取elsarticle.cls,终端运行:

1
latex elsarticle.ins

但后来发现,不需要这个文件在目录下也可以

latex语法

编号标题section{Conclusion}

不编号标题section*{Acknowledgments}

上标$S^1$

下标$S_1$

斜体 emph{}

粗体textbf{文字}

下划线underline{文字}

大于号textgreaterge

小于号textlessle

不等号ne 、neq

大于等于

1
2
emph{t}$ge 2$
$1 geq m geq M$

小于等于

1
2
emph{t}$le 2$
$1 leq m leq M$

属于$in$

希腊字母

https://zhuanlan.zhihu.com/p/157644392

1
$alpha$

加粗希腊字母

1
2
usepackage{amsmath}
$boldsymbol{pi}$

斜体大写希腊字母

1
varPhi

行间公式

1
2
3
begin{equation}
XXX
end{equation}

行间公式换行,对于长公式,还是直接在mathtype里面换行好直接复制到latex比较方便

1
2
3
4
5
6
begin{equation}
begin{array}{c}
XXX \
XXX
end{array}
end{equation}

行内公式

1
$XXX$

公式引用eqref{con:eq1}

latex 输入空格

https://blog.csdn.net/luolang_103/article/details/81289529

图片表格

常用选项[htbp]是浮动格式:
『h』当前位置。将图形放置在正文文本中给出该图形环境的地方。如果本页所剩的页面不够,这一参数将不起作用。
『t』顶部。将图形放置在页面的顶部。
『b』底部。将图形放置在页面的底部。
『p』浮动页。将图形放置在一只允许有浮动对象的页面上。

一般使用[htb]这样的组合,只用[h]是没有用的。这样组合的意思就是latex会尽量满足排在前面的浮动格式,就是h-t-b这个顺序,让排版的效果尽量好。
!h 只是试图放在当前位置。如果页面剩下的部分放不下,还是会跑到下一页的。一般页言,用 [!h] 选项经常会出现不能正确放置的问题,所以常用 [ht]、[htbp] 等。( [ht]用的多)

修改图片标题Figure为Fig.

1
2
usepackage{caption}
captionsetup[figure]{labelfont={bf},labelformat={default},labelsep=period,name={Fig.}}

合并多行表格使用multirow,在第一行为其设置值,往后的行空出相应位置

1
2
multirow{2}{*}{0.2/0.8} & HSMM & 126s & 115s & 0.984 & 0.976 & 0.973\
& HMM & 83s & 66s & 0.952 & 0.941 & 0.936\

文献

各种引用格式参考

https://blog.csdn.net/colddie/article/details/78554206

https://www.machunjie.com/article/989.html

1
2
3
4
引用的文献显示模板
bibliographystyle{cas-model2-names}
引用文献集合
bibliography{mybibfile.bib}

作者图片信息

biography,其中pos的值为lr,代表图片的位置在左边还是右边

1
2
3
bio[pos=x]{pic.jpg}
% % Here goes the biography details.
endbio

多个作者之间当介绍长短不一时,可能会出现间距太短遮挡住图片,因此可通过调整间距解决

1
vspace{40pt}

单栏 (cas-sc.cls)双栏 (cas-dc.cls)模板使用

模板下载

https://www.ctan.org/pkg/els-cas-templates/

模板使用说明

https://wenda.latexstudio.net/data/ueditor/php/upload/file/20190805/1564935621978907.pdf

下载下来不要直接运行看效果,因为很多内容没填会报错

1
The key 'stm/author/<options>' is unknown and is being

此外,什么都填好之后,会报以下错误,但可以编译出文件,但文献无法显示

1
2
3
4
Missing number, treated as zero. <to be read again>
Citation on page 1 undefined
Missing = inserted for ifnum. <to be read again>
You can't use `numexpr' in restricted horizontal mode. int_compare:nNnTF ...nt_eval:w #1#2__int_eval:w

这时要检查author是否设置了auid,因为我加上之后就不报错了

1
author[1]{XXX}[auid=1]

文献引用可以正常编译了,但会发现在正文中引用时,所有作者的名字都会列出来,而我们想要

1
2
3
只有一个作者时,在文中的引用使用(Zhang,2016)
有两个作者时,显示(Zhang and Liu,2014)
有三个作者或更多作者时,只显示第一个作者,其余用et al.(Zhang et al., 2012)

修改下面这条语句,将longnamesfirst删除,因为longnamesfirst的功能为:多个作者的文献第一次被引用是列出所有作者,以后引用可以缩写为et al.

1
2
usepackage[authoryear,longnamesfirst]{natbib}
usepackage[authoryear]{natbib}

IEEEtran模板使用

注意事项:

THANKS要在author里面,不然会新增一页空白页

1
2
3
4
5
6
7
author{
Bailin Xie, Qi Li, Na Wei, Yu Wang
IEEEcompsocitemizethanks{IEEEcompsocthanksitem XXX.protect\
E-mail: XXX
IEEEcompsocthanksitem XXX
IEEEcompsocthanksitem XXX.}
}

IEEEbiography后面加个vfill,不然作者图片之间间隙很大

1
2
3
4
5
6
7
begin{IEEEbiography}[{includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{./XXX.jpg}}]{Author name}
received her XXX.
end{IEEEbiography}
begin{IEEEbiography}[{includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{./XXX.jpg}}]{Author name}
received his xxx.
end{IEEEbiography}
vfill

加了图片之后似乎要用pdflatex编译,用xelatex会报错


原文始发于微信公众号(菜鸟小新):论文排版之latex使用

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2023年12月25日14:01:13
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   论文排版之latex使用http://cn-sec.com/archives/2331804.html

发表评论

匿名网友 填写信息