您好,欢迎来到宝玛科技网。
搜索
您的当前位置:首页在LaTeX中使用BibTeX

在LaTeX中使用BibTeX

来源:宝玛科技网


在LaTeX中使用BibTeX

为了在 LaTeX 中使用BibTeX 数据库, 你必须先做下面三件事情: 1) 设置参考文献的类型 (bibliography style). 标准的为 plain:

当你用LaTeX来写文档,在管理参考文献时,你可能会用到bibtex, 也许你会嫌麻烦,会选择用 \\begin{thebibliography}{10} \\bibitem xxxx \\bibitem xxxx

\\end{thebibliography}

的方式来处理参考文献,然后\\cite{}来引用。

但我要说的是,如果你只是偶尔用下参考文献(一次管理,一次使用),那么就不需要去用bibtex来管理参考文献了,如果经常使用,还是选择用bibtex来管理你的参考文献比较多(一次管理,终身使用)

bibtex是什么,这些就不多介绍了,很多lnote之类的文档都介绍了,本文只介绍怎么用bibtex。 --------------------

在使用时,一般会接触到两个文件,.bib 和.bst两个文件,.bib就是你的参考文献数据文件 .bst一般由期刊或者杂志提供, bst设定了参考文献出现在文末的方式,例如设置排序方式,设置作者名按缩写的方式还是不缩写,标题要不要大写,这些琐碎的事情,这些不用管太多。我们维护bib文件即可。

先看下.bib文件是什么样子的:

@ARTICLE{dbhat,

author = {D. Bhat and S. Nayar},

title = {Ordinal measures for image correspondence},

journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence}, year = {1998}, volume = {20(4)}, pages = {415-423}, owner = {flyskymlf}, timestamp = {02} }

@CONFERENCE{hampapur,

author = {Hampapur, A. and Bolle, R.},

title = {Comparison of sequence matching techniques for video copy detection}, booktitle = {In Conference on Storage and Retrieval for Media Databases},

year = {2002}, pages = {194-201}, owner = {flyskymlf}, timestamp = {15} }

大概都是由这些一个个的这样的标签组成,每个表示一个文献,全部按照这样写即可。 @ARTICLE @CONFERENCE 这些指定了文献的类型,article是期刊文章 ,conference是会议文章,可以从名称上分辨。类型有下面几种(来自http://amath.colorado.edu/documentation/LaTeX/reference/faq/bibstyles.html): @article An article from a journal or magazine @book A book with an explicit publisher

@booklet A work that is printed and bound, but without a named publisher or sponsoring institution

@conference The same as inproceedings

@inbook A part of a book, which may be a chapter (or section or whatever) and/or a range of pages

@incollection A part of a book having its own title

@inproceedings An article in a conference proceedings @manual Technical documentation @mastersthesis A Master's thesis

@misc Use this type when nothing else fits @phdthesis A PhD thesis

@proceedings The proceedings of a conference

@techreport A report published by a school or other institution, usually numbered within a series

@unpublished A document having an author and title, but not formally published

@collection Not a standard entry type. Use proceedings instead. @patent Not a standard entry type. 不翻译了,很简单的文字。 ----

紧跟在@ARTICLE{之后的文字就是 这个文献的标签id了,这个在一个bib文件中需要是唯一的,因为我们在tex中用\\cite{}引用时需要用这个id来引用,当然需要唯一的值(也不用怕,如果写重复了,bibtex在编译时不会给你通过的,你可以再修改)。

PS:有直观的GUI的界面可以去管理,推荐使用JabRef来管理,很方便,很快捷。 jabref跨平台的,急于java开发的一个东东,而且是免费的。ubuntu下直接sudo apt-get install jabref 即可,其他版本linux的自行处理,我没用过,win下也有版本,安装下就行。

@article 条目为期刊或杂志上的一篇文章。 不可少域 author, title, journal, year.

可省略域 volume, number, pages, month, note.

@article{name, author = {a and b}, title = {title},

journal = {journal name}, volume = {42}, number = {1}, year = {2008}, issn = {0110-0101}, pages = {1--8},

doi = {http://doi.xxx.org}, publisher = {ACM},

address = {New York, NY, USA}, };

@book 条目为有确定出版社的书籍。 不可少域 author或editor, title, publisher, year.

可省略域 volume或number, series, address, edition, month, note.

@booklet 条目为印制的有封皮的作品,但没有出版社或赞助机构的名称。 不可少域 title.

可省略域 author, howpublished, address, month, year, note.

@conference 与下面的@inproceedings相同。

@inbook 条目为一本书的一部分(章,节或某些页)。

不可少域 author或editor, title, chapter 和/或pages, publisher,year. 可省略域 volume或number, series, type, address, edition, month,note.

@incollection 条目为一本书中有自己题目的一部分。 不可少域 author, title, booktitle, publisher, year.

可省略域 editor, volume或number,series, type, chapter, pages,address, edition, month, note.

@inproceedings 条目为会议论文集中的一篇文章。 不可少域 author, title, booktitle, year.

可省略域 editor, volume或number, series, pages, address, month, organization, publisher, note. @InProceedings{b07name, author = {a and b},

title = {title},

booktitle = {Proceedings of the conference}, address = {Sydney, Australia}, month = Nov, year = 2008, pages = {1-2},

affiliation = {Uni-name, Country}, URL = {http://url/} };

@manual 条目为科技文档。 不可少域 title.

可省略域 author, organization, address, edition, month, year, note.

@mastersthesis 条目为硕士论文。 不可少域 author, title, school, year. 可省略域 type, address, month, note.

@misc 条目为不属于其它任何类型的作品。 不可少域没有。

可省略域 author, title, howpublished, month, year, note. @misc{name, author = \"a\ title = \"title\

howpublished = \"Website\ year = {2008},

note = {tps://www.mysite.org}} };

@phdthesis 条目为博士论文。 不可少域 author, title, school, year. 可省略域 type, address, month, note.

@proceedings 条目为会议论文集。 不可少域 title, year.

可省略域 editor,volume或number, series, address, month, organization, publisher, note.

@techreport 条目为学校或其它研究机构印制的报告。

不可少域 author, title, institution, year.

可省略域 type, number, address, month, note. @techreport{name, author = {a and b} title = {title},

institution = {institution rpt no.} year = {2008} };

@unpublished 条目为有作者和标题的还未出版的作品。 不可少域 author, title, note. 可省略域 month, year.

在每项条目中还可以有可省略域 key和crossref.

编写好这些之后,保存,然后在你的tex文档中加入下面两行: \\bibliographystyle{bst文件 xx.bst} \\bibliography{你的bib文件名 xx.bib}

加入位置就是文章的正文之后,\\end{document}之前,

在正文中引用时,采用\\cite{id}的方式来引用,id就是上文中所说的唯一的id。 PS:如果没有bst文件时,那么就需要自己来用默认提供的几个bst模板了: ---(来源:http://zzg34b.w3.c361.com/package/reference.htm) plain,按字母的顺序排列,比较次序为作者、年度和标题 unsrt,样式同plain,只是按照引用的先后排序

alpha,用作者名首字母+年份后两位作标号,以字母顺序排序 abbrv,类似plain,将月份全拼改为缩写,更显紧凑 ieeetr,国际电气电子工程师协会期刊样式 acm,美国计算机学会期刊样式

siam,美国工业和应用数学学会期刊样式 apalike,美国心理学学会期刊样式 -----

还有很多,这里不列举了,这里有所有的类型。

一般简单的用plain或者alpha就行了,ieeetr这些是针对特定的会议来使用。 上面也说了,一些期刊之类的也会提供他们自己的bst文件的,去相关网站下载即可。

tex和bib都设置好之后,就可以来编译了,编译分4步:

1. latex xx.tex 编译tex文件,没错误的话会生成aux文件,aux文件包含了引用这些的信息。

2. bibtex xx.aux 根据aux文件中记录的信息来检测bib文件中的相关文献,此时也会检测bib中相关的书写有无错误。 有错会提示,上面说的修改错误的时候就在这个时候来检测。 没有错误的话会生成bbl文件,你可以打开bbl文件看下就明白了,

bbl里面其实就是本文最刚开头说的直接用 \\begin{thebibliography}{10} \\bibitem xxxx \\bibitem xxxx \\end{thebibliography} 的这种形势。

3. latex xx.tex 再次编译,把参考文献编译进文档中。 4. latex xx.tex 三次编译,把交叉引用编译正确。

完毕,可以打开dvi看下效果了!~!~

如果嫌麻烦,可以写个脚本或者一次执行多个命令。 我一般就把所有的写成一行来用: latex my.tex; bibtex my.aux; latex my.tex; latex my.tex; dvipdf; acroread my.pdf;

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- baomayou.com 版权所有 赣ICP备2024042794号-6

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务