8

I'm preparing my bibliography and noticed that biblatex-printbibliography produces Overfull \hbox several times.

Examples (gray lines indicates text margins, red line is the physical page margin):

First Example

Third example

Second Example

Why is hyperref line-breaking not working as expected using pdflatex or even latex -> dvipdfm BUT not using latex -> dvips -> ps2pdf?

Also it would be great if someone could point out how I can raise the indentation of the second (and following) lines, as this might look better.

edit: Customized question, as the answer given by lockstep solved the third problem. The second problem seems to be identical to the first.

\documentclass[12pt]{scrbook}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ps2pdf]{hyperref}
%\usepackage[ps2pdf,breaklinks=true]{hyperref} %This doesn't change anything.
%\usepackage{breakurl} %That makes no difference either.

\usepackage[a4paper,twoside,showframe]{geometry} %show text margins

\usepackage[style=alphabetic,backend=biber,maxnames=4,minnames=3,maxbibnames=99]{biblatex}
\bibliography{biblatex-issue}

\begin{document}
\nocite{*}

\printbibliography[heading=subbibliography,type=article,prefixnumbers={A-}]
\printbibliography[heading=subbibliography,type=book,prefixnumbers={B-}]
\printbibliography[heading=subbibliography,type=online]

\end{document}

And the bib-file:

@online{GLS:datasheet,
    title         = "GLS Datasheet",
    organization  = "Optoelectronics Research Centre",
    howpublished ="Website",
    date = "2004-09",
    urldate="2013-07-01",
    url ="http://www.southampton.XXXX",
    address       = "Southampton, United Kingdom"
}
@book {Lifante:Fundamentals,
    title = "Integrated Photonics: Fundamentals",
    author = "Lifante, Ginés",
    publisher = "J.Wiley",
    address = "Chichester",
    year = "2003",
    type = "text",
    isbn = "9780470848685"
}
@article{Labadie:First_fringes,
    author = {Labadie, L. and Mart\'{\i}n, G. and Anheier, N. C. and Arezki, B. and Qiao, H. A. and Bernacki, B. and Kern, P.},
    title = {First fringes with an integrated-optics beam combiner at 10},
    DOI= "10.1051/0004-6361/201116727",
    journal = {A\&A},
    year = 2011,
    volume = 531,
    pages = "A48"
}

P.S.: I noticed that the visiting-date of the GLS-datasheet is wrong ;-)

MrD
  • 2,716
  • It would be great if you could provide a complete MWE. – mafp Apr 08 '13 at 10:15
  • I removed the [tag:boxes] tag because it isn't used for questions about "bad" linebreaks. – lockstep Apr 08 '13 at 10:15
  • I haven't put that flag in..hmm... Added MWE. Problem for the URL disappeared somehow, don't know why. – MrD Apr 08 '13 at 10:27
  • Rather than adding links, please include the .tex and .bib files directly in the question (as code samples). – lockstep Apr 08 '13 at 10:32
  • The first and the second problem can be avoided when removing hyperref (that is not a good solution). Although the third problem (Wiley leaking out of the margin) still remains. – MrD Apr 08 '13 at 10:39
  • I just noted, that the visible DOI-Link is not the actual one, but just a label, and that seems to be the problem: The label of a URL will not break just as any url would do. – MrD Apr 08 '13 at 11:43

2 Answers2

7

I will answer to my own question as I finally found a solution, that might be of interest to all the ones having problems with displaying long URLs in LaTeX and also to show you the effect: I had a little chat with Vilar (the maintainer of the breakurl-package) and he was able to extend the breaking possibilities of his package they way I suggested.

Therefore the new option anythingbreaks in the newest version does the links look good as they keep in range of the textborder.


See for yourself:

Completely without:

without


Standard behavior:

breakurl


Anythingbreaks:

option anythingbreaks


@lockstep: Thanks for your solution regarding the third problem. Really have missed the ~.

Marco Daniel
  • 95,681
MrD
  • 2,716
4

The first and second problem could be solved by removing the ps2pdf package option and running your example in PDF mode (see my picture) -- but that may not be an option for you. With regard to the third problem, an unbreakable space is missing in J.Wiley -- with J.~Wiley, a hyphen will be added after the i and the line break becomes acceptable.

\documentclass[12pt]{scrbook}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{hyperref}

\usepackage[a4paper,twoside,showframe]{geometry}

\usepackage[style=alphabetic,backend=biber,maxnames=4,minnames=3,maxbibnames=99]{biblatex}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@online{GLS:datasheet,
    title         = "GLS Datasheet",
    organization  = "Optoelectronics Research Centre",
    howpublished ="Website",
    date = "2004-09",
    urldate="2013-07-01",
    url ="http://www.southampton.XXXX",
    address       = "Southampton, United Kingdom"
}
@book {Lifante:Fundamentals,
    title = "Integrated Photonics: Fundamentals",
    author = "Lifante, Ginés",
    publisher = "J.~Wiley",
    address = "Chichester",
    year = "2003",
    type = "text",
    isbn = "9780470848685"
}
@article{Labadie:First_fringes,
    author = {Labadie, L. and Mart\'{\i}n, G. and Anheier, N. C. and Arezki, B. and Qiao, H. A. and Bernacki, B. and Kern, P.},
    title = {First fringes with an integrated-optics beam combiner at 10},
    DOI= "10.1051/0004-6361/201116727",
    journal = {A\&A},
    year = 2011,
    volume = 531,
    pages = "A48"
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\printbibliography[heading=subbibliography,type=article,prefixnumbers={A-}]
\printbibliography[heading=subbibliography,type=book,prefixnumbers={B-}]
\printbibliography[heading=subbibliography,type=online]

\end{document}

enter image description here

An alternative is to allow for some "emergency" extra space:

\appto{\bibsetup}{\emergencystretch=1em}

enter image description here

lockstep
  • 250,273
  • The unbreakable space helped solving the third problem, just like you mentioned, but removing the [ps2pdf] changed nothing (so 1st still remains). I can't use pdflatex, as I am heavily operating with pstricks and pdflatex makes that very hard. So I'm always going latex -> dvips -> ps2pdf (of course sometimes I'm using biber after latex). – MrD Apr 08 '13 at 11:01
  • @DL6ER In that case, have a look at http://tex.stackexchange.com/questions/20768/how-to-allow-line-break-in-a-long-hyperlink-in-a-pdf-compiled-by-latex-dvips-ps2 – lockstep Apr 08 '13 at 11:05
  • 1
    Already seen that, but neither using \usepackage[breaklinks=true]{hyperref} nor adding \usepackage{breakurl} after hyperref solves the first problem. – MrD Apr 08 '13 at 11:09
  • @DL6ER Too bad. As I know next to nothing about DVI mode, I suggest you update your question, specifically pointing out the issue my answer didn't solve. That way (and by adding the [tag:dvips] tag), it is more likely to attract a suitable expert. – lockstep Apr 08 '13 at 11:12
  • Really strange: latex + dvipdfm is working as expected, while latex -> dvips -> ps2pdf fails. Hope someone can tell how to fix this. – MrD Apr 08 '13 at 11:29