写论文不要忘了它,9个案例让你快速入门latex

内容来源于交大PhD ”← 关注它

Latex是什么?

LaTeX(音译“拉泰赫”)是一种基于TEX的排版系统,由美国计算机学家莱斯利·兰伯特(Leslie Lamport)在20世纪80年代初期开发,利用这种格式,即使使用者没有排版和程序设计的知识也可以充分发挥由TeX所提供的强大功能,能在几天,甚至几小时内生成很多具有书籍质量的印刷品。

 

对于生成复杂表格和数学公式,这一点表现得尤为突出。因此它非常适用于生成高印刷质量的科技和数学类文档。这个系统同样适用于生成从简单的信件到完整书籍的所有其他种类的文档。总的来说,会用Latex,写论文效率各种高!

Latex基本语法

1
第一个文档

打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 

documentclass{article} 
begin{document} 
hello, world 
end{document} 

然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeTeX,并点击编译。


如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 

写论文不要忘了它,9个案例让你快速入门latex

2
标题、作者和注释

建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 


documentclass{article} 
author{My Name} 
title{The Title} 
begin{document} 
maketitle 
hello, world % This is comment 
end{document} 

写论文不要忘了它,9个案例让你快速入门latex

3
章节和段落

建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 


documentclass{article} 
title{Hello World} 
begin{document} 
maketitle 
section{Hello China} China is in East Asia. 
subsection{Hello Beijing} Beijing is the capital of China. 
subsubsection{Hello Dongcheng District} 
paragraph{Tian’anmen Square}is in the center of Beijing 
subparagraph{Chairman Mao} is in the center of Tian’anmen Square 
subsection{Hello Guangzhou} 
paragraph{Sun Yat-sen University} is the best university in Guangzhou. 
end{document} 

退格只是我个人偏好,看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 

写论文不要忘了它,9个案例让你快速入门latex

4
加入目录

建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 


documentclass{article} 
begin{document} 
tableofcontents 
section{Hello China} China is in East Asia. 
subsection{Hello Beijing} Beijing is the capital of China. 
subsubsection{Hello Dongcheng District} 
paragraph{Hello Tian’anmen Square}is in the center of Beijing 
subparagraph{Hello Chairman Mao} is in the center of Tian’anmen Square 
end{document} 

写论文不要忘了它,9个案例让你快速入门latex

5
换行

建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 

documentclass{article} 
begin{document} 
Beijing is 
the capital 
of China. 

New York is 

the capital 

of America. 

Amsterdam is \ the capital \ 
of Netherlands. 
end{document} 

写论文不要忘了它,9个案例让你快速入门latex

6
数学公式

建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 


documentclass{article} 
usepackage{amsmath} 
usepackage{amssymb} 
begin{document} 
The Newton’s second law is F=ma. 

The Newton’s second law is $F=ma$. 

The Newton’s second law is 

F=ma

The Newton’s second law is 

F=ma

Greek Letters $eta$ and $mu$ 

Fraction $frac{a}{b}$ 

Power $a^b$ 

Subscript $a_b$ 

Derivate $frac{partial y}{partial t} $ 

Vector $vec{n}$ 

Bold $mathbf{n}$ 

To time differential $dot{F}$ 

Matrix (lcr here means left, center or right for each column) 

left[ 
begin{array}{lcr} 
a1 & b22 & c333 \ 
d444 & e555555 & f6 
end{array} 
right] 


Equations(here & is the symbol for aligning different rows) 
begin{align} 
a+b&=c\ 
d&=e+f+g 
end{align} 


left{ 
begin{aligned} 
&a+b=c\ 
&d=e+f+g 
end{aligned} 
right. 


end{document} 

具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。 

写论文不要忘了它,9个案例让你快速入门latex

7
插入图片

先搜索到一个将图片转成eps文件的软件,很容易找的,然后将图片保存为一个名字如figure1.eps。 

建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,放在和图片文件同一个文件夹里,编译并观察现象。 

documentclass{article} 
usepackage{graphicx} 
begin{document} 
includegraphics[width=4.00in,height=3.00in]{figure1.eps} 
end{document} 

写论文不要忘了它,9个案例让你快速入门latex

8
简单表格

建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 

documentclass{article} 
begin{document} 
begin{tabular}{|c|c|} 
a & b \ 
c & d\ 
end{tabular} 

begin{tabular}{|c|c|} 
hline 
a & b \ 
hline 
c & d\ 
hline 
end{tabular} 

begin{center} 
begin{tabular}{|c|c|} 
hline 
a & b \ hline 
c & d\ 
hline 
end{tabular} 
end{center} 
end{document}

 

写论文不要忘了它,9个案例让你快速入门latex

9
Latex更换模板

此处可以算是Latex最大的优势所在。一般来说,word写的论文每一段落的格式,字体,缩进等都需要进行具体的编辑,如果投稿杂志具有具体的格式要求,则需要对全文进行编辑,这将花费大量的时间,而Latex则不需要。Latex的全文的格式都在一个被定义的文档中,一般杂事提供的模板中会有这个文档,也就是说只要把杂志提供的模板文档复制过来,全文的格式就会自动转变成杂志的要求了!

举个例子:

 

微纳院的小楼原本写了一篇论文,打算投C类Sci–Micromachines,他找到了这个杂志的模板:

 

写论文不要忘了它,9个案例让你快速入门latex
写论文不要忘了它,9个案例让你快速入门latex
写论文不要忘了它,9个案例让你快速入门latex
后来,小楼获得灵感,打算投机器人领域顶级Sci杂志–IJRR,于是他找到了这个杂志的模板:

写论文不要忘了它,9个案例让你快速入门latex
写论文不要忘了它,9个案例让你快速入门latex
写论文不要忘了它,9个案例让你快速入门latex

以上部分内容来自网络,若涉及版权问题,请原创作者留言联系我们。

原创文章,作者:菜菜欧尼酱,如若转载,请注明来源华算科技,注明出处:https://www.v-suan.com/index.php/2023/11/17/2211c2df62/

(0)

相关推荐