BibTeX, biblatex and biber ⇒ chapterbib | References by Chapter
chapterbib | References by Chapter
Note also, that some of the references overlap between chapters, and so these should be included in more than one list.
Thanks!
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
chapterbib | References by Chapter
You understood something wrong. You have to run BibTeX on the AUX file of every included chapter. These files are generated when using the \include command.nina.dena wrote:[...] I've read posts on the internet which suggest that each chapter needs to be compiled independently, but I'm not sure how to do this in TexnicCenter. [...]
The best way to do that in TeXnicCenter (TXC) would be to copy a predefined build profile, rename it and supplement it in the post-processor section with the appropriate bibtex calls. Press Alt+F7 to get the dialog window "Profiles".
I attached a sample project with all necessary files to show you how this works. After running pdflatex on the main file sample.tex you have to process all the files chp01.aux, chp02.aux and chp03.aux with bibtex. Afterwards run pdflatex twice again to get all references right. In the attached archive you can find also the final output.
Best regards and welcome to the board
Thorsten
- Attachments
-
- sample.zip
- An example for bibliographies in each chapter.
- (125.37 KiB) Downloaded 2691 times
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
chapterbib | References by Chapter
- Delete current .bbl files from the sample file, so that you can see if your compilation works.
- Build (ctrl+F7) sample.tex once.
- Open chp01.tex, chp02.tex, and chp03.tex.
- For each, click "Build" in the top toolbar -> "Current File" -> "Bibtex". This creates the .bbl files again.
- Build (ctrl+F7) sample.tex twice.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
chapterbib | References by Chapter
Such a profile could provide an automatism for creating documents with bibliographies by chapters. But it would have the disadvantage that the included files always must have the same names. If the work-flow you described is OK for you, just use it.nina.dena wrote:[...] 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.
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
chapterbib | References by Chapter
thank you very much for your help. Finally got it to work! I have problem in typesetting my thesis that bibliography. It is not coming as section, it came in separate page. How to avoid that? I want to put my chapter reference without any page break.
For your clarity, in your sample file also bibliography comes on a separate page. I want to put the reference continuous to the document.
Thank you for your help.
Siva
Re: chapterbib | References by Chapter
Thank you so so much! I was for like three weeks trying to do that without success! I just followed nina's steps and it works like a charm!
Thanks again!
Matheus
chapterbib | References by Chapter
I've been trying to use chapterbib by following the instructions above as best I can, but no luck. The original template I was using would put all the references in one bibliography at the end of the document, but I want separate bibliographies for each chapter. Also, the same reference used in different chapters will be re-numbered for each chapter.
Here's what I've done. In the main document, that calls in all the chapters:
- I have added the 'sectionbib' option to the natbib package:
Code: Select all
\usepackage[square, numbers, comma, sort&compress, sectionbib]{natbib}
- I include chapterbib:
Code: Select all
\usepackage{chapterbib}
- then I call in the chapters, e.g.:
Code: Select all
\include{./Chapters/Chapter1}
Code: Select all
\section{References}
\label{References:Ch1}
\bibliographystyle{unsrtnat}
\bibliography{Bibliography}
I end up with [?] where the references should be, and no sign of any bibliographies anywhere.
Any help as to what I'm doing wrong?
Thanks,
Jonny
-
- Posts: 1
- Joined: Mon Jan 17, 2011 6:22 am
chapterbib | References by Chapter
In Windows, to automate localghost's suggestion of using the post-processor in the output profile, you can use a .bat file. The batch file applies BibTeX to every file with a .aux extension.
- to make the batch file
- Create an empty text file called "bibtex_chapters.bat".
- Put in the following two lines
where BIBTEX_EXEC_PATH is the absolute reference to your bibtex executable. For example, in the default MikTeX 2.9 installation replace BIBTEX_EXEC_PATH with
Code: Select all
@echo off for %%X in (*.aux) do BIBTEX_EXEC_PATH "%%X"
<"C:\Program Files\MiKTeX 2.9\miktex\bin\bibtex"> (ignore <'s and >'s).
- to use the batch file in a profile (see attachment).
- Put your "bibtex_chapters.bat" file in the same directory as your latex project.
- Press Alt+F7 in Texniccenter.
- Select the "Postprocessor" tab.
- Create a new(insert) postprocessor.
- Call it "Bibtex chapters".
- In the Executable line type "bibtex_chapters.bat" (see screenshot).
- Click OK
Re: chapterbib | References by Chapter
thank you very much for your answers, they have been very useful for me.
I was following the automation approach proposed by fluffy_duck in the 'sample' project proposed by localghost and found some troubles on my TXC distribution. I was continuously getting messages of the sort :
"I couldn't open file name chp01.aux.aux" ...
and the bibliographies were not generated
The way I circumvented these problems on my TXC distribution was as follows
0) I deleted all files *.aux
1) In the "bibtex_chapters.bat" I slightly modified the instructions given by fluffy_duck to get:
@echo off
for /f %%a in ('dir /b *.aux') do BIBTEX_EXEC_PATH %%~na
(in my case, BIBTEX_EXEC_PATH = "C:\Program Files (x86)\MiKTeX 2.7\miktex\bin\bibtex")
(I got the hint for the modifications from : http://jamesewelch.wordpress.com/2008/0 ... ugh-files/)
2)I pressed Alt+F7 in Texniccenter.
I selected the "Profile" "LaTeX=>PDF" (the profile I'm currently working with).
Within this profile, I inserted a new postprocessor called 'Chapterbib' (the name itselt is not relevant).
In the Executable line I typed "bibtex_chapters.bat" ...
(The difference with fluffy_duck's procedure is that I did not create a new preferred "Profile")
3) I built (Ctrl.+F7) the main '.tex' (sample.tex) 3 times.
The resulting .pdf was OK.
I hope it helps!
Best regards,
-Roberto