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等支持,沒有實驗。

參考文獻條目內的空格似乎過大。不知是否有插件可以顯示得更好。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM