
我有一個相當簡單的佈局,我正在嘗試使用它latexmk
。我究竟做錯了什麼?
編輯:根據最新進展的結果更改了範例。
all.bib
必須符號連結到chapters
子目錄,並且-f
在latexmk
.儘管這產生了幾乎所需的輸出,但我想說事情做得不對,因為這
-f
是必需的,並且參考文獻的編號在整個過程中是一致的(而不是每章特定的)。我嘗試
\bibliographystyle
從這一章中省略,並將其更改為\bibliography{../all}
……但無濟於事。
複製:
$ latexmk -gg -pdf -quiet -f
Latexmk: Run number 1 of rule 'pdflatex'
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Latexmk: Non-existent bbl file 'chapters/ch0.bbl'
No file chapters/ch0.bbl.
Latexmk: Non-existent bbl file 'all.bbl'
No file all.bbl.
Latexmk: Run number 1 of rule 'bibtex chapters/ch0'
For rule 'bibtex chapters/ch0', running '&run_bibtex( )' ...
-- IEEEtranN.bst version 1.14 (2015/08/26) by Michael Shell.
-- http://www.michaelshell.org/tex/ieeetran/bibtex/
-- See the "IEEEtran_bst_HOWTO.pdf" manual for usage information.
** Natbib version - not for normal IEEE work.
Done.
Latexmk: Run number 1 of rule 'bibtex all'
For rule 'bibtex all', running '&run_bibtex( )' ...
Illegal, another \bibstyle command---line 3 of file chapters/ch0.aux
: \bibstyle
: {IEEEtranN}
I'm skipping whatever remains of this command
Illegal, another \bibdata command---line 7 of file all.aux
: \bibdata
: {all}
I'm skipping whatever remains of this command
-- IEEEtranN.bst version 1.14 (2015/08/26) by Michael Shell.
-- http://www.michaelshell.org/tex/ieeetran/bibtex/
-- See the "IEEEtran_bst_HOWTO.pdf" manual for usage information.
** Natbib version - not for normal IEEE work.
Done.
(There were 2 error messages)
Latexmk: Run number 2 of rule 'pdflatex'
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Latexmk: Run number 2 of rule 'bibtex chapters/ch0'
For rule 'bibtex chapters/ch0', running '&run_bibtex( )' ...
-- IEEEtranN.bst version 1.14 (2015/08/26) by Michael Shell.
-- http://www.michaelshell.org/tex/ieeetran/bibtex/
-- See the "IEEEtran_bst_HOWTO.pdf" manual for usage information.
** Natbib version - not for normal IEEE work.
Done.
Latexmk: Run number 2 of rule 'bibtex all'
For rule 'bibtex all', running '&run_bibtex( )' ...
Illegal, another \bibstyle command---line 3 of file chapters/ch0.aux
: \bibstyle
: {IEEEtranN}
I'm skipping whatever remains of this command
Illegal, another \bibdata command---line 7 of file all.aux
: \bibdata
: {all}
I'm skipping whatever remains of this command
-- IEEEtranN.bst version 1.14 (2015/08/26) by Michael Shell.
-- http://www.michaelshell.org/tex/ieeetran/bibtex/
-- See the "IEEEtran_bst_HOWTO.pdf" manual for usage information.
** Natbib version - not for normal IEEE work.
Done.
(There were 2 error messages)
Latexmk: Run number 3 of rule 'pdflatex'
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
Collected error summary (may duplicate other messages):
bibtex all: Bibtex errors: See file 'all.blg'
全特克斯
\documentclass{book}
\usepackage[sectionbib,square,sort,comma,numbers]{natbib}
\usepackage{chapterbib}
%\begin{filecontents*}{all.bib}\end{filecontents*}
\begin{document}
\bibliographystyle{IEEEtranN}
\include{chapters/ch0}
Hello random\cite{hawMaximizationExtractableRandomness2015} world
\bibliography{all}
\end{document}
章節/ch0.tex
\chapter{ch0}
so much div\cite{govindarajuGeneticsFraminghamHeart2008}
\bibliographystyle{IEEEtranN}
\bibliography{all}
全部圍脖
@article{hawMaximizationExtractableRandomness2015,
title = {Maximization of {{Extractable Randomness}} in a {{Quantum Random}}-{{Number Generator}}},
author = {Haw, J. Y. and Assad, S. M. and Lance, A. M. and Ng, N. H. Y. and Sharma, V. and Lam, P. K. and Symul, T.},
year = {2015},
month = may,
volume = {3},
pages = {054004},
issn = {2331-7019},
doi = {10.1103/PhysRevApplied.3.054004},
journal = {Physical Review Applied},
language = {en},
number = {5}
}
@article{govindarajuGeneticsFraminghamHeart2008,
title = {Genetics of the {{Framingham Heart Study Population}}},
author = {Govindaraju, Diddahally R. and Cupples, L. Adrienne and Kannel, William B. and O'Donnell, Christopher J. and Atwood, Larry D. and D'Agostino, Ralph B. and Fox, Caroline S. and Larson, Marty and Levy, Daniel and Morabito, Joanne and Vasan, Ramachandran S. and Splansky, Greta Lee and Wolf, Philip A. and Benjamin, Emelia J.},
year = {2008},
volume = {62},
pages = {33--65},
issn = {0065-2660},
doi = {10.1016/S0065-2660(08)00602-0},
abstract = {This article provides an introduction to the Framingham Heart Study (FHS) and the genetic research related to cardiovascular diseases conducted in this unique population. It briefly describes the origins of the study, the risk factors that contribute to heart disease and the approaches taken to discover the genetic basis of some of these risk factors. The genetic architecture of several biological risk factors has been explained using family studies, segregation analysis, heritability, phenotypic and genetic correlations. Many quantitative trait loci underlying cardiovascular diseases have been discovered using different molecular markers. Additionally, results from genome-wide association studies using 100,000 markers, and the prospects of using 550,000 markers for association studies are presented. Finally, the use of this unique sample in genotype and environment interaction is described.},
journal = {Advances in genetics},
language = {eng},
pmid = {19010253}
}
答案1
\bibliographystyle
對於chapterbib ,每個包含的章節/參考書目都需要有一個指令。如果您要產生單獨的整個文件參考書目,則文件的開頭也應該有一個。當產生 Whole-doc-bib 時,bibtex 會抱怨多個\bibdata
[from \bibliography
] 和\bibstyle
[aka \bibliographystyle
] 指令,但會正確完成其工作。
事實證明,latexmk 確實了解chapterbib,並分別對每個包含的文件以及整個文件運行bibtex。問題是它看到來自 bibtex 的錯誤訊息,認為它們是致命的,然後中止。由於 Latexmk 已經識別chapterbib,因此應該可以相當容易地解決問題。同時,使用“-f”選項運行 Latexmk。 Latexmk 文件說
-F 力量乳膠儘管出現錯誤仍繼續文檔處理。
這有點嚴厲,因為它不會停下來任何錯誤。鑑於原始(或編輯的)問題暗示使用了“-f”,儘管有錯誤訊息,但最終結果應該是正確的!事實上(根據問題編輯)如果您在 Latexmk 運行失敗後繼續,“-gg”選項很有用。
該文檔仍然存在一個問題,其簡化形式並不明顯。所有參考書目都使用按順序編號的格式,因此最終的總體參考書目將需要與章節參考書目不同的編號,除瞭如圖所示的最簡單的情況。 Chapterbib 文件(同樣第 7 項「總體參考書目」)說
這會產生一個獨立的整體參考書目,僅對各種命名的參考書目風格有意義;編號樣式或具有任何其他類型的自動枚舉的樣式將在每個參考書目中給出不同的標籤並導致混亂。
潛在的解決方案是
在根文檔中為整體參考書目使用命名參考書目樣式。 (我還不知道是否有辦法告訴 natbib 僅有時使用“數字”。)
使用帶有枚舉樣式的chapterbib選項
[duplicate]
,以便最終的參考書目是章節參考書目是章節參考書目的集合(但不允許在所包含的章節之外進行引用)。
答案2
與@john-collins 來回發送電子郵件;現在發布了新版本,解決了這個問題。
請參閱版本 4.70ahttp://www.personal.psu.edu/~jcc8/latexmk/versions.html