我无法biblatex
以合理的方式在参考书目中换行。具体来说,如果页面的默认前缀为空,则似乎无法在章节和/或页码的规范内换行。
我不想全局禁用分页前缀,因为能够指定条目分页非默认的情况并且应包含前缀(例如)以表明该作品是按章节或段落引用的,而不是按页面引用的,这很有用。
大多数情况下,断行是可以的,因为此时不需要断行。因此,下面的示例相当具体,稍微修改一下就可以解决问题。当然,在我的实际参考书目中,我不能只更改书名或章节号,让 TeX 更容易断行!
梅威瑟:
\documentclass[11pt,a4paper]{article}
\usepackage{geometry}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{new-stuff,
author = {Watt, Brian},
title = {Happy Times with Penguins},
publisher = {Harvard University Press},
address = {Cambridge, MA},
year = 1995,
pagination = {section}}
@inbook{den-art-coll,
crossref = {den-coll},
title = {Personal Chips and Getting Oneself Good},
pages = {345--564},
chapter = 89}
@inbook{harvey-art-coll,
crossref = {old-stuff},
title = {Personal Chips and Getting Oneself Good},
pages = {345--564},
chapter = 89}
@suppbook{den-coll-intro,
crossref = {den-coll},
title = {Introduction},
pages = {1--9}}
@book{den-coll,
author = {Till, Jr., Dennis E.},
booktitle = {Penguin Land and Further North: Human Influence},
title = {Penguin Land and Further North: Human Influence},
publisher = {Oxford University Press},
year = 2008,
address = {Oxford and New York}}
@book{old-stuff,
author = {Harvey, Jr., Dennis E.},
booktitle = {Penguin Land and Further North: Human Influence},
title = {Penguin Land and Further North: Human Influence},
publisher = {Someone \& Daughters},
year = 1567,
address = {Oxford},
bookpagination = {paragraph}}
\end{filecontents}
\usepackage[citestyle=authoryear-comp,bibstyle=authoryear,mergedate=basic,isbn=false,url=false,eprint=false,dashed=true,doi=false,sortcites=true,backend=biber,mincrossrefs=6]{biblatex}
\DefineBibliographyStrings{english}{
page = {},
pages = {},
}
\bibliography{\jobname}
\begin{document}
\autocite{den-art-coll, den-coll-intro, harvey-art-coll}
\textcite[1--3]{new-stuff}
\printbibliography
\end{document}
我应该采取哪些不同的措施来避免这个问题?具体来说,在适当的情况下,如何说服 TeX 在章节之后和页码之前断行?
也就是说,我认为最佳换行可能位于“第 89 章”之后,就在页码范围的第一页之前。但 TeX 似乎不愿意在此时换行。如果我在书名中添加一个字母,TeX 会在“第 89 章”之前换行,这表明它将“第 89 章,345--”视为一个单元,这显然是不可取的。
注意:聊天中已经开发出解决方案,明天将在此发布。所以除非您喜欢挑战,否则无需回答此问题!
答案1
问题是由于\mkpageprefix
定义的方式而产生的。如手册中所述,它会\ppspace
在“pp”或类似的字符串和页码/范围本身之间插入。如果您想禁用所有前缀,您可以这样做
\DeclareFieldFormat[inbook]{pages}{#1}
但如果你想有选择地这样做,这当然行不通。将字符串变成无操作是行不通的,因为\ppspace
仍然插入,而使其成为可破坏的当然会在特殊情况下失败。
据我所知,目前没有可以改变行为的界面,但我们可以通过小小的重新定义来改变它:
\makeatletter
\protected\long\def\blx@mkpageprefix#1[#2]#3{%
\ifstrequal{#1}{page}
{}
{\ifnumeral{#3}
{\bibstring{#1}\ppspace}
{\ifnumerals{#3}
{\bibstring{#1s}\ppspace}
{\def\pno{\bibstring{#1}}%
\def\ppno{\bibstring{#1s}}}}}%
\blx@mkpageprefix@i[#2]{#3}}
\makeatletter
这里我添加了一个测试来判断当前类型是否是标准的pages
,如果是的话就跳过字符串和空格。一个完整的例子
\documentclass[11pt,a4paper]{article}
\usepackage{geometry}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{new-stuff,
author = {Watt, Brian},
title = {Happy Times with Penguins},
publisher = {Harvard University Press},
address = {Cambridge, MA},
year = 1995,
pagination = {section}}
@inbook{den-art-coll,
crossref = {den-coll},
title = {Personal Chips and Getting Oneself Good},
pages = {345--564},
chapter = 89}
@inbook{harvey-art-coll,
crossref = {old-stuff},
title = {Personal Chips and Getting Oneself Good},
pages = {345--564},
chapter = 89}
@suppbook{den-coll-intro,
crossref = {den-coll},
title = {Introduction},
pages = {1--9}}
@book{den-coll,
author = {Till, Jr., Dennis E.},
booktitle = {Penguin Land and Further North: Human Influence},
title = {Penguin Land and Further North: Human Influence},
publisher = {Oxford University Press},
year = 2008,
address = {Oxford and New York}}
@book{old-stuff,
author = {Harvey, Jr., Dennis E.},
booktitle = {Penguin Land and Further North: Human Influence},
title = {Penguin Land and Further North: Human Influence},
publisher = {Someone \& Daughters},
year = 1567,
address = {Oxford},
bookpagination = {paragraph}}
\end{filecontents}
\usepackage[citestyle=authoryear-comp,bibstyle=authoryear,mergedate=basic,isbn=false,url=false,eprint=false,dashed=true,doi=false,sortcites=true,backend=biber,mincrossrefs=6]{biblatex}
\makeatletter
\protected\long\def\blx@mkpageprefix#1[#2]#3{%
\ifstrequal{#1}{page}
{}
{\ifnumeral{#3}
{\bibstring{#1}\ppspace}
{\ifnumerals{#3}
{\bibstring{#1s}\ppspace}
{\def\pno{\bibstring{#1}}%
\def\ppno{\bibstring{#1s}}}}}%
\blx@mkpageprefix@i[#2]{#3}}
\makeatother
\bibliography{\jobname}
\begin{document}
\autocite{den-art-coll, den-coll-intro, harvey-art-coll}
\textcite[1--3]{new-stuff}
\printbibliography
\end{document}
答案2
章节和页面的格式inbook
由 bibmacro 控制chapter+pages
。此宏要求\bibpagespunct
章节和页面之间的空格。默认情况下,这是一个逗号加上一个单词间空格。一种可能性是将其更改为鼓励\linebreak
。最彻底的解决方案是重新定义\bibpagespunct
为
\renewcommand{\bibpagespunct}{\addcomma\linebreak[1]\addspace}
一个不太激进的解决方案是只更改受影响条目的定义。对于单个条目,可以按如下方式执行:
\renewbibmacro{begentry}{%
\iffieldequalstr{entrykey}{den-art-coll}
{\renewcommand{\bibpagespunct}{\addcomma\linebreak\addspace}}
{}%
}
对于手头的例子,我们得到: