Chapterbib falha com subdiretórios e latexmk

Chapterbib falha com subdiretórios e latexmk

Eu tenho um layout bastante simples com o qual estou tentando trabalhar latexmk. O que estou fazendo de errado?

EDIT: Exemplos alterados com o resultado dos últimos avanços obtidos. all.bibprecisava ter um link simbólico para o chapterssubdiretório e -fera obrigatório no arquivo latexmk.

Embora isso gere praticamente o resultado desejado, eu diria que as coisas estão sendo feitas de maneira errada, porque -fé obrigatório e a numeração das referências é consistente (em vez de específica por capítulo).

Tentei omitir \bibliographystyledo capítulo e alterá-lo para \bibliography{../all}… sem sucesso.

Replicar com:

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

tudo.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}

tudo.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}
}

Responder1

Com Chapterbib é necessário haver um \bibliographystylecomando para cada capítulo/bibliografia incluído. Também deverá haver um no início do documento se você estiver gerando um babador separado para todo o documento. Ao gerar o whole-doc-bib, o bibtex reclamará de vários comandos \bibdata[from \bibliography] e \bibstyle[aka \bibliographystyle], mas completará seu trabalho corretamente.

Acontece que o latexmk conhece o Chapterbib e executa o bibtex em cada arquivo incluído separadamente e também em todo o documento. O problema é que ele vê as mensagens de erro do bibtex, pensa que são fatais e aborta. Como o latexmk já reconhece o Chapterbib, deve ser possível resolver o problema com bastante facilidade. Enquanto isso, execute latexmk com a opção “-f”. A documentação do latexmk diz

-f    Forçalátexmkpara continuar o processamento de documentos apesar dos erros.

Isso é um pouco pesado porque não vai parar porqualquererros. Dado que a pergunta original (ou editada) implica que foi usado "-f", o resultado final deve estar correto, apesar das mensagens de erro! Na verdade (de acordo com a edição da pergunta), a opção "-gg" é útil se você continuar após falhas na execução do latexmk.

Há ainda um problema com o documento que não é aparente na sua forma reduzida. Todas as bibliografias utilizam um formato numerado em ordem, portanto a bibliografia geral final necessitará de números diferentes das bibliografias dos capítulos, exceto no caso mais simples, conforme mostrado. A documentação do Chapterbib (novamente item 7 "Bibliografias gerais") diz

Isto produz uma bibliografia geral independente que só faz sentido para vários estilos bibliográficos nomeados; um estilo numerado ou qualquer outro tipo de enumeração automática fornecerá tags diferentes em cada bibliografia e causará confusão.

As possíveis soluções são

  • Use um estilo de bibliografia nomeado no documento raiz para a bibliografia geral. (Ainda não sei se existe uma maneira de dizer ao natbib para usar "números" apenas às vezes.)

  • Use a opção Chapterbib [duplicate]com um estilo enumerado para que a bibliografia final seja uma coleção das bibliografias dos capítulos (mas não são permitidas citações fora dos capítulos incluídos).

Responder2

Enviado por e-mail para @john-collins; e agora foi lançada uma nova versão que resolve esse problema.

Veja a versão 4.70ahttp://www.personal.psu.edu/~jcc8/latexmk/versions.html

informação relacionada