本文介绍LaTeX如何引用文献、生成文献列表、文档生成,包括natbib。
1. 生成文献列表
投搞的话,其实几乎不用考虑参考文献格式,因为通常期刊或者会议论文会提供格式模板(如IEEE的IEEEtran.bst
)。只需要将自已的参考文献放在一个文件(如References.bib
),加到tex文档就可以了(在\end{document}
之前)。
\bibliographystyle{IEEEtran}
\bibliography{References}
如果只是用pdflatex
编译的话,会提示错误Citation undefined
。还需要用bibtex
编译,我的做法是,写个简单脚本,如下:
#!/usr/bin/env bash
filename="dtn_nc_data_mules"
pdflatex -shell-escape $filename
bibtex $filename
pdflatex $filename
xdg-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 authoryear 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 36, 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)
4. bibliographystyle
请参考: Bibliography and citation style, abbrv, acm, alpha, apalike, ieeetr, plain, siam and unsrt.
5. Others
BibLaTex????????
http://tex.stackexchange.com/questions/25701/bibtex-vs-biber-and-biblatex-vs-natbib
http://sites.stat.psu.edu/~surajit/present/bib.htm#unsrt
PdfLaTeX
Bibtex
PdfLaTeX
PdfLaTeX
Pdf Viewer
Here’s how BibTeX works. It takes as input
- an
.aux
file produced by LaTeX on an earlier run; - a
.bst
file (the style file), which specifies the general reference-list style and specifies how to format individual entries, and which is written by a style designer [..] in a special-purpose language [..], and .bib
file(s) constituting a database of all reference-list entries the user might ever hope to use.
BibTeX chooses from the .bib
file(s) only those entries specified by the .aux
file (that is, those given by LaTeX's \cite
or \nocite
commands), and creates as output a .bbl
file containing these entries together with the formatting commands specified by the .bst
file [..]. LaTeX will use the .bbl
file, perhaps edited by the user, to produce the reference list.[1]
http://en.wikipedia.org/wiki/BibTeX
Bibliography Style 例子:
http://www.univie.ac.at/nuhag-php/bibtex/bibstyles.pdf
http://sites.stat.psu.edu/~surajit/present/bib.htm
C:\texlive\2014\texmf-dist\bibtex\bst
modify the style file:
http://www-hep.colorado.edu/~jcumalat/4610_fall_10/bibtex_guide.pdf
$ latex myarticle
$ bibtex myarticle
$ latex myarticle
$ latex myarticle
参考资料:
[1]PSU: Bibliography and citation style
[2]On-line Tutorial on LATEX: 10 Bibliography.pdf