4

I know that biblatex offers various options to tune the breaking of URLs in the bibliography, but in the following example nothing seems to work:

    \begin{filecontents}{\jobname.bib}
    @book{Voigt.A:1906a,
        Address = {Leipzig},
        Author = {Voigt, Andreas},
        Publisher = {Göschen'sche Verlagshandlung},
        Subtitle = {Dreihundert Vorträge},
        Title = {Die Sozialen Utopien},
        Url = {http://www.archive.org/details/diesozialenutop00voiggoog},
        Urldate = {2011-10-29},
        Year = {1906}
    }
    }
    \end{filecontents}
    \documentclass[fontsize=12pt,paper=a4,]{scrartcl}
    \usepackage[utf8]{inputenc}
    \usepackage[ngerman]{babel}
    \usepackage{biblatex}
    \addbibresource{\jobname.bib}
    \setcounter{biburlnumpenalty}{10000}
    \setcounter{biburllcpenalty}{10000}
    \setcounter{biburlucpenalty}{10000}
    \begin{document}
    \cite{Voigt.A:1906a}
    \printbibliography
    \end{document}

I set all the relevant counters to their maximum, but this doesn't influence the result. Interesting detail: when I set fontsize to 13, it breaks the URL.

4
  • 2
    But where should it break the url. It is not allowed to break it at diesozialenutop00voiggoog, if you add \sloppy before \printbibliography you'll see that it can break it, at the cost of stretching.
    – daleif
    Sep 1, 2015 at 9:03
  • I definitely would prefer it to break after details than the current result. In my original document, the bibliography is printed raggedright anyway.
    – Simifilm
    Sep 1, 2015 at 9:07
  • 2
    You should not change your question in a way that invalidates current and correct answers. You should instead open a new question, linked to this one, with the different setup. I rolled back to the previous question. Anyway, your setting of \bibsetup is wrong as it doesn't include \biburlsetup like the original \bibsetup command; doing \appto\bibsetup{\RaggedRight} seems better.
    – egreg
    Sep 1, 2015 at 9:34
  • Your MWE does not even compile after your recent edit. Please do not change the question again. You have already gotten a work-around for your problem in the comments. If you want other people to benefit from that, ask a new question with the appropriate explanation, so it can be found by searching. I will roll back your edit again.
    – moewe
    Sep 1, 2015 at 14:07

1 Answer 1

6

A penalty of 10000 forbids breaks. Set the penalties to smaller values:

\documentclass[fontsize=12pt,paper=a4,]{scrartcl}
    \usepackage[utf8]{inputenc}
    \usepackage[ngerman]{babel}
    \usepackage{biblatex}
    \addbibresource{bib.bib}
    \setcounter{biburlnumpenalty}{100}
    \setcounter{biburllcpenalty}{100}
    \setcounter{biburlucpenalty}{100}
    \begin{document}
    \cite{Voigt.A:1906a}
    \printbibliography
    \end{document}

enter image description here

4
  • O man, that was really stupid of me. Thanks a lot.
    – Simifilm
    Sep 1, 2015 at 9:10
  • Mmh, not so easy after all. While this works in the MWE, I use \renewcommand{\bibsetup}{\RaggedRight} in my original document. RaggedRight seems to turn this off completely. While I understand that ragged text should be more tolerant about breaking lines, this behavior doesn't seem optimal.
    – Simifilm
    Sep 1, 2015 at 9:23
  • I updated the example.
    – Simifilm
    Sep 1, 2015 at 9:27
  • 1
    You removed \biburlsetup, use \renewcommand{\bibsetup}{\biburlsetup\RaggedRight}, or better \appto{\bibsetup}{\RaggedRight} Sep 1, 2015 at 9:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .