
У меня есть довольно простой макет, с которым я пытаюсь работать 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}
все.bib
@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, должно быть возможно довольно легко исправить проблему. Тем временем запустите latexmk с опцией "-f". В документации latexmk говорится:
-ф Силалатексмкпродолжить обработку документов, несмотря на ошибки.
Это немного грубо, потому что это не прекратитсялюбойошибки. Учитывая, что исходный (или отредактированный) вопрос подразумевает, что использовался "-f", конечный результат должен быть правильным, несмотря на сообщения об ошибках! Действительно (согласно редактированию вопроса) опция "-gg" полезна, если вы продолжаете после неудачных запусков latexmk.
Все еще есть проблема с документом, которая не очевидна в его сокращенной форме. Все библиографии используют формат нумерации по порядку, поэтому для окончательной общей библиографии потребуются другие номера, чем в библиографиях глав, за исключением простейшего случая, как показано. В документации chapterbib (снова пункт 7 "Общие библиографии") говорится:
Это создает независимую общую библиографию, которая имеет смысл только для различных именованных стилей библиографии; нумерованный стиль или стиль с любым другим типом автоматической нумерации даст разные теги в каждой библиографии и приведет к путанице.
Возможные решения:
Используйте именованный стиль библиографии в корневом документе для общей библиографии. (Я пока не знаю, есть ли способ указать natbib использовать «номера» только иногда.)
Используйте опцию chapterbib
[duplicate]
с нумерованным стилем, чтобы окончательная библиография представляла собой сборник библиографий глав (но ссылки за пределами включенных глав не допускаются).
решение2
Общался по электронной почте с @john-collins; теперь выпущена новая версия, которая решает эту проблему.
См. версию 4.70ahttp://www.personal.psu.edu/~jcc8/latexmk/versions.html