Editing the bibliography without changing citations in the text

Preparing my manuscript for publication, I need to manually redact the bibliography I generated with `biblatex` (style `authortitle-dw`) and Biber. This is mostly about fixing the line and page breaks (some nasty URLs, making sure that bib items do not break across pages, etc., see pictures below). I cannot make these fixes in the `*.bbl` file since the changes there would also affect the citations in the text. Any ideas how to do that?

-
Do you need the URLs in the bibliography? You can use the option `url=false` to the biblatex package to turn them off altogether. –  qubyte Feb 18 '12 at 11:57
Thanks for tip, I didn't know that one. I need the URLs, though. In fact, you might say that I need to have total control over the typesetting of the bibliography. I have to deliver a camera-ready PDF and for high quality publications you cannot rely on automatically generated line and page breaks. –  Till A. Heilmann Feb 18 '12 at 12:03
Take a look at my answer. There are a number of counters that control the behaviour that you need to alter. –  qubyte Feb 18 '12 at 12:11
what about this discussion on how to get a new line for url, doi and so on: tex.stackexchange.com/questions/29802/… –  pluton Feb 20 '12 at 0:03

To make sure that bibliography items do not break across pages, change the definition of `\bibsetup` so that `\interlinepenalty` is set to 10000 instead of 5000.

``````\patchcmd{\bibsetup}{\interlinepenalty=5000}{\interlinepenalty=10000}{}{}
``````

Here's the original definition from `biblatex.def`:

``````\newcommand*{\bibsetup}{%
\interlinepenalty=5000\relax
\widowpenalty=10000\relax
\clubpenalty=10000\relax
\raggedbottom
\frenchspacing
\biburlsetup}
``````
-
Thanks, that solves part of my problem. Is there a way of allowing bib items to break from an even (left) to an odd (right) page but not the other way around? That's why I said I needed to have total control over the page breaks in an earlier comment, because you really have to decide case by case and usually cannot leave that to an algorithm. –  Till A. Heilmann Feb 18 '12 at 13:26
@TillA.Heilmann None that I know of. –  lockstep Feb 18 '12 at 13:27

I have found that if you want a typographically flawless bibliography there often is no other way than to typeset it by hand. Even the best algorithms for line and page breaking cannot neatly resolve every issue for you. That's why TeX is so kind as to tell us about underfull and overfull boxes. Overfull boxes occur in practically every text and it is the same with bibliographies--only much, much worse because there are so many names in there (always difficult to hyphenate correctly), so many strings in bib items that shouldn't be broken across lines (page numbers, labels, ...) and so many bib items that shouldn't be broken across pages (at least not from an odd to an even page).

For my real-life project I have now taken the approach mentioned in one of my comments: To generate the main text containing the citations and references I use `biblatex` and Biber as usual. For the bibliography, though, I make a copy of the `*.bbl` file, rename it and use it with a separate `*.tex` document to compile a separate PDF that consists only of the bibliography. Now I can make all the necessary modifications to the renamed `*.bbl` file without affecting the main text. At the end, I delete the (flawed) bibliography from the first PDF and insert the fixed one from the second PDF. Another--possibly easier--way would be to compile the bibliography first, copy and paste it from the resulting PDF directly into the `*.tex` source, remove the `\printbibliography` command and tidy up the pasted bibliography text by hand.

This is all very cumbersome and time-consuming but who said making fine books was easy?

To show you the difference between the automatically generated bibliography and the manually optimized one, I have uploaded two PDFs here and here. As you can see, manually editing the `*.bbl` file not only allowed me to optimize line and page breaks but also to do some nice things like dictionary stye headers and emphasized beginnings of new alphabetical letters. Note that there are probably still some minor faults I have to fix...

-
Are you using hyphenation fields, and implementing language strings correctly? This might be considered by some to be a personal preference, but I think there is a good point to be made saying that the bibliographic entry is a sentence set in another language, and should follow its typographic rules. –  ienissei Feb 19 '12 at 8:30
I set the hyphenations fields for all the bib entries, use the `babel=hyphen` option with biblatex and also the `DeclareLanguageMapping` commands (although I don't remember what they do exactly). I do not want to have different labels (for editor, page numbers and so on) in the bibliography, though. Also, this does not address the page breaking which, typographically, is one of the main factors you have to consider. –  Till A. Heilmann Feb 19 '12 at 15:22

I have used

``````\sloppy
\fussy
``````

before to deal with bad line breaks in the bibliography. That sometimes gives very wide spaces between words, but it was good enough for me. YMMV.

-

I can't see if this will work without your bibliography and code, but setting the following counters to a number greater than 0 (but less than 10,000) should allow URLs to break across lines.

``````\setcounter{biburlnumpenalty}{9000}
\setcounter{biburlucpenalty}{9000}
\setcounter{biburllcpenalty}{9000}
``````

The higher the numbers, the less allowed line breaks will be. There are similar counters with similar properties for things other than URLs. See Section 4.10.3 of the biblatex manual.

-
Thanks for the hint. However, I don't see how the lengths and counters discussed in 3.8.3 and 4.10.3 of the biblatex manual would allow me to control the page breaks in the bibliography. Maybe the way to go is to typeset the document for correct appearance of the in-text citations first, keep the generated PDF, then typeset the document with manual changes in the *.bbl to generate a polished bibliography and finally join the "correct" parts of the two PDFs. Cumbersome, but it's the result that counts. –  Till A. Heilmann Feb 18 '12 at 12:25
I'm not sure I understand. Did you try these three lines (with high numbers)? How large are these bibliography entries if page breaks are becoming a real issue? If you want more specific advice on your question, then I recommend posting a picture of the kind of problems you're seeing. –  qubyte Feb 18 '12 at 12:29
Ok, I've uploaded the bibliography to http://tillheilmann.info/bibliography.pdf. Problematic URLs are on pp. 257, 259 and 269. But there are also many problems with other line breaks (pp. 262, 264, 268, 271) and, more critically, with page breaks (pp. 257/8, 259/60, 260/1, 261/2 ...) –  Till A. Heilmann Feb 18 '12 at 12:43
You could really use some formatting in these entries. What style are you using? Just so that isn't only for me, I urge you to take a screen shot of one or two of these isses, crop them and then put the resultant images into the question itself. Sorry, I should have been clearer on this point. –  qubyte Feb 18 '12 at 12:53
@MarkS.Everitt Those are penalties for the linebreaks at specific characters in URLs. So any number between 1 and 9999 will allow linebreaks, but the higher the penalty the less likely a linebreak. Bad linebreaks in URLs can selectively be sorted out by resetting the penalties locally. –  Audrey Feb 18 '12 at 15:46