Content
- LaTeX的用途
- LaTeX文件布局
- LaTeX的文档格式
- 公式环境
- 图的排版
- 表格的排版
- 有序列表和无序列表
- 引用
- 伪代码
- 参考文献
LaTeX的用途
LaTeX是一种基于TeX的排版系统,由美国计算机科学家Leslie Lamport开发。对于生成复杂表格和数学公式,这一点表现得尤为突出。因此它非常适用于生成高印刷质量的科技和数学类文档。
LaTeX文件布局
使用LaTeX生成PDF文档一般有两种方式:
- LaTeX -> dvi2pdf -> pdf document
- pdfLatex -> pdf document
一个基本的论文LaTeX文件夹有这样四个部分,文件布局如下:
eps #文件夹用于放论文中使用到的.eps文件
llncs.cls #论文模板
paper.bib #论文参考文献
paper.tex #论文的正文内容
LaTeX文档格式
documentclass{llncs}
usepackage{graphicx}
%import some packages needed
graphicspath{{eps/}} %set eps file path
enewcommand{algorithmicrequire}{ extbf{Input:}}
egin{document}
itle{My document title}
itlerunning{xxx}
author{name1inst{2} and name2inst{1and 2} and name3inst{2} and name3inst{2}}
authorrunning{Amble et al.}
institute{place1 email{xxx@xx}\ and place2 email{b@mail}}
maketitle
egin{abstract}
keywords{word1,word2,word3}
end{abstract}
section{section1}
subsection{subsection1.1}
ibliographystyle{plain}
ibliography{paper}
end{document}
公式环境
- 内联的公式,即出现在正文中的公式使用$xxx$表示。注意:希腊字母或者任何数学符号必须要在双美元符号中间
- 公式环境,这里是单独的公式,需要标号的那种
egin{equation}
a=b+c
end{equation}
图片的排版
图片使用以下的figure环境,需要导入的宏包:graphicx,然后使用graphicspath{{eps/}}定义论文配图的位置
egin{figure}[ht]
centering
includegraphics[width=8cm]{picture1.eps}
caption{The picture title}
end{figure}
- h:当前位置
- b:优先排在底部
- t:优先排在每页顶部
- !:加入感叹号表示强制性
表格的排版
要引入的包为multirow,简单的表格排版可以使用如下demo
,其中(\
表示换行,hline
表示横线)。
egin{table}[!hbp]
caption{example of table}
egin{tabular}{|c|c|c|c|c|}
hline
hline
lable 1-1 & label 1-2 & label 1-3 & label 1 -4 & label 1-5 \
hline
label 2-1 & label 2-2 & label 3-3 & label 4-4 & label 5-5 \
hline
end{tabular}
end{table}
复杂的多列合并参考如下代码参考百科。如下:
egin{table}[!hbp]
caption{example of table}
egin{tabular}{|c|c|c|c|c|}
hline
mutirow{2}{*}{multi-row} & muticolumn{2}{|c|}{Muti-Column} & multicolumn{2}{|c|}{multirow{2}{*}{Muti-Row and Muti-Column}}\
cline{2-3} & column-1 & multicolumn{2}{|c|}{}\
hline
end{tabular}
end{table}
列表
有序列表
导入的宏包为enumerate,正文中使用如下代码完成,另外可以使用中括号设定标号的格式,例如[(1)]
egin{enumerate}[(1)]
item this is sentence 1.
item this is sentence 2.
end{enumerate}
无序列表
egin{itemize}
item this is sentence 1.
item this is sentence 2.
end{itemize}
引用
在被引用的地方做如下标记:
label{lab1}
在引用的地方使用:
ef{lab1}
伪代码
导入包:algorithm、algorithmicx和algpseudocode
enewcommand{algorithmicrequire}{ extbf{Input:}}
enewcommand{algorithmicensure}{ extbf{Output:}}
egin{algorithm}
caption{algoritm name}
egin{algorithmic}[1]
Require input parameters
Ensure output parameters
Function {algorithm name}{input parameters}
State $V gets 0$
For{$i gets 1quad toquad len(GramArray)$}
State $element gets GramArray[i]$
If{$GramInfo.exist(element)$}
State $GramInfo[element].count++$
Else
State $GramInfo.Add(<element,i,1>)$
EndIf
EndFor
While{$GramInfo.isNotEmpty()$}
State $cell gets GramInfo.popElement()$
State $index gets GramMap(cell.gram)$
State $V[index] gets <cell.pos,cell.count>$
EndWhile
State Return{$V$}
EndFunction
end{algorithmic}
end{algorithm}
参考文献
在整个.tex
结束的位置,也就是end{document}
之前加入如下代码:
ibliographystyle{plain}
ibliography{paper}
并单独创建一个.bib
文件,该文件中存放参考文献的资料,具体存放的参考文献格式可以利用:
非常方便的获取。在文章中引用的地方只需要使用如下格式引用即可,这里需要注意的地方是:需要LaTeX -> bibtex -> LaTeX -> dvi2pdf
cite{name}
中文处理方法
documentclass[12pt]{article}
usepackage{CJK}
egin{document}
egin{CJK*}{GBK}{song}
itle{大规模分布式系统环境下的性能监测与跟踪调试工具的\研究成果综述}
author{傅海平footnote{电子邮件: haipingf@gmail.com,学号: 201128013229018}\
中国科学院计算技术研究所\}
date{2012年5月}
maketitle
ewpage
latex中文排版
end{CJK*}
end{document}
才疏学浅,如有不足之处还请多多指教,感激不尽~