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
\renewcommand{\algorithmicrequire}{ \textbf{Input:}}
\begin{document}
\title{My document title}
\titlerunning{xxx}
\author{name1\inst{2} \and name2\inst{1\and 2} \and name3\inst{2} \and name3\inst{2}}
\authorrunning{Amble et al.}
\institute{place1 \email{xxx@xx}\\ \and place2 \email{b@mail}}
\maketitle
\begin{abstract}
\keywords{word1,word2,word3}
\end{abstract}
\section{section1}
\subsection{subsection1.1}
\bibliographystyle{plain}
\bibliography{paper}
\end{document}
公式環境
- 內聯的公式,即出現在正文中的公式使用$xxx$表示。注意:希臘字母或者任何數學符號必須要在雙美元符號中間
- 公式環境,這里是單獨的公式,需要標號的那種
\begin{equation}
a=b+c
\end{equation}
圖片的排版
圖片使用以下的figure環境,需要導入的宏包:graphicx,然后使用\graphicspath{{eps/}}定義論文配圖的位置
\begin{figure}[ht]
\centering
\includegraphics[width=8cm]{picture1.eps}
\caption{The picture title}
\end{figure}
- h:當前位置
- b:優先排在底部
- t:優先排在每頁頂部
- !:加入感嘆號表示強制性
表格的排版
要引入的包為multirow,簡單的表格排版可以使用如下demo
,其中(\\
表示換行,\hline
表示橫線)。
\begin{table}[!hbp]
\caption{example of table}
\begin{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}
復雜的多列合並參考如下代碼參考百科。如下:
\begin{table}[!hbp]
\caption{example of table}
\begin{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)]
\begin{enumerate}[(1)]
\item this is sentence 1.
\item this is sentence 2.
\end{enumerate}
無序列表
\begin{itemize}
\item this is sentence 1.
\item this is sentence 2.
\end{itemize}
引用
在被引用的地方做如下標記:
\label{lab1}
在引用的地方使用:
\ref{lab1}
偽代碼
導入包:algorithm、algorithmicx和algpseudocode
\renewcommand{\algorithmicrequire}{ \textbf{Input:}}
\renewcommand{\algorithmicensure}{ \textbf{Output:}}
\begin{algorithm}
\caption{algoritm name}
\begin{algorithmic}[1]
\Require input parameters
\Ensure output parameters
\Function {algorithm name}{input parameters}
\State $V \gets 0$
\For{$i \gets 1\quad to\quad 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}
之前加入如下代碼:
\bibliographystyle{plain}
\bibliography{paper}
並單獨創建一個.bib
文件,該文件中存放參考文獻的資料,具體存放的參考文獻格式可以利用:
非常方便的獲取。在文章中引用的地方只需要使用如下格式引用即可,這里需要注意的地方是:需要LaTeX -> bibtex -> LaTeX -> dvi2pdf
\cite{name}
中文處理方法
\documentclass[12pt]{article}
\usepackage{CJK}
\begin{document}
\begin{CJK*}{GBK}{song}
\title{大規模分布式系統環境下的性能監測與跟蹤調試工具的\\研究成果綜述}
\author{傅海平\footnote{電子郵件: haipingf@gmail.com,學號: 201128013229018}\\
中國科學院計算技術研究所\\}
\date{2012年5月}
\maketitle
\newpage
latex中文排版
\end{CJK*}
\end{document}
才疏學淺,如有不足之處還請多多指教,感激不盡~