本文介绍LaTeX如何引用文献、生成文献列表、文档生成,包括natbib。
1. 生成文献列表
投搞的话,其实几乎不用考虑参考文献格式,因为通常期刊或者会议论文会提供格式模板(如IEEE的IEEEtran.bst)。只需要将自已的参考文献放在一个文件(如References.bib),加到tex文档就可以了(在\end{document}之前)。
\bibliographystyle{IEEEtran}\bibliography{References}
如果只是用pdflatex编译的话,会提示错误“Citation undefined”。还需要用bibtex编译,我的做法是,写个简单脚本,如下:
#!/usr/bin/env bashfilename=”dtn_nc_data_mules”pdflatex -shell-escape $filenamebibtex $filenamepdflatex $filenamexdg-open $filename.pdf
2. 引用显示作者和年份
在撰写论文时,为了便于自已阅读,将引用显示为作者和年份,而不是仅仅数字[1][2]…,那么用apalike格式就可以了,如下:
\bibliographystyle{apalike}\bibliography{References}
3. natbib
3.1 usepackage
natbib定义了一些引用格式来代替常用的\cite。在\begin{document}插入natlib包,natlib使用方法如下:
\usepackage[options]{natbib} #e.g., \usepackage[comma,authoryear]{natbib} round #(default) for round parentheses;square #for square brackets;curly #for curly braces;angle #for angle brackets;colon #(default) to separate multiple citations with colons;comma #to use commas as separators;authoryear #(default) for author­year citations;numbers #for numerical citations;super #for superscripted numerical citations, as in Nature;sort #orders multiple citations into the sequence in which they appear in the list of references;sort&compress #as sort but in addition multiple numerical citations are compressed if possible (as 3­6, 15);longnamesfirst #makes the first citation of any reference the equivalent of the starred variant (full author list) and subsequent citations normal (abbreviated list);sectionbib #redefines \thebibliography to issue \section* instead of \chapter*; valid only for classes with a \chapter command; to be used with the chapterbib package;nonamebreak #keeps all the authors’ names in a citation on one line; causes overfull hboxes but helps with some hyperref problems.
3.2 引用类型
natbib.sty有两条基本的引用命令:citet, citep,如下:
\citet #textual citations, print the abbreviated author list\citet* #textual citations, print the full author list\citep #parenthetical citations, print the abbreviated author list\citep* #parenthetical citations, print the full author list\citealt #the same as \citet but without any parentheses.\citealp #the same as \citep but without any parentheses. \citeauthor{ale91} #Alex et al.\citeauthor*{ale91} #Alex, Mathew, and Ravi\citeyear{ale91} #1991 \citeyearpar{ale91} #(1991)#Citations aliasing\defcitealias{jon90}{Paper~I}\citetalias{ale91} #Paper I\citepalias{ale91} #(Paper I)\citetext #place arbitrary text around a citation. e.g., \citetext{short comm.} ⇒ (short comm.)
举例如下:
\citet{ale91} #Alex et al. (1991)\citet*{ale91} #Alex, Mathew, and Ravi (1991)\citet{ale91,rav92} #Alex et al. (1991); Ravi et al. (1992)\citet[chap.~4]{ale91} #Alex et al. (1991, chap. 4)\citep{ale91} #(Alex et al., 1991)\citep*{ale91} #(Alex, Mathew, and Ravi, 1991)\citep{ale91,rav92} #(Alex et al., 1991; Ravi et al. 1992)\citep[chap.~4]{ale91} #(Alex et al., 1991, chap. 4)\citep[see][]{ale91} #(see Alex et al., 1991)\citep[see][chap.~4]{jon91}#(see Alex et al., 1991, chap. 4)