# Compile several bibliography parts in TeXmaker

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}

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

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


• @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