为什么此代码一直给出“请重新运行 LaTeX”(并且参考书目显示不佳)?

为什么此代码一直给出“请重新运行 LaTeX”(并且参考书目显示不佳)?

我已经在 TeXstudio 2.11.0(pdflatex-biber-pdflatex 以及 pdflatex)下甚至在 ShareLaTeX 和 Overleaf 中运行了此代码,但我不明白为什么它一直发出警告:

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

并且显然参考书目构建得不太好。

我已经尝试删除所有辅助文件并重新运行 pdflatex-biber-pdflatex,但错误仍然存​​在。

\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,
breaklinks=false,pdfborder={0 0 0.7},backref=false,colorlinks=false]
{hyperref}

% additional packages
\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}{
    \fancyhead{}
    \renewcommand{\headrulewidth}{0pt}
    \renewcommand{\footrulewidth}{0pt}
    \fancyfoot[OC]{\begin{flushright}\thepage\end{flushright}}
}

% fancy headers for the thesis
\fancyhead{}
\fancyhead[LE]{\slshape \nouppercase \leftmark}
\fancyhead[RO]{\slshape \nouppercase \rightmark}
\fancyfoot[EC]{\begin{flushleft}\thepage\end{flushleft}}
\fancyfoot[OC]{\begin{flushright}\thepage\end{flushright}}
\renewcommand{\headrulewidth}{0.4pt}
\setlength{\headheight}{14pt}

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

% add bibliography database
\addbibresource{biblatex-examples.bib}
\addbibresource{\jobname.bib}

% 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*{\adddot}% DELETED
    % \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace
    \printfield{number}%
    % \setunit{\addcomma\space}%
    \printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}} 

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

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

% shortauthor before author
\renewbibmacro*{begentry}{%
    \ifkeyword{Key}{\sffamily}{}%
    \iffieldundef{shorthand}
    {}
    {\global\undef\bbx@lasthash
        \printfield{shorthand}%
        \addcolon\space}%
    \ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
    {}%
    {\printnames{shortauthor}%
        \addspace\textendash\space}}

\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}}

\addcontentsline{toc}{chapter}{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}}

\addcontentsline{toc}{chapter}{Conclusions}
\markboth{Conclusions}{Conclusions}
conclusions

\cleardoublepage{}\phantomsection

\addcontentsline{toc}{chapter}{Bibliography}
\markboth{Bibliography}{Bibliography}
\printbibliography

\end{document}

第一次运行在参考书目第一页出现此错误:

在此处输入图片描述

第二次运行在参考书目第二页出现了这个错误:

在此处输入图片描述

这两种输出在接下来的运行中永远交替进行。

答案1

恭喜!您遇到了这种情况:每次处理文档时,分页符都会发生变化,这是由于作者姓名的大小与表示重复的规则不同造成的。

解决这个问题的一个简单方法是强制 bib 条目不要跨页面拆分,通过设置\interlinepenalty为 10000 来实现。

我还对文档做了一些修改,特别是hyperref最后加载部分。请仔细研究其中的差异。

\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,
breaklinks=false,pdfborder={0 0 0.7},backref=false,colorlinks=false]
{hyperref}

\doublespacing

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

% fancy headers for the thesis
\fancyhead{}
\fancyhead[LE]{\slshape \nouppercase \leftmark}
\fancyhead[RO]{\slshape \nouppercase \rightmark}
\fancyfoot[EC]{\begin{flushleft}\thepage\end{flushleft}}
\fancyfoot[OC]{\begin{flushright}\thepage\end{flushright}}
\renewcommand{\headrulewidth}{0.4pt}
\setlength{\headheight}{14pt}


% add bibliography database
\addbibresource{biblatex-examples.bib}
\addbibresource{\jobname.bib}

% 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*{\adddot}% DELETED
    % \setunit*{\addnbspace}% NEW (optional); there's also \addnbthinspace
    \printfield{number}%
    % \setunit{\addcomma\space}%
    \printfield{eid}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}} 

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

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

% shortauthor before author
\renewbibmacro*{begentry}{%
    \ifkeyword{Key}{\sffamily}{}%
    \iffieldundef{shorthand}
    {}
    {\global\undef\bbx@lasthash
        \printfield{shorthand}%
        \addcolon\space}%
    \ifboolexpr{test {\usebibmacro{bbx:dashcheck}} or test {\ifnameundef{shortauthor}}}%
    {}%
    {\printnames{shortauthor}%
        \addspace\textendash\space}}


\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}}
\addcontentsline{toc}{chapter}{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}}

\addcontentsline{toc}{chapter}{Conclusions}
\markboth{Conclusions}{Conclusions}
conclusions

\cleardoublepage{}\phantomsection

\addcontentsline{toc}{chapter}{Bibliography}
\markboth{Bibliography}{Bibliography}

\printbibliography

\end{document}

答案2

解决方法:添加

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

\printbibliography

答案3

受到芭芭拉·比顿的启发,并在谷歌上搜索了寡妇和孤儿的信息后,我发现这一页我已经尝试过了:

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

输出是正确的: 参考书目第一页 参考书目第二页

并且由于该代码行不会修改页边距,而只会在需要时修改项目之间的空间,所以我希望如果我在以下页面中发现其他作者的相同情况,它也能起作用。

相关内容