Defining an environment which includes a bibliography

Consider an environment which is intended to house a variety of content related to an author. Content may include name, affiliation, a paragraph which is a short biography, as well as, a series of select publications. Then consider a document which is intended to summarize a set of authors and accordingly, multiple instances of the author environment'.

My initial attempt at solving the problem involved several files.

1. A .cls file in which the author description environment is described.
2. A .tex file which is the author summary, the environment is called here
3. Some number of .tex files in which author attributes are defined
4. Some number of .bib files in which author publications are defined

The .cls file appears as:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{authou}[2015/11/11 an author description]
\RequirePackage[numbers]{natbib}
\RequirePackage{cite}
\bibliographystyle{plainnat}
% define an author description environment
\newenvironment{author_description}[2]{%
\input{#1}%
\begin{center}%
\textbf{Name}: \authorname\\%
\textbf{Affiliation}: \authoraffiliation\\%
\nocite{*}%
\bibliography{#2}%
\end{center}%
}%
{%
% environment end definition
\newpage%
}%
\AtBeginDocument{%
}%
\AtEndDocument{%
}%


The author summary document as:

\NeedsTeXFormat{LaTeX2e}
\documentclass{author}
\begin{document}
\begin{author_description}%
{author.tex}%
{author}%
\end{author_description}%
\begin{author_description}%
{anotherauthor.tex}%
{anotherauthor}%
\end{author_description}%
\end{document}


Author attributes are stored in a file with:

\newcommand\authorname{Author}
\newcommand\authoraffiliation{The author's most relevant affiliation}


And the standard .bib file looks like:

@ARTICLE{Author2015b,
author={Author},
journal={Journal},
title={The author's most recent work},
year={2015},
volume={40},
number={3},
pages={683-700},
doi={},
ISSN={},
month={July},}

@ARTICLE{Author2015a,
author={Author},
journal={Journal},
title={The author's second most recent work},
year={2015},
volume={12},
number={1},
pages={56-74},
doi={},
ISSN={},
month={May},}


Let me point out that the author attribute file and corresponding .bib files are both named with the author name, or author and anotherauthor in this case.

On compilation, there is an obvious error (see attachments). The .bib entries associated with the first instance of the author description environment appear in all subsequent instances.

When I first discovered this, I immediately turned my attention to multibib, however, upon looking into it a little deeper, it would appear that multibib does not lend itself to this problem.

So the question is: How do I define an environment which includes a bibliography (takes the .bib file name as an argument) and allow an indefinite number of bibliographies to be displayed within a single document?

• Switch to Biblatex. Then it is easy. Is that an option? – cfr Nov 14 '15 at 2:57
• Did you figure out the MikTeX update? – cfr Nov 17 '15 at 1:34

One possibility using Biblatex/Biber and refsection. Note that you don't need an environment with two arguments - one is enough. You only need an environment (rather than a command) at all if you want to add stuff between beginning and end. That's not in your example, but I assume you do want it.

\begin{filecontents}{author.tex}
\renewcommand\authorname{Author}
\renewcommand\authoraffiliation{The author's most relevant affiliation}
\end{filecontents}
\begin{filecontents}{author.bib}
@ARTICLE{Author2015b,
author={Author},
journal={Journal},
title={The author's most recent work},
year={2015},
volume={40},
number={3},
pages={683-700},
doi={},
ISSN={},
month={July},}

@ARTICLE{Author2015a,
author={Author},
journal={Journal},
title={The author's second most recent work},
year={2015},
volume={12},
number={1},
pages={56-74},
doi={},
ISSN={},
month={May},}
\end{filecontents}
\begin{filecontents}{otherauthor.tex}
\renewcommand\authorname{Other Author}
\renewcommand\authoraffiliation{The otherauthor's most relevant affiliation}
\end{filecontents}
\begin{filecontents}{otherauthor.bib}
@ARTICLE{OtherAuthor2015b,
otherauthor={Other Author},
journal={Journal},
title={The otherauthor's most recent work},
year={2015},
volume={40},
number={3},
pages={683-700},
doi={},
ISSN={},
month={July},}

@ARTICLE{OtherAuthor2015a,
otherauthor={Other Author},
journal={Journal},
title={The otherauthor's second most recent work},
year={2015},
volume={12},
number={1},
pages={56-74},
doi={},
ISSN={},
month={May},}
\end{filecontents}

\documentclass{article}
\usepackage[backend=biber]{biblatex}
\newcommand\authorname{}
\newcommand\authoraffiliation{}
\newenvironment{author_description}[1]{%
\begin{refsection}[#1.bib]
\input{#1}%
\begin{center}
\textbf{Name}: \authorname\\%
\textbf{Affiliation}: \authoraffiliation\\%
\nocite{*}%
\printbibliography
\end{center}
}{% environment end definition
\end{refsection}%
\newpage}
\begin{document}
\begin{author_description}{author}
here is some stuff about Author
\end{author_description}
\begin{author_description}{otherauthor}
here is some stuff about Other Author
\end{author_description}
\end{document}


• Perhaps some minor tweaking is required. The above solution compiles, however, the references do not appear. My system is MikTeX 2.9, using Texworks GUI on W7 64-bit if at all relevant. I'm compiling with pdfLaTeX + BibTeX. – John Chris Nov 15 '15 at 17:19
• @JohnChris You need to use pdflatex -> biber -> pdflatex for the code I posted. The references don't show up because you haven't run Biber. You can try replacing backend=biber with backend=bibtex but some of Biblatex's functionality depends on Biber and won't work with BibTeX as the backend. You also need at least one additional run of pdflatex in this case: pdflatex -> bibtex <filename> for each .aux Biblatex warns about -> pdflatex -> pdflatex. The biggest downside would be running bibtex once per author. With Biber that's not needed as it uses only a single file. – cfr Nov 15 '15 at 19:38
• Obviously, you can script this and loop through the various .aux files. But it is still much more of a pain than using Biber. Unless you only have a handful of authors, I would strongly recommend using Biber with the solution I posted. – cfr Nov 15 '15 at 19:41
• I found this (tex.stackexchange.com/questions/63308/dummies-guide-to-biber) post useful. I installed biber from here (biblatex-biber.sourceforge.net) and added biber as a Processing Tool by doing Edit -> Preferences -> Typsetting -> Add in TeXworks, noting that there is one argument to be added which is \$basename` – John Chris Nov 15 '15 at 19:54
• @JohnChris Why? You should use the version of Biber provided by MikTeX, along with the version of Biblatex it provides. This way it is all handled and updated automatically rather than manually. You shouldn't need to install anything by hand. – cfr Nov 15 '15 at 19:56