# Line breaks in bibliography with biblatex/biber

I'm having trouble getting biblatex to break lines in a sensible way in the bibliography. Specifically, it seems that the line cannot be broken within the specification of chapter and/or page numbers if the default prefix for pages is empty.

I do not want to disable pagination prefixes globally because it is useful to be able to specify cases where entries' pagination is non-default and should include a prefix e.g. to indicate that this work is cited by section or paragraph, rather than by page.

Mostly, the breaks are fine just because there is no need to break at this point. So the example below is fairly specific and altering it slightly eradicates the problem. In my real bibliography, of course, I can't just change the book title or chapter number to make the lines easier for TeX to break!

MWE:

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

What should I be doing differently to avoid this problem? Specifically, how do I persuade TeX to break the line following the chapter and before the page numbers when this is appropriate?

That is, I take it that the best break probably follows 'Chap. 89,' just before the first page in the page range. But TeX seems unwilling to break the line at this point. If I add a single letter to the book title, TeX breaks the line before 'Chap.' which suggests that it is treating 'Chap. 89, 345--' as a single unit which seems clearly undesirable.

NOTE: A solution has been developed in chat and will be posted here tomorrow. So no need to answer this unless you just relish the challenge!

-

The issue arises because of the way \mkpageprefix is defined. As described in the manual, it inserts \ppspace between the string for 'pp' or similar and the page number/range itself. If you want to disable all prefixing you can do

\DeclareFieldFormat[inbook]{pages}{#1}

but this of course doesn't work if you want to do it selectively. Turning the string into a no-op doesn't work because \ppspace is still inserted, whilst making that breakable of course fails with special cases.

There's currently not an interface to alter the behaviour, that I know of, but we can alter it with a small redefinition:

\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

Here, I've added a test to see if the current type is the standard pages, and to skip the bibstring and space if it is. A complete example

\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},
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,
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}
-
Thank you! Typo: ... it it is -> ... if it is. – cfr Jul 17 at 14:26

The formatting of chapter and page in inbook is controlled by chapter+pages bibmacro. This macro calls \bibpagespunct for the space between the chapter and the pages. By default this is a comma plus an inter word space. A possibility is to change it to encourage a \linebreak. The most drastic solution is to redefine \bibpagespunct to

A less drastic solution is to change the definition only for affected entries. For a single entry this can be done as follows:

\renewbibmacro{begentry}{%
\iffieldequalstr{entrykey}{den-art-coll}
{}%
}

For the example at hand we get:

-
(+1) This is definitely helpful but do you know why TeX will not allow a line break there anyway? That is, why isn't the space enough? Adding \linebreak[1] is certainly better than the status quo but it does, as you say, seem a little drastic. – cfr Aug 12 '14 at 14:17