chapterbib fallisce con sottodirectory e latexmk

Aug 23 2020

Ho un layout piuttosto semplice con cui sto cercando di lavorare latexmk. Che cosa sto facendo di sbagliato?

EDIT: esempi modificati con il risultato degli ultimi progressi compiuti. all.bibdoveva essere collegato simbolicamente alla chapterssottodirectory ed -fera richiesto in latexmk.

Sebbene questo generi praticamente l'output desiderato, direi che le cose vengono fatte male, perché -fè richiesto e la numerazione dei riferimenti è coerente in tutto (piuttosto che specifica per capitolo).

Ho provato a ometterlo \bibliographystyledal capitolo ea cambiarlo in \bibliography{../all}... senza successo.

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

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

capitoli/ch0.tex

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

\bibliographystyle{IEEEtranN}
\bibliography{all}

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

Risposte

1 DonaldArseneau Aug 24 2020 at 04:58

Con chapterbib ci deve essere un \bibliographystylecomando per ogni capitolo/bibliografia inclusa. Dovrebbe essercene uno anche all'inizio del documento se stai generando una pettorina separata per l'intero documento. Durante la generazione di whole-doc-bib, bibtex si lamenterà di più comandi \bibdata[from \bibliography] e \bibstyle[aka \bibliographystyle], ma completerà correttamente il suo lavoro.

Si scopre che latexmk conosce chapterbib ed esegue bibtex su ciascun file incluso separatamente e anche sull'intero documento. Il problema è che vede i messaggi di errore di bibtex, pensa che siano fatali e si interrompe. Poiché latexmk riconosce già chapterbib, dovrebbe essere possibile risolvere il problema abbastanza facilmente. Nel frattempo, esegui latexmk con l'opzione "-f". La documentazione di latexmk dice

-f    Forza latexmk a continuare l'elaborazione del documento nonostante gli errori.

Questo è un po 'pesante perché non si fermerà per eventuali errori. Dato che la domanda originale (o modificata) implica l'uso di "-f", il risultato finale dovrebbe essere corretto, nonostante i messaggi di errore! In effetti (secondo la modifica della domanda) l'opzione "-gg" è utile se si continua dopo le esecuzioni fallite di latexmk.

C'è ancora un problema con il documento che non è evidente nella sua forma ridotta. Tutte le bibliografie utilizzano un formato numerato in ordine, quindi la bibliografia complessiva finale avrà bisogno di numerazioni diverse dalle bibliografie dei capitoli, ad eccezione del caso più semplice come mostrato. La documentazione del capitolo bib (di nuovo punto 7 "Bibliografie generali") dice

Ciò produce una bibliografia complessiva indipendente che ha senso solo per vari stili di bibliografia con nome; uno stile numerato o uno con qualsiasi altro tipo di enumerazione automatica darà tag diversi in ogni bibliografia e creerà confusione.

Le possibili soluzioni sono

  • Utilizzare uno stile di bibliografia con nome nel documento radice per la bibliografia complessiva. (Non so ancora se esiste un modo per dire a natbib di usare "numeri" solo a volte.)

  • Utilizzare l'opzione chapterbib [duplicate]con uno stile enumerato in modo che la bibliografia finale sia una raccolta delle bibliografie dei capitoli (ma non sono consentite citazioni al di fuori dei capitoli inclusi).

SamuelMarks Sep 18 2020 at 09:53

Email avanti e indietro con @john-collins; e ora è stata rilasciata una nuova versione che risolve questo problema.

Vedere la versione 4.70ahttp://www.personal.psu.edu/~jcc8/latexmk/versions.html