我有一个相当简单的布局,我想让它工作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
对于 chapterbib,每个包含的章节/参考书目都需要一个\bibliographystyle
命令。如果您要生成单独的整个文档 bib,文档开头也应该有一个命令。在生成整个文档 bib 时,bibtex 会抱怨有多个\bibdata
[from \bibliography
] 和\bibstyle
[aka \bibliographystyle
] 命令,但会正确完成其工作。
事实证明 latexmk 确实知道 chapterbib,并分别对每个包含的文件以及整个文档运行 bibtex。问题是它看到来自 bibtex 的错误消息,认为它们是致命的,并中止。由于 latexmk 已经识别 chapterbib,因此应该可以相当轻松地修复该问题。同时,使用“-f”选项运行 latexmk。latexmk 文档说
-F 力量latexmk尽管有错误,仍继续处理文档。
这有点太过分了,因为它不会停下来任何错误。鉴于原始(或编辑)问题暗示使用了“-f”,尽管有错误消息,最终结果应该是正确的!事实上(根据问题编辑)如果在 latexmk 运行失败后继续运行,“-gg”选项很有用。
文档中仍然存在一个问题,但其简化形式并不明显。所有参考书目都使用按顺序编号的格式,因此最终的整体参考书目将需要与章节参考书目不同的编号,但最简单的情况除外。 chapterbib 文档(再次是第 7 项“整体参考书目”)表示
这会产生一个独立的总体书目,该书目仅对各种命名书目样式才有意义;编号样式或具有任何其他类型的自动枚举的样式将在每个书目中给出不同的标签并导致混淆。
潜在的解决方案包括
在根文档中使用命名书目样式作为整个书目。(我还不知道是否有办法告诉 natbib 仅在某些时候使用“数字”。)
使用带有枚举样式的 chapterbib 选项
[duplicate]
,这样最终的参考书目就是章节参考书目的集合(但不允许引用所包含章节之外的内容)。
答案2
与@john-collins 来回发送电子邮件;现在已经发布了一个解决此问题的新版本。
参见版本 4.70ahttp://www.personal.psu.edu/~jcc8/latexmk/versions.html