linux下编译bib、tex生成pdf文件

实验:

在linux环境下,编译(英文)*.bib和*.tex文件,生成pdf文件。

环境:

fedora 20(uname -a : Linux localhost.localdomain 3.19.8-100.fc20.i686+PAE #1 SMP Tue May 12 17:27:49 UTC 2015 i686 i686 i386 GNU/Linux)

texlive(yum info texlive :

...

名称    :texlive
架构    :i686
时期       :3
版本    :2013
发布    :6.20131226_r32488.fc20)

...)

文件及内容:

1.

@article{DK89,
author = "Donald Knuth",
title = "Typesetting Concrete Mathematics",
journal = "TUGboat",
volume = 10,
number = 1,
pages = "31--36",
month = Apr,
year = 1989
}

tex.bib

2.

\documentclass{article}
\begin{document} \section*{Recommended texts}
To study \TeX\ in depth, set \cite{DK89}. \bibliographystyle{alpha}
\bibliography{tex}
\end{document}

bb.tex

编译命令及输出

1 . pdflatex bb.tex

This is pdfTeX, Version 3.1415926-2.6-1.40.14 (TeX Live 2014/dev)
restricted \write18 enabled.
entering extended mode
(./bb.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo))
No file bb.aux. LaTeX Warning: Citation `DK89' on page 1 undefined on input line 5. No file bb.bbl.
[1{/usr/share/texlive/texmf-dist/fonts/map/pdftex/updmap/pdftex.map}] (./bb.aux
) LaTeX Warning: There were undefined references. )</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></us
r/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/shar
e/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on bb.pdf (1 page, 31680 bytes).
Transcript written on bb.log.

输出

目录下会生成bb.aux、bb.log、bb.pdf三个个文件。bb.aux有用。 bb.pdf文件内参考文献,没有正确显示出来。只显示"?",表明还没有引用。

2. bibtex bb

This is BibTeX, Version 0.99d (TeX Live 2014/dev)
The top-level auxiliary file: bb.aux
The style file: alpha.bst
Database file #1: tex.bib

输出

生成 bb.bbl,bb.blg两个文件。这两个文件都是字符文件,可查看。其中*.bbl内容就是要插入到*.tex中去的。注意命令中,文件名字是bb,而不是bb.tex。

3. pdflatex bb.tex

This is pdfTeX, Version 3.1415926-2.6-1.40.14 (TeX Live 2014/dev)
restricted \write18 enabled.
entering extended mode
(./bb.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./bb.aux) LaTeX Warning: Citation `DK89' on page 1 undefined on input line 5. (./bb.bbl
Underfull \hbox (badness 1383) in paragraph at lines 4--7
[]\OT1/cmr/m/n/10 Donald Knuth. Type-set-ting con-crete math-e-mat-ics. \OT1/
cmr/m/it/10 TUG-boat\OT1/cmr/m/n/10 ,
) [1{/usr/share/texlive/texmf-dist/fonts/map/pdftex/updmap/pdftex.map}]
(./bb.aux) LaTeX Warning: There were undefined references. LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. )
(see the transcript file for additional information)</usr/share/texlive/texmf-d
ist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texlive/texmf-dist/fo
nts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/texmf-dist/fonts/ty
pe1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/pub
lic/amsfonts/cm/cmti10.pfb>
Output written on bb.pdf (1 page, 44894 bytes).
Transcript written on bb.log.

输出

无新文件生成,但查看bb.pdf,其中的参考文献已经显示出来,但正文中对参考文献的引用依然显示为"?",没有正确(产生交叉)引用。

4. pdflatex bb.tex

This is pdfTeX, Version 3.1415926-2.6-1.40.14 (TeX Live 2014/dev)
restricted \write18 enabled.
entering extended mode
(./bb.tex
LaTeX2e <2011/06/27>
Babel <3.9h> and hyphenation patterns for 2 languages loaded.
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo)) (./bb.aux) (./bb.bbl Underfull \hbox (badness 1383) in paragraph at lines 4--7
[]\OT1/cmr/m/n/10 Donald Knuth. Type-set-ting con-crete math-e-mat-ics. \OT1/
cmr/m/it/10 TUG-boat\OT1/cmr/m/n/10 ,
) [1{/usr/share/texlive/texmf-dist/fonts/map/pdftex/updmap/pdftex.map}]
(./bb.aux) )
(see the transcript file for additional information)</usr/share/texlive/texmf-d
ist/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texlive/texmf-dist/fo
nts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/typ
e1/public/amsfonts/cm/cmti10.pfb>
Output written on bb.pdf (1 page, 36047 bytes).
Transcript written on bb.log.

输出

此时,用evince bb.pdf查看生成的pdf,已经是一份正式的档了。

总结:

为了编译出出正确的pdf文件,需要执行4条命令完成整个编译过程。

留意:

只试了英文,没试中文。中文需要cjk等支持,没有实验。

参考文献条目内的空格似乎过大。不知是否有插件可以显示得更好。

上一篇:Intent详解


下一篇:【转载】MySQL5.6.27 Release Note解读(innodb及复制模块)