墘青

LaTeX, Gaussian, ORCA and More...


  • 首页

  • 关于

  • 归档

  • 搜索

在LaTeX里处理引用

发表于 2019-07-19 更新于 2019-08-07 分类于 LaTeX

本文的主要内容:

  • 最基础的引用方式
  • 如何使用BibTeX
  • 如何方便地使用BibTeX

论文写作的过程中免不了引用文献。在Microsoft Word下我们可以通过像EndNote一样的工具来完成方便快捷地引用(但这两个工具都是收费的),那么在免费开源的LaTeX中,我们该如何实现引用呢?

最基础的引用方法

在LaTeX中,最为原始而基础的引用方式需要在.tex文件最后输入一个thebibliography环境,将我们要引用的文献信息硬编码在.tex文件中。

下面是一个例子:

1
2
3
4
5
6
7
8
9
\documentclass{ctexart}
\begin{document}
\section{最为基础的引用方法}
在这种环境下,你既可以引用英文的文献\cite{moss},也可以引用中文的文献\cite{505}。相信你已经发现了,在\verb|\bibitem[·]{citekey}|前面的中括号里加东西可以改变文章中引用括号里的内容。
\begin{thebibliography}{widest label}
\bibitem{moss} G.P. Moss, \emph{Extension and revision of the nomenclature for spiro compounds}, 1999
\bibitem[Wu, 2008]{505} 吴哲明, \emph{我国制药企业创新药物研发战略研究}, 2008
\end{thebibliography}
\end{document}

这是上面那个例子的输出:

这种方式如果不自定义标签,引用的形式就都是嵌在正文里,被方括号包裹的数字。这样明显达不到“方便”的程度。还好我们现在已经拥有了更加简便的工具。

BibTeX的基础用法

BibTeX是一个和LaTeX联用的管理文献和引用样式的工具。这时候我们会接触到一个新的文件格式,.bib格式。

如何新建一个.bib文件呢?非常简单。首先,打开记事本(Windows下的话,其他系统打开任意文本编辑器即可),随后输入以下代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@article{patterson1917system,
title={A SYSTEM OF ORGANIC NOMENCLATURE.},
author={Patterson, Austin M and Curran, Carleton E},
journal={Journal of the American Chemical Society},
volume={39},
number={8},
pages={1623--1638},
year={1917},
publisher={ACS Publications}
}

@article{radulescu1911nomenklatur,
title={{\"U}ber die Nomenklatur der Spirane},
author={Radulescu, Dan},
journal={Berichte der deutschen chemischen Gesellschaft},
volume={44},
number={1},
pages={1023--1026},
year={1911},
publisher={Wiley Online Library}
}

@article{rigaudy1979nomenclature,
title={Nomenclature of organic chemistry: sections A, B, C, D, E, F and H-1979 ed.},
author={Rigaudy, J and Klesney, SP and others},
year={1979},
publisher={Oxford (UK) Pergamon Press}
}

@article{畑一夫1979多環化合物の,
title={多環化合物の IUPAC 命名法},
author={畑一夫},
journal={有機合成化学協会誌},
volume={37},
number={2},
pages={148--160},
year={1979},
publisher={The Society of Synthetic Organic Chemistry, Japan}
}

@article{powell1984treatment,
title={Treatment of variable valence in organic nomenclature (lambda convention)(Recommendations 1983)},
author={Powell, WH},
journal={Pure and applied chemistry},
volume={56},
number={6},
pages={769--778},
year={1984},
publisher={De Gruyter}
}

单击“保存”,随后将文件名字改为ref.bib即可(前面的文件名可以随便取)。

我们刚刚干了什么呢?我们刚刚已将一堆文献的信息用一定的格式手动地集体存储至一个独立于.tex文件的文本文档里。

每一段花括号内最开头的一段文字,如rigaudy1979nomenclature就是我们刚刚接触过的“citekey”,在正文内我们只需要使用形似\cite{powell1984treatment}的代码就可以引用啦!

而每一个文件中需要输入的内容大致有这些:

关键词 描述
address Usually the address of the publisher. At least for small publishers, this
information might be useful.
annote An annotation, not used by the standard bibliography styles. Other styles or
macros might use this.
author The name(s) of the author(s).
booktitle The title of a book, if you cite a part of that. For a book, use the title field instead.
chapter A chapter number.
crossref The key of the database entry being cross referenced.
edition The edition (First, Second, and alike) of a book. Commonly it's capitalized.
editor The name(s) of the editor(s).
howpublished The way of publishing, especially if it's unusual. Capitalize the first word.
institution Could be a sponsoring institution.
journal A journal name; you may use common abbreviations.
key Used for alphabetizing, cross-referencing, and labeling if the author information is missing. Don't confuse it with the key used in the \cite command which corresponds to the beginning of the entry.
month The month in which the work was published or written if it's not yet published. Usually a three letter abbreviation is used.
note Any additional useful information. Capitalize the first word.
number The number of a journal or another kind of work in a series.
organization Might be a sponsoring organization.
pages A page number or range of page numbers, like 12-18 or 22+.
publisher The name of the publisher.
school Could be the name of the school where the document was written.
series The name of a series of books or its number of a multi-volume set.
title The title of the work.
type The type of the publication.
volume The volume of a journal or multi-volume book.
year The year of the publication or the year when it was written if it hasn't been published yet. Commonly four numerals are used, such as 2010.

但是你会发现,很多时候你根本不需要怎么多信息啊!一般来说BibTeX所需的信息和文献的类型有关,就是每一个开头@后面的那个单词。

BibTeX里的文档类型有:

文档类型 需要的关键词 可选的关键词
article author, title, journal, year volume, number, pages, month, note
book author or editor, title, publisher, year volume or number, series, address, edition, month, note
booklet title author, howpublished, address, month, year, note
conference author, title, booktitle, year editor, volume or number, series, pages, address, month, organization, publisher, note
manual title author, organization, address, edition, month, year, note
mastersthesis author, title, school, year type, address, month, note
misc none author, title, howpublished, month, year, note
phdthesis author, title, school, year type, address, month, note
proceedings title, year editor, volume or number, series, address, month, organization, publisher, note
techreport author, title, institution, year type, number, address, month, note
unpublished author, title, note month, year

下面是一个例子(需要将刚刚生成的ref.bib和下面这个.tex文件放在同一目录下):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
\documentclass{ctexart}
\begin{document}
\section{BibTeX实例}
哇有好多文献要引用啊。
那只能随便写写啦~
第一个文献是这个\cite{patterson1917system}。
然后是这个\cite{radulescu1911nomenklatur}。
你\cite{rigaudy1979nomenclature}可能会好奇:
什么样式适合你\cite{畑一夫1979多環化合物の}?
别急,后面就会讲到\cite{powell1984treatment}。
(本文是不严谨的错误示范,真正写论文的时候千万别这样)
\bibliographystyle{authordate3}
\bibliography{ref}
\end{document}

如果你没有使用TeXstudio这样的工具,而是手动编译.tex文件的话,你需要先运行一遍XeLaTeX,再运行一遍BibTeX,再运行两边XeLaTeX。

我们可以通过改变\bibliographystyle{·}中花括号内的内容来改变引用文献的样式。大家可以到这个网站寻找自己需要的样式:http://www.cs.stir.ac.uk/~kjt/software/latex/showbst.html

使用natbib

natbib让我们引用的样式更多并且更加方便了。我们首先需要在导言区加载natbib宏包。随后同样在导言区输入\bibliographystyle{apalike}(只是个例子,花括号内的内容可以改),最后在正文的最后,输入\bibliography{·}就能引用啦!

使用natbib可以明显提升BibTeX的鲁棒性,对于非英语文献的支持性更好,一般来说是非常推荐使用natbib的。

任之 wechat
订阅公众号以获取最新内容!
LaTeX中三线表、并置图片、固定表格
LaTeX中三分钟搞定引用
  • 文章目录
  • 站点概览
任之

任之

Personal blog featuring tutorials for LaTeX, Gaussian and ORCA in Chinese.
32 日志
4 分类
4 标签
GitHub E-Mail
  1. 1. 最基础的引用方法
  2. 2. BibTeX的基础用法
  3. 3. 使用natbib
© 2020 任之
Alexander Qi 专属
|
闲言碎语