Why does this code keep giving "Please rerun LaTeX" (and the bibliography doesn't show well)?

2,842

Solution 1

Congratulations! You have incurred in a case when a page break changes each time the document is processed, caused by the difference in size between the author name and the rule for denoting the repetition.

A simple way for solving the issue is forcing the bib entries not to be split across pages, which is done by setting \interlinepenalty to 10000.

I made also some changes to the document, in particular for loading hyperref last. Please, study carefully the differences.

\begin{filecontents}{\jobname.bib}
@manual{baselcore,
title={Core {P}rinciples for {E}ffective {B}anking {S}upervision},
author={{Basel Committee on Banking Supervision}},
year={2012},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs230.pdf}
}
@manual{baselhistory,
title={A brief history of the {B}asel {C}ommittee},
author={{Basel Committee on Banking Supervision}},
year={2014},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/bcbs/history.pdf}
}
@manual{baselI1988,
title={International convergence of capital measurement and capital standards},
author={{Basel Committee on Banking Supervision}},
year={1988},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs04a.pdf}
}
@manual{baselI1996market,
title={{Amendment to the Capital Accord to incorporate market risks}},
author={{Basel Committee on Banking Supervision}},
year={1996},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs24.pdf}
}
@manual{baselI1996mktoverview,
title={Overview of the amendment to the capital accord to incorporate market risks},
author={{Basel Committee on Banking Supervision}},
year={1996},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs23.pdf}
}
@manual{baselI1998,
title={{International convergence of capital measurement and capital standards (July 1988, UPDATED TO April 1998)}},
author={{Basel Committee on Banking Supervision}},
year={1998},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs111.pdf}
}
@manual{baselI1998market,
title={{Amendment to the Capital Accord to incorporate market risks (January 1996, updated to April 1998)}},
author={{Basel Committee on Banking Supervision}},
year={1998},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbsc222.pdf}
}
@manual{baselII2001overview,
title={Overview of the New Basel Capital Accord},
author={{Basel Committee on Banking Supervision}},
year={2001},
shortauthor = {BCBS},
sortname = {BCBS},
journal={Consultative document BCBS, Basel, Switzerland},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbsca02.pdf}
}
@manual{baselII2004,
title={International convergence of capital measurement and capital standards: a revised framework},
author={{Basel Committee on Banking Supervision}},
year={2004},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs107.pdf}
}
@manual{baselII2005,
title={{The Application of Basel II to Trading Activities and the Treatment of Double Default Effects}},
author={{Basel Committee on Banking Supervision}},
year={2004},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs107.pdf}
}
@manual{baselII2006,
title={{International Convergence of Capital Measurement and Capital Standards. A Revised Framework. Comprehensive Version}},
author={{Basel Committee on Banking Supervision}},
year={2006},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs128.pdf}
}
@manual{baselIIh2009enhancements,
title={{Enhancements to the Basel II framework}},
author={{Basel Committee on Banking Supervision}},
year={2009},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs157.pdf}
}
\end{filecontents}

\documentclass[11pt,openright]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[british]{babel}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3.5cm,lmargin=4cm,rmargin=3cm,marginparwidth=70pt}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{prettyref}
\usepackage{textcomp}
\usepackage{setspace}
\usepackage{indentfirst}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage[normalem]{ulem}
\usepackage[table, fixpdftex]{xcolor}
\usepackage{algpseudocode}
\usepackage{bigstrut}
\usepackage{enumitem}

% biblatex
\usepackage[style=authoryear-icomp, natbib=true, maxcitenames=2, maxbibnames=11, backend=biber, hyperref=true, pagetracker=page]{biblatex} \usepackage{csquotes}
\renewcommand*{\bibsetup}{%
\interlinepenalty=10000\relax % default is 5000
\widowpenalty=10000\relax
\clubpenalty=10000\relax
\raggedbottom
\frenchspacing
\biburlsetup}

% package hyperref
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}

\doublespacing

% fixes the page number of the first page of each chapter
\fancypagestyle{plain}{
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[OC]{\begin{flushright}\thepage\end{flushright}}
}

% fancy headers for the thesis
\fancyfoot[EC]{\begin{flushleft}\thepage\end{flushleft}}
\fancyfoot[OC]{\begin{flushright}\thepage\end{flushright}}

% add bibliography database

% space between biblio items
\setlength\bibitemsep{1.7\itemsep}

% title without ""
\DeclareFieldFormat[inbook]{title}{#1}
% non-italic
\DeclareFieldFormat[online]{title}{#1}
% title unquoted
\DeclareFieldFormat[article]{title}{#1}
% no pp.
\DeclareFieldFormat[article]{pages}{#1}
% bold volume
\DeclareFieldFormat*{volume}{\mkbibbold{#1}\setpunctfont{\textbf}}

% no in:
\renewbibmacro{in:}{}

% (volume)
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
% \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace
\printfield{number}%
\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

% edition.
\DeclareFieldFormat{edition}%
{(\ifinteger{#1}%
{#1\isdot}).}

% publisher and location position
\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\printlist{location}%
\usebibmacro{date}%
\newunit}

% shortauthor before author
\renewbibmacro*{begentry}{%
\ifkeyword{Key}{\sffamily}{}%
\iffieldundef{shorthand}
{}
{\global\undef\[email protected]
\printfield{shorthand}%
\ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
{}%
{\printnames{shortauthor}%

\begin{document}

\frontmatter
\pagenumbering{Alph} % avoid the problem with page anchors
\pagestyle{empty}
\newgeometry{margin=3cm}title-page\restoregeometry

\cleardoublepage

\begin{flushright}
dedication
\end{flushright}

\cleardoublepage
\pagenumbering{roman}

\pagestyle{fancy}

\tableofcontents

\mainmatter
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}

\chapter*{Introduction\label{chap:introduction}}
\markboth{Introduction}{Introduction}

introduction

\cite{aristotle:rhetoric}
\cite{aristotle:anima}
\cite{baselcore}
\cite{baselhistory}
\cite{baselI1988}
\cite{baselI1996market}
\cite{baselI1998}
\cite{baselI1998market}
\cite{baselII2001overview}
\cite{baselII2006}
\cite{baselIIh2009enhancements}

\chapter*{Conclusions\label{chap:conclusion}}

\markboth{Conclusions}{Conclusions}
conclusions

\cleardoublepage{}\phantomsection

\markboth{Bibliography}{Bibliography}

\printbibliography

\end{document}


Solution 2

\newgeometry{tmargin=2.8cm,bmargin=3.5cm,lmargin=4cm,rmargin=3cm}


before \printbibliography.

Solution 3

Inspired by barbara beeton and googling around about widows and orphans, I've found this page and I've tried:

\setlength\bibitemsep{1.7\itemsep plus 1pt minus 1pt}


The output is correct:

and since that code line doesn't modify the page margins but only the space between items if needed, I hope it'll work also if I find the same situation for some other authors in the following pages.

Share:
2,842
Author by

CarLaTeX

Updated on August 24, 2020

• CarLaTeX almost 2 years

I've run this code under TeXstudio 2.11.0 (pdflatex-biber-pdflatex and also again pdflatex) and even in ShareLaTeX and Overleaf, but I don't understand why it keeps giving the warning:

Package biblatex Warning: Please rerun LaTeX.
(biblatex)                Page breaks have changed.


and obviously the bibliography isn't built well.

I have already tried to delete all the auxiliary files and re-run pdflatex-biber-pdflatex but the error remains.

\documentclass[11pt,openright]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=3cm,bmargin=3.5cm,lmargin=4cm,rmargin=3cm,marginparwidth=70pt}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{prettyref}
\usepackage{textcomp}
\usepackage{setspace}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}

@manual{baselcore,
title={Core {P}rinciples for {E}ffective {B}anking {S}upervision},
author={{Basel Committee on Banking Supervision}},
year={2012},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs230.pdf}
}
@manual{baselhistory,
title={A brief history of the {B}asel {C}ommittee},
author={{Basel Committee on Banking Supervision}},
year={2014},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/bcbs/history.pdf}
}
@manual{baselI1988,
title={International convergence of capital measurement and capital standards},
author={{Basel Committee on Banking Supervision}},
year={1988},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs04a.pdf}
}
@manual{baselI1996market,
title={{Amendment to the Capital Accord to incorporate market risks}},
author={{Basel Committee on Banking Supervision}},
year={1996},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs24.pdf}
}
@manual{baselI1996mktoverview,
title={Overview of the amendment to the capital accord to incorporate market risks},
author={{Basel Committee on Banking Supervision}},
year={1996},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs23.pdf}
}
@manual{baselI1998,
title={{International convergence of capital measurement and capital standards (July 1988, UPDATED TO April 1998)}},
author={{Basel Committee on Banking Supervision}},
year={1998},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs111.pdf}
}
@manual{baselI1998market,
title={{Amendment to the Capital Accord to incorporate market risks (January 1996, updated to April 1998)}},
author={{Basel Committee on Banking Supervision}},
year={1998},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbsc222.pdf}
}
@manual{baselII2001overview,
title={Overview of the New Basel Capital Accord},
author={{Basel Committee on Banking Supervision}},
year={2001},
shortauthor = {BCBS},
sortname = {BCBS},
journal={Consultative document BCBS, Basel, Switzerland},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbsca02.pdf}
}
@manual{baselII2004,
title={International convergence of capital measurement and capital standards: a revised framework},
author={{Basel Committee on Banking Supervision}},
year={2004},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs107.pdf}
}
@manual{baselII2005,
title={{The Application of Basel II to Trading Activities and the Treatment of Double Default Effects}},
author={{Basel Committee on Banking Supervision}},
year={2004},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs107.pdf}
}
@manual{baselII2006,
title={{International Convergence of Capital Measurement and Capital Standards. A Revised Framework. Comprehensive Version}},
author={{Basel Committee on Banking Supervision}},
year={2006},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs128.pdf}
}
@manual{baselIIh2009enhancements,
title={{Enhancements to the Basel II framework}},
author={{Basel Committee on Banking Supervision}},
year={2009},
shortauthor = {BCBS},
sortname = {BCBS},
publisher={Bank for International Settlements},
url={http://www.bis.org/publ/bcbs157.pdf}
}

\end{filecontents}

\doublespacing

\makeatletter

% package hyperref
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}

\usepackage{setspace}
\usepackage{indentfirst}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage[normalem]{ulem}
\usepackage[table, fixpdftex]{xcolor}
\usepackage{algpseudocode}
\usepackage{bigstrut}
\usepackage{enumitem}

% fixes the page number of the first page of each chapter
\fancypagestyle{plain}{
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[OC]{\begin{flushright}\thepage\end{flushright}}
}

% fancy headers for the thesis
\fancyfoot[EC]{\begin{flushleft}\thepage\end{flushleft}}
\fancyfoot[OC]{\begin{flushright}\thepage\end{flushright}}

% biblatex
\usepackage[style=authoryear-icomp, natbib=true, maxcitenames=2, maxbibnames=11, backend=biber, hyperref=true, pagetracker=page]{biblatex} \usepackage{csquotes}

% add bibliography database

% space between biblio items
\setlength\bibitemsep{1.7\itemsep}

% title without ""
\DeclareFieldFormat[inbook]{title}{#1}
% non-italic
\DeclareFieldFormat[online]{title}{#1}
% title unquoted
\DeclareFieldFormat[article]{title}{#1}
% no pp.
\DeclareFieldFormat[article]{pages}{#1}
% bold volume
\DeclareFieldFormat*{volume}{\mkbibbold{#1}\setpunctfont{\textbf}}

% no in:
\renewbibmacro{in:}{}

% (volume)
\renewbibmacro*{volume+number+eid}{%
\printfield{volume}%
% \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace
\printfield{number}%
\printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

% edition.
\DeclareFieldFormat{edition}%
{(\ifinteger{#1}%
{#1\isdot}).}

% publisher and location position
\renewbibmacro*{publisher+location+date}{%
\printlist{publisher}%
\printlist{location}%
\usebibmacro{date}%
\newunit}

% shortauthor before author
\renewbibmacro*{begentry}{%
\ifkeyword{Key}{\sffamily}{}%
\iffieldundef{shorthand}
{}
{\global\undef\[email protected]
\printfield{shorthand}%
\ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
{}%
{\printnames{shortauthor}%

\makeatother

\usepackage[british]{babel}

\begin{document}

\frontmatter
\pagestyle{empty}
\newgeometry{margin=3cm}title-page\restoregeometry

\cleardoublepage{}

\begin{flushright}
dedication
\par\end{flushright}

\cleardoublepage{}\pagenumbering{roman}
\setcounter{page}{1}
\pagestyle{fancy}\tableofcontents{}\cleardoublepage{}\mainmatter
\renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter.\ #1}{}}
\newpage
\chapter*{Introduction\label{chap:introduction}}

\markboth{Introduction}{Introduction}
introduction
\cite{aristotle:rhetoric}
\cite{aristotle:anima}
\cite{baselcore}
\cite{baselhistory}
\cite{baselI1988}
\cite{baselI1996market}
\cite{baselI1998}
\cite{baselI1998market}
\cite{baselII2001overview}
\cite{baselII2006}
\cite{baselIIh2009enhancements}

\chapter*{Conclusions\label{chap:conclusion}}

\markboth{Conclusions}{Conclusions}
conclusions

\cleardoublepage{}\phantomsection

\markboth{Bibliography}{Bibliography}
\printbibliography

\end{document}


The first run gives this error in the first page of the bibliography:

The second run gives this error in the second page of the bibliography:

This two kinds of output alternate in the following runs forever.

• Johannes_B almost 6 years
Can you add the blg file?
• Johannes_B almost 6 years
Where do you want the page numbers to be?
• Johannes_B almost 6 years
\setlength\bibitemsep{1.7\itemsep} this is a recursion. \itemsep is set to bibitemsep.
• David Carlisle almost 6 years
@Johannes_B it may be confusing but it's not recursion in the way \def\foo{\foo} is, it does not loop, \setlength\itemsep{2\itemsep} is a perfectly reasonable way to double itemsep
• CarLaTeX almost 6 years
@Johannes_B \setlength\bibitemsep{1.7\itemsep} does not loop, I have used it till now without problems. If I comment it the mwe works but I would like to have some space between the bibitems. I'm at work now and I don't have TeXstudio, I'll post the blg file tonight, thank you!
• David Carlisle almost 6 years
what I think is the problem is that the BCBS ­ Basel Committee on Banking Supervision (2006).  entry either fits at the bottom of page 5 or not depending if it use BCBS or --- as the first field, but if it fits it uses --- next time but then it goes pver the page so next time it decides to use BCBS and so loops forever...
• CarLaTeX almost 6 years
@DavidCarlisle Exact! That's the problem! But I don't know how to solve it :'(
• David Carlisle almost 6 years
nor me:-) (no time now, but I leave th comment as a hint
• CarLaTeX almost 6 years
@DavidCarlisle If you do not know how to solve it, it must be a big problem!
• barbara beeton almost 6 years
you might try using \enlargethispage on the first page of the bibliography, and set the value so that it either allows the problem bib item (identified by @DavidCarlisle) to either fit completely on that page, or is forced to move completely to the next page. (this probably needs to be added at the last minute to the .bbl file.) alternatively, you might increase or decrease the setting of \bibitemsep by just enough to force a similar choice of page break.
• CarLaTeX almost 6 years
@barbarabeeton Thank you, I have tried some values with \enlargethispage but it doesn't seem to work. Modifing the setting of \bibitemsep of course works, hoping not to find the same situation for some other authors in the following pages.
• barbara beeton almost 6 years
another possibility is to make 2-line and 3-line bib entries unbreakable by setting \widowpenalty=10000 \clubpenalty=10000. (a 4-or-more-line entry is breakable by definition.) you can find the current value with \showthe\widowpenalty etc. just before the bibliography; this will halt the job to report, but it's the easiest way to find out the status, and is easily removed once you know the value. this may well leave you with a short page and an underfull vbox message, but that's better than the current pathological situation.
• moewe almost 6 years
David Carlisle's analysis of the problem is correct. The problem is known (github.com/plk/biblatex/issues/273) and can occur from time to time. Unfortunately there is really no good solution to make sure it doesn't happen. (You could turn the dashed feature off.) Normally solutions will be of an ad-hoc nature and try to avoid the problem by moving the items a bit so the page break doesn't collide with them in such an unfortunate manner.
• CarLaTeX almost 6 years
@Johannes_B I didn't add the blg file because it is not a loop during the run.
• CarLaTeX almost 6 years
It is good but I think that if I had other dashed authors between, for example, the 3rd and 4th page of the bibliography, it may not work...
• Bernard almost 6 years
You'd have to find the l.c.m. of the modifications of top margin, or something like that :-J Hopefully, you'll have only a very small number of such problems.
• CarLaTeX almost 6 years
I hope not to be the one in a million! :) Thank you!
• CarLaTeX almost 6 years
Thank you for your elegant (as always) solution! I will carefully study all the differences. I didn't know you could put \begin{filecontents} ... \end{filecontents} without loading \usepackage{filecontents}. I'll wait a couple of days before accepting your answer, even if it is difficult to do better.
• egreg almost 6 years
@CarLaTeX With the package the file is rewritten at each run of LaTeX (and an existing file is silently overwritten)