Chapterbib falla con subdirectorios y latexmk

Chapterbib falla con subdirectorios y latexmk

Tengo un diseño bastante simple con el que estoy intentando trabajar latexmk. ¿Qué estoy haciendo mal?

EDITAR: Ejemplos modificados con el resultado de los últimos avances realizados. all.bibtenía que estar vinculado simbólicamente al chapterssubdirectorio y -fera requerido en latexmk.

Aunque esto genera prácticamente el resultado deseado, yo diría que las cosas se están haciendo mal, porque -fes necesario, y la numeración de las referencias es consistente en todo momento (en lugar de específica por capítulo).

Intenté omitirlo \bibliographystyledel capítulo y cambiarlo a \bibliography{../all}... sin éxito.

Replicar con:

$ 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'

todo.tex

\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}

capítulos/ch0.tex

\chapter{ch0}
so much div\cite{govindarajuGeneticsFraminghamHeart2008}

\bibliographystyle{IEEEtranN}
\bibliography{all}

todo.babero

@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}
}

Respuesta1

Con Chapterbib es necesario que haya un \bibliographystylecomando para cada capítulo/bibliografía incluida. También debe haber uno al principio del documento si está generando un babero para todo el documento por separado. Al generar todo el documento-bib, bibtex se quejará de múltiples comandos \bibdata[from \bibliography] y \bibstyle[aka \bibliographystyle], pero completará su trabajo correctamente.

Resulta que latexmk conoce el capítulobib y ejecuta bibtex en cada archivo incluido por separado, y también en todo el documento. El problema es que ve los mensajes de error de bibtex, piensa que son fatales y aborta. Dado que latexmk ya reconoce el capítulo bib, debería ser posible solucionar el problema con bastante facilidad. Mientras tanto, ejecute latexmk con la opción "-f". La documentación de latexmk dice

-F    Fuerzalátexcontinuar con el procesamiento de documentos a pesar de los errores.

Eso es un poco duro porque no se detendrá porcualquiererrores. Dado que la pregunta original (o editada) implica que se usó "-f", el resultado final debería ser correcto, a pesar de los mensajes de error. De hecho (según la edición de la pregunta), la opción "-gg" es útil si continúa después de ejecuciones fallidas de latexmk.

Todavía hay un problema con el documento que no es evidente en su forma reducida. Todas las bibliografías utilizan un formato numerado en orden, por lo que la bibliografía general final necesitará números diferentes de las bibliografías de los capítulos, excepto en el caso más simple como se muestra. La documentación del capítulo bib (nuevamente el punto 7 "Bibliografías generales") dice

Esto produce una bibliografía general independiente que sólo tiene sentido para varios estilos de bibliografía nombrados; un estilo numerado, o uno con cualquier otro tipo de enumeración automática, dará etiquetas diferentes en cada bibliografía y generará confusión.

Las posibles soluciones son

  • Utilice un estilo de bibliografía con nombre en el documento raíz para la bibliografía general. (Todavía no sé si hay una manera de decirle a natbib que use "números" sólo algunas veces).

  • Utilice la opción Chapterbib [duplicate]con un estilo enumerado para que la bibliografía final sea una colección de las bibliografías de los capítulos (pero no se permiten citas fuera de los capítulos incluidos).

Respuesta2

Enviado por correo electrónico de ida y vuelta con @john-collins; y ahora se ha lanzado una nueva versión que resuelve este problema.

Ver versión 4.70ahttp://www.personal.psu.edu/~jcc8/latexmk/versions.html

información relacionada