2

Following this example to number the entries in the bibliography and this example to have multiple bibliographies, I am able to show two bibliographies with separate counters.

I want to have the same counter for both bibliographies. For that, I thought I can use enumitem like in the MWE below. However, this does not work for some reason. What am I doing wrong? Is there a way to have a single counter for both bibliographies using enumitem or otherwise?

\documentclass{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{Doe2012a,
    author  = {J. Doe},
    title   = {Lorem Ipsum -- Part I},
    journal = {J. Dolor Sit Am.},
    volume  = {1},
    pages   = {1--10},
    month   = {1},
    year    = {2012},
}

@article{Doe2012b,
    author  = {J. Doe},
    title   = {Lorem Ipsum -- Part II},
    journal = {J. Dolor Sit Am.},
    volume  = {2},
    pages   = {11--20},
    month   = {2},
    year    = {2012},
}

@book{Doe,
    author    = {J. Doe},
    title     = {Lorem Ipsum -- Complete Works},
    publisher = {{Dolor S. Amet and Sons}},
    year      = {2011},
}
\end{filecontents}
\usepackage[backend=biber, sorting=nty, style=authoryear]{biblatex}
\usepackage{enumitem}
\addbibresource{\jobname.bib}
\defbibenvironment{bibliography}
  {\begin{enumerate}[resume]
     {}
     {\setlength{\leftmargin}{\bibhang}%
      \setlength{\itemindent}{-\leftmargin}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\end{enumerate}}
  {\item}

\begin{document}
\nocite{*}
\printbibliography[title=Articles, type=article]
\printbibliography[title={Books}, type=book]
\end{document}
Tohiko
  • 1,789
  • 2
    Try [series=bib, resume=bib] rather than just resume, which seems to work. I'm not going to post that as an answer because I don't understand enumitem well enough to be sure it's actually correct or why! – Paul Stanley May 01 '20 at 23:53

1 Answers1

2

The problem with a simple [resume] here is that biblatex bibliography printing introduces additional grouping, so we don't execute something like

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[resume]
  \item Lorem
  \item ipsum
\end{enumerate}

\begin{enumerate}[resume]
  \item dolor
  \item sit
\end{enumerate}

\end{document}

we actually execute

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begingroup
\begin{enumerate}[resume]
  \item Lorem
  \item ipsum
\end{enumerate}
\endgroup

\begingroup
\begin{enumerate}[resume]
  \item dolor
  \item sit
\end{enumerate}
\endgroup

\end{document}

But the [resume] feature is local, so the numbering just restarts.

One way to work around this has been mentioned by Paul Stanley in the comments: use a named resume key.

\documentclass{article}

\usepackage[backend=biber, sorting=nty, style=authoryear]{biblatex}
\usepackage{enumitem}

\defbibenvironment{bibliography}
  {\begin{enumerate}[resume=bib]}
  {\end{enumerate}}
  {\item}

\addbibresource{biblatex-examples.bib}

\begin{document}
\nocite{sigfridsson,worman,geer,cicero,yoon,aksin}
\printbibliography[title=Articles, type=article]
\printbibliography[title={Books}, type=book]
\end{document}

Two consecutively numbered bibliographies.

moewe
  • 175,683