BibTeX, biblatex and biberBibliography for each Chapter from one Database File

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
Leoni
Posts: 7
Joined: Sat Feb 12, 2011 1:03 pm

Bibliography for each Chapter from one Database File

Post by Leoni »

Hi all,

after searching this forum to find an answer for my problem, I couldn't find anything that could help, so I started a new topic.
I've got the following problem:
I would like to have bibliography after each chapter of my Thesis. I use "chapterbib" package. My endfile looks like this:

Code: Select all

\include{chapter1}
\include{chapter2}
...
\include{chapter5}
As far as I understood, I have to use:
\bibliography{library} not in the end output file, but in the end of each chapter to include.
The things is: I have worked with Endnote X4 to create references, so I have about 500 papers there. Then I just choose the BibTex style to export, export the endnote file to library.txt, change the file extension to library.bib, so that I have got one file with all reference in.
The problem is, it does not work this way. When I include the command \bibliography{library} after each chapter, I don't get any references by compiling the end output file. If I include \bibliography{library} in the end file, I do get everything in the end, and not chapter by chapter.
Hopefully I have explained it clear, I am not that experienced with TeX.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Bibliography for each Chapter from one Database File

Post by frabjous »

According to the chapterbib documentation, and my own experiments, the following works.

Suppose main.tex looks roughly like this:

Code: Select all

\documentclass{book}
\usepackage{chapterbib}
\begin{document}
\include{chap1}
\include{chap2}
\include{chap3}
\end{document}
And chap1.tex (and chap2.tex and chap3.tex are similar, each with their own \bibliographystyle and \bibliography commands):

Code: Select all

\chapter{First one}
Here is my amazing chapter
\cite{somebibkey}

\bibliographystyle{plain}
\bibliography{library}
That should work just fine, but here's one caveat. The sequence for processing the files is slightly different, because you need to run bibtex separately on each of the included files' .aux file, rather than on the .aux file for the main file. That is, without chapterbib, one would normally run the following sequence:

Code: Select all

pdflatex main.tex [or just latex main.tex]
bibtex main.aux
pdflatex main.tex
pdflatex main.tex
But with chapterbib, one needs to run instead:

Code: Select all

pdflatex main.tex
bibtex chap1.aux
bibtex chap2.aux
bibtex chap3.aux [etc.]
pdflatex main.tex
pdflatex main.tex
Now if I had to guess what your problem is, which is hard without a minimal working example, I'd guess the issue is that your LaTeX editor is configured to try to process things the first way, and not the second way. You'll either need to reconfigure it, or process things from the command-line.

If the issue is instead with the Endnote export, then I'm afraid I cannot help with that, since I don't know anything about it.
Leoni
Posts: 7
Joined: Sat Feb 12, 2011 1:03 pm

Bibliography for each Chapter from one Database File

Post by Leoni »

Hi frabjous,

thanks a lot for your post. I have actually figured out just 15 min ago (oh man, it took me almost 5h), what was wrong...

Everywhere people write, "run it in bibtex", which was confusing for me. I couldn't figure out, what does that exactly mean. Sometimes more experienced people do not recognize, that it could be confusing for newbies to understand the things :)

So, the best answer I found is from nina.dena:
nina.dena wrote: Thanks for your help! Finally got it to work!! Just to make it crystal clear for other users, here's what I did:
  1. Delete current .bbl files from the sample file, so that you can see if your compilation works.
  2. Build (ctrl+F7) sample.tex once.
  3. Open chp01.tex, chp02.tex, and chp03.tex.
  4. For each, click "Build" in the top toolbar -> "Current File" -> "Bibtex". This creates the .bbl files again.
  5. Build (ctrl+F7) sample.tex twice.
As an aside: I didn't actually really understand the purpose of copying and changing the "Profile". Perhaps this speeds things up, but, oh well, I have it working now.
So basically, I was doing everything right, but I just didn't know how to run the bibtex on file :) sad but true

so, thanks a lot to nina.dena :)
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Bibliography for each Chapter from one Database File

Post by frabjous »

Leoni wrote:Hi frabjous,

thanks a lot for your post. I have actually figured out just 15 min ago (oh man, it took me almost 5h), what was wrong...

Everywhere people write, "run it in bibtex", which was confusing for me. I couldn't figure out, what does that exactly mean. Sometimes more experienced people do not recognize, that it could be confusing for newbies to understand the things :)

So, the best answer I found is from nina.dena:
nina.dena wrote: Thanks for your help! Finally got it to work!! Just to make it crystal clear for other users, here's what I did:
  1. Delete current .bbl files from the sample file, so that you can see if your compilation works.
  2. Build (ctrl+F7) sample.tex once.
  3. Open chp01.tex, chp02.tex, and chp03.tex.
  4. For each, click "Build" in the top toolbar -> "Current File" -> "Bibtex". This creates the .bbl files again.
  5. Build (ctrl+F7) sample.tex twice.
Sorry, but I have to respond to this.

When you posted your question, you did not tell us what editor you were using. You didn't even tell us what operating system you were using. In fact, we still don't know, so the above instructions will not be helpful to anyone else (and certainly not crystal clear!), so I fail to see how they could be "the best you've found". Out of context, it's a lousy answer.

Please keep in mind what the audience knows when you ask a question. If you want that kind of detailed "click here, type this" kind of answer, you need to provide the right amount of information when you ask your question.

Rather than blaming more experienced people for not understanding what newbies need, think about under what conditions the kind of answer you want is even theoretically possible, and realize that this was not done here. I recommend "How to Ask Questions the Smart Way".
Post Reply