TransWikia.com

New page after defined number of bibliography entries

TeX - LaTeX Asked on December 19, 2020

I am using biblatex with the biber-backend. Is there a possibility, to limit the number of items listed in the bibliography to a given number per page? E.g., I want to have a new page after 10 bibliography items.

Thanks a lot.

One Answer

One simple way of doing this that should work for most setups is the following.

documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}

usepackage[style=numeric, backend=biber]{biblatex}

newcounter{bibitemcount}

renewbibmacro{finentry}{%
  finentry
  ifbibliography
    {stepcounter{bibitemcount}%
     ifnumless{value{bibitemcount}}{10}
       {}
       {newpage
        setcounter{bibitemcount}{0}}}
    {}%
}

addbibresource{biblatex-examples.bib}


begin{document}
nocite{*}
printbibliography
end{document}

It may, however, be a bit nicer to add the code to start a new page in the bibliography environment. That is style dependent, so less portable. The example below is for style=numeric. The original defbibenvironment{bibliography} for that style can be found in numeric.bbx (ll. 20-33 in biblatex v3.15a).

documentclass[british]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}

usepackage[style=numeric, backend=biber]{biblatex}

newcounter{bibitemcount}


defbibenvironment{bibliography}
  {list
     {printtext[labelnumberwidth]{%
        printfield{labelprefix}%
        printfield{labelnumber}}}
     {setlength{labelwidth}{labelnumberwidth}%
      setlength{leftmargin}{labelwidth}%
      setlength{labelsep}{biblabelsep}%
      addtolength{leftmargin}{labelsep}%
      setlength{itemsep}{bibitemsep}%
      setlength{parsep}{bibparsep}}%
      renewcommand*{makelabel}[1]{hss##1}}
  {endlist}
  {stepcounter{bibitemcount}%
      ifnumless{value{bibitemcount}}{11}
        {}
        {newpage
         setcounter{bibitemcount}{0}}%
   item}

addbibresource{biblatex-examples.bib}


begin{document}
nocite{*}
printbibliography
end{document}

Correct answer by moewe on December 19, 2020

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