0

I am doing a book document which has 3 chapters. Each chapter has 4 sections. I need to put the bibliography per section, so I am using \refsection enviorment to do the job.

It works perfectly but, the problem is I need to compile 12 times manually the bibliography each time.

I am working with this example code with 2 chapters with 1 bibliography section per chapter:

\documentclass[12pt,twoside]{book}
\title{\LaTeX test for several things in my thesis}
\author{John Doe}

%% Biblio %%

\usepackage[backend = bibtex8,citestyle=numeric-comp,]{biblatex}

\addbibresource{biblio_1.bib}
\addbibresource{biblio_2.bib}

%% Document %%

\begin{document}

\begin{refsection}
\chapter{This is the 1$^{st}$ chapter}
Hello world, this is one reference \cite{Ex1}, and this is other \cite{Ex2}.
\printbibliography
\end{refsection}

%%

\begin{refsection}
\chapter{This is the 2$^{nd}$ chapter}
Hello world, this is one reference \cite{Ex3}, and this is other \cite{Ex1}.
\printbibliography
\end{refsection}

\end{document}

Is there any way to do a batch compilation in TeXMaker to avoid compiling 12 times (changing the .aux name by hand in the compiler each time) and read all the .aux documents (FileName1-blx.aux, FileName2-blx.aux...FileName12-blx.aux) in one sigle command?

Thank you so much in advance

2

The best solution

The best solution would be to use Biber instead of BibTeX/BibTeX8, which are considered legacy backends now. With Biber you only need to call the backend on one file.

A switch to Biber is a good idea anyway since some great features of biblatex are only available with Biber. BibTeX will only allow you to access a reduced set of features. For a while now the biblatex documentation assumes that new documents use Biber.

Switching to Biber should be as simple as changing backend=bibtex8 to

backend=biber

Then you need to tell your editor to run Biber instead of BibTeX, see Biblatex with Biber: Configuring my editor to avoid undefined citations.


The second-best solution

You really should be using Biber, but if you absolutely can't make the switch you could try to compile your document with latexmk.

latexmk can figure out which tools need to be run on your TeX file automatically.

So

latexmk FileName

will automatically run

pdflatex FileName
bibtex8 FileName
bibtex8 FileName1-aux
bibtex8 FileName2-aux
pdflatex FileName
...

until the document is stable.

Of course nothing is stopping you from using latexmk together with Biber as well.


A solution

You could also write a batch script/bash script to do this for you and call that in your editor.

For Windows the following seems to work OK

@ECHO OFF

for %%f in (%**.aux) do (
    echo Running BibTeX8 on %%~nf
    bibtex8 %%~nf
)

Save it as compilewithbibtex.bat. Then run

 pdflatex <documentname>
 compilewithbibtex.bat <documentname>
 pdflatex <documentname>

in your working directory.

Something similar could be done for Bash as well.

  • Thank you so much for your answer. The problem is Biber is giving me problems. I can't compile the bibliography with it, so this is why I am trying with bibtex8. I will follow your advice using Biber. I will try to fix the problem... Previous to this publish post I checked the one you mention in "the best solution", but did not worked for me. Thank you! – vGenoves Jun 6 '18 at 2:11
  • @vGenoves How does Biber not work for you? Do you get errors or warnings when you try to run it? Is Biber even installed etc. etc. Have a look at tex.stackexchange.com/q/286706/35864 – moewe Jun 6 '18 at 5:36
  • Hi @moewe, I found the problem in Biber. The point is, Biber is much more sensitive to coding process than Bibtex8. Really, really much more. So, if there is some "simple" error, biber just not compile, but bibtex does (badly, and you revise it later). Thank you so much for your interest! – vGenoves Jun 6 '18 at 15:08
  • @vGenoves Indeed, Biber is more sensitive. That is because Biber needs to interpret and convert the characters it is fed in the .bib file, so it must be sure it got them right. If there is a character that does not make sense in the current encoding that is a serious problem, because it can't be sorted, interpreted and replaced (if necessary) by Biber. BibTeX mostly just passes a character on as-is if it doesn't know what to do and I assume BibTeX8 does a similar thing. – moewe Jun 6 '18 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.