TransWikia.com

Biblatex: article with two printed references section, plus citing after

TeX - LaTeX Asked on July 24, 2021

I have an article which must have two references section. I used biblatex to do that. In order for the numbered references to continue from one section to the next, I enabled the global option defernumbers=true, and used resetnumbers=false for the second reference section.

I also have a third section, with citations that have already appeared in the first or second reference sections. Here’s an MWE:

documentclass{article}

usepackage[defernumbers=true]{biblatex}
usepackage{hyperref}

begin{filecontents*}{mwe.bib}
@misc{paper1,
    author={name1},
    title={title1},
    year={2021}
}

@misc{paper2,
    author={name2},
    title={title2},
    year={2021}
}

@misc{paper3,
    author={name3},
    title={title3},
    year={2021}
}
end{filecontents*}

addbibresource{mwe.bib}

begin{document}

begin{refsection}
section{Section One}
Section one citations: cite{paper1,paper2}
printbibliography
end{refsection}

begin{refsection}
section{Section Two}
Section two citations: cite{paper3}
printbibliography[resetnumbers=false]
end{refsection}

section{Section Three}
Second three citations: cite{paper2}

end{document}

The rendered PDF is shown below:

Article preview

My questions are:

  1. Why the second reference section starts numbering from 1 rather than 3? (Note defernumbers=true and resetnumbers=false, and I cleared every temporary file like .aux and recompiled multiple times.)
  2. How to make the citation in the third section to appear correctly?

Edit: This is what I want to achieve (differences from the above image are depicted in red):

Target output

One Answer

refsections are always kept completely separate and independent from each other (and so is the numbering in each refsection), so there is no official way to not reset the count in a new refsection.

You may want to try refsegments, which are not kept separate.

The following gives the desired result in the MWE but may or may not scale well enough for your actual application.

documentclass{article}

usepackage[defernumbers=true]{biblatex}
usepackage{hyperref}

defbibfilter{notsegmentOne}{not segment=1}

begin{filecontents*}{jobname.bib}
@misc{paper1,
  author = {name1},
  title  = {title1},
  year   = {2021},
}
@misc{paper2,
  author = {name2},
  title  = {title2},
  year   = {2021},
}
@misc{paper3,
  author = {name3},
  title  = {title3},
  year   = {2021},
}
end{filecontents*}
addbibresource{jobname.bib}

begin{document}

section{Section One}
Section one citations: cite{paper1,paper2}
printbibliography[filter=notsegmentOne]

begin{refsegment}
section{Section Two}
Section two citations: cite{paper3}
printbibliography[segment=1]
end{refsegment}

section{Section Three}
Second three citations: cite{paper2}

end{document}

citations 1 and 2 in section 1, 3 in section 2 and then again 2 in section 3

Correct answer by moewe on July 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP