Note that there are some explanatory texts on larger screens.

plurals
  1. POLaTeX: bibliography per chapter
    primarykey
    data
    text
    <p>I am helping a colleague with his PhD thesis and we need to present the bibliography at the end of each chapter. </p> <p>The question is: <strong>does anyone have a minimal working example for this case using latex+bibtex?</strong></p> <p>The current document structure that we use is the following:</p> <pre><code>main.tex chap1.tex chap2.tex ... chapn.tex biblio.bib </code></pre> <p>Where <code>main.tex</code> contains packages, document declarations, macros and <code>\include</code>s for each chapter. <code>biblio.bib</code> is the <strong>only</strong> bibtex file (I think is easier to have all citations in one place).</p> <p>We have searched and tried with different latex packages, reading and following their documentation. Specifically, bibitems and chapterbib. </p> <p>bibitems successfully generates <code>bu*.aux</code> files, but when running bibtex for each one of them, an error occurs since there is no <code>\bibdata</code> element in the <code>.aux</code> file. </p> <p>chapterbib also generates a <code>.aux</code> file, but bibtex finishes with an error caused by using multiple <code>\bibliography{file}</code> in the <code>.tex</code> files (one per chapter).</p> <p>Some coworkers suggested using a separate bibtex file for each chapter, which could be a problem of maintenance in the future when citing the same publications in different chapters.</p> <p>We will like to continue having this document structure, if possible. So, if anyone could shed some light to this problem, we will appreciate it.</p> <p>Thanks.</p> <hr> <p><strong>Update: MWE found</strong> Thanks to Habi for the help, here is a working example:</p> <p>With the document structure mentioned above:</p> <pre><code>% main.tex \documentclass{report} \usepackage{url} \usepackage{natbib} \usepackage{chapterbib} \begin{document} \include{chap1} \include{chap2} % other chapters ... \end{document} % chap1.tex \chapter{one chapter} text~\cite{paper1} text~\cite{paper2} % don't forget: \bibliographystyle{plainnat} \bibliography{biblio} % chap2.tex \chapter{another chapter} text~\cite{paper2, paper3} % don't forget, again: \bibliographystyle{plainnat} \bibliography{biblio} % biblio.bib @Article{paper1, author = {John Smith}, title = {A title}, journal = {A Journal}, year = {2010} } @Article{paper2, author = {John Doe}, title = {A paper}, journal = {Another journal}, year = {2009} } @Article{paper3, author = {Yuppie Networking}, title = {My paper}, journal = {The best journal}, year = {2000} } </code></pre> <p>Finally, to generate the document:</p> <pre><code>#!/bin/bash latex main.tex for auxfile in chap*.aux do bibtex `basename $auxfile .aux` done latex main.tex latex main.tex </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload