# List of publications with multiple bib files

I am using bibtex to create a list of publications. For each year, I have a .bib file containing the publications of that year. What I have tried to do is the following:

\documentclass{article}
\usepackage{filecontents, pgffor}

\title{\Large\bfseries
Selected Publications
}

\author{
{\scshape Dr MWE}\\
Department of Minimum Working,\\
University of Examples
}

\begin{filecontents}{publications_2000.bib}
@article{MWE1,
author  = {MWE, Dr},
title   = {How to produce an {MWE}},
journal = {Journal of MWEs},
year    = {2000},
volume  = {1},
pages   = {1--10}
}
\end{filecontents}

\begin{filecontents}{publications_2001.bib}
@article{MWE2,
author  = {MWE, Dr},
title   = {How to produce yet another an {MWE}},
journal = {Journal of MWEs},
year    = {2001},
volume  = {2},
pages   = {1--10}
}
\end{filecontents}

\begin{filecontents}{publications_2002.bib}
@article{MWE2,
author  = {MWE, Dr},
title   = {How to produce yet another {MWE}, again},
journal = {Journal of MWEs},
year    = {2002},
volume  = {3},
pages   = {1--10}
}
\end{filecontents}

\begin{document}
\maketitle
\nocite{*}
\bibliographystyle{unsrt}
\foreach \yr in {2000,...,2002}{
\renewcommand\refname{\large \yr}
\bibliography{publications_\yr}
}
\end{document}


Which I hoped would output the bibliography for each file (publications_20xx.bib). The output I got however was the following:

In other words, repetition of the same year over and over. I've tried having a look at the package multibib, but I can't seem to get it to work for this example. I appreciate any help.

• Because of the multi-pass compilation required (aux->bbl, etc.), you are not able, with the standard BibTeX interface, to invoke \bibliography more than once in a document while expecting a different output each time. – Steven B. Segletes Oct 10 '18 at 13:51
• @Steven can you think of some workaround? – Luke Collins Oct 10 '18 at 19:33
• I cannot come up with one, but there may well be a workaround. It would require the code to write separate bbl files for each year's bibliographic entries. It would require the \bibliography macro to be extended to indicate which bbl file to use, and would require the aux file to keep track of it all. I think it is a formidable undertaking, but never underestimate the drive of LaTeXers. There may already be a package that can do it...but it is certainly not part of the standard LaTeX macro packages. – Steven B. Segletes Oct 10 '18 at 19:47
• There are packages like ctan.org/pkg/multibib, ctan.org/pkg/bibunits, ctan.org/pkg/bibtopic, ctan.org/pkg/multibbl that can help with multiple bibliographies for classic BibTeX. I don't really have any experience with those packages, but I'm lead to believe that the way BibTeX works will probably require multiple BibTeX runs on multiple different files. If this is the only bibliography in your document, one could probably also modify the .bst file quite heavily to output a multi-part bibliography. – moewe Oct 11 '18 at 7:53
• If you are willing to switch to biblatex tex.stackexchange.com/q/346564/35864 and linked questions could solve the problem as posed, but you might also be interested in ctan.org/pkg/biblatex-publist to produce a list of publications. – moewe Oct 11 '18 at 7:55

I would use bibtopic to which lets you easily group different bibs. You just have to run bibtex for each generated .aux file and you can either continue or reset numbering.

    \documentclass{article}
\usepackage{filecontents, pgffor}
\usepackage{bibtopic}
%\usepackage[sectcntreset]{bibtopic} %use to reset numbering in each section

\title{\Large\bfseries
Selected Publications
}

\author{
{\scshape Dr MWE}\\
Department of Minimum Working,\\
University of Examples
}

\begin{filecontents}{publications_2000.bib}
@article{MWE1,
author  = {MWE, Dr},
title   = {How to produce an {MWE}},
journal = {Journal of MWEs},
year    = {2000},
volume  = {1},
pages   = {1--10}
}
\end{filecontents}

\begin{filecontents}{publications_2001.bib}
@article{MWE2,
author  = {MWE, Dr},
title   = {How to produce yet another an {MWE}},
journal = {Journal of MWEs},
year    = {2001},
volume  = {2},
pages   = {1--10}
}
\end{filecontents}

\begin{filecontents}{publications_2002.bib}
@article{MWE3,
author  = {MWE, Dr},
title   = {How to produce yet another {MWE}, again},
journal = {Journal of MWEs},
year    = {2002},
volume  = {3},
pages   = {1--10}
}
\end{filecontents}

\begin{document}
\maketitle
\nocite{*}
\bibliographystyle{unsrt}
\foreach \yr in {2000,...,2002}{
\subsection*{\large \yr}
\begin{btSect}{publications_\yr}
\btPrintNotCited
\end{btSect}
}
\end{document}


Here is an approach with multibib:

\documentclass{article}

\usepackage{filecontents,multibib,etoolbox}

\title{\Large\bfseries
Selected Publications
}

\author{
{\scshape Dr MWE}\\
Department of Minimum Working,\\
University of Examples
}

\begin{filecontents}{publications-2000.bib}
@article{MWE1,
author  = {MWE, Dr},
title   = {How to produce an {MWE}},
journal = {Journal of MWEs},
year    = {2000},
volume  = {1},
pages   = {1--10}
}
\end{filecontents}

\begin{filecontents}{publications-2001.bib}
@article{MWE2,
author  = {MWE, Dr},
title   = {How to produce yet another an {MWE}},
journal = {Journal of MWEs},
year    = {2001},
volume  = {2},
pages   = {1--10}
}
\end{filecontents}

\begin{filecontents}{publications-2002.bib}
@article{MWE2,
author  = {MWE, Dr},
title   = {How to produce yet another {MWE}, again},
journal = {Journal of MWEs},
year    = {2002},
volume  = {3},
pages   = {1--10}
}
\end{filecontents}

\newcommand{\yearlist}{}
\renewcommand{\do}[1]{\newcites{year\romannumeral #1}{#1}}
\dolistloop{\yearlist}

\begin{document}
\maketitle

\renewcommand{\do}[1]{\csuse{nociteyear\romannumeral #1}{*}%
\csuse{bibliographystyleyear\romannumeral #1}{unsrt}%
\csuse{bibliographyyear\romannumeral #1}{publications-#1}}%
\dolistloop{\yearlist}

\end{document}


What multibib does, is introduce a new command \newcites. Writing

\newcites{papers}{My papers}


prepares for creating a bibliography with heading My papers. It creates new commands

\citepapers
\nocitepapers
\bibliographystylepapers
\bibliographypapers


which are then used as drop in replacements for the usual commands.

Now in your case there are a couple of further problems. We can't use your looping command with \newcites inside, as it creates a group and the new commands only exist inside that group. Instead we can use looping constructs from the etoolbox package. I have done this above by building up a \yearlist and then calling \dolistloop on this list, after having redefined \do to effect what I need.

The second problem is that we can't use numbers as part of the new command names (at lest no easily). The standard LaTeX way around this is to replace the numbers by their roman numeral equivalent. So I call

\newcites{year\romannumeral 2000}{2000}


instead of \newcites{year2000}, etc.

Now when you compile the example file above with latex, files yearmm.aux, yearmmi.aux,... are written. You then run bibtex on each of these in turn, before running latex again.

A final remark, styling of the heading should not really be done inside \refname. See How to change Bibliography heading? for some approaches to this.