% !TeX program = xelatex
\usepackage[left=3cm, right=3cm, bottom=3cm, top=3cm]{geometry}


    author = {{testauthor test author testauthor}},
    year= {2018},
    title = {{testfile test file testfile}},
    url = {http://abcdefghijklmnopqrstuvwxy.com/phrrFK5dS1ztTjiaCmveRARXpGBtV01U%20B93FcrxkOVhj2CceIguNuUPpwDaUD4GjTTWh9cL30D6rLgWxapYlhegDXQGFlE0hao7B2YS227ca%20keoWHWNmQVKVcNOUFxfsCp0SwCElfTVtpMv6DKqiSwhWgO2zrHvstd4UNBo99UQBSCTkzL7lD2UyRLTRy6xXdJ}

Here the URL does not break properly due to the fontspec package changing the parindent. How can I fix this?


This makes the URL look extremely ugly with the first line not even justified. It is just this one weird character extending into the border. I do not want to use any weird workarounds like using the url package and changing the bibliography when BibLaTeX supports URLs natively with Biber.

  • 1
    Young Un Thank you for helping keep things into the QA structure in the other question. It definitely works better this way. If I may, I have another suggestion. How about you use in your question the actual URL that's giving you trouble? If you provide us with an arbitrarily long made up URL, the only general solution may be to use something of the kind of \sloppy. But usually real URL are less badly behaved (even if nasty enough!), so the real case might get you a better solution. – gusbrs Dec 16 '18 at 18:29
  • You could also use \setcounter{biburlnumpenalty}{9900} (or some other value), to also allow breakpoints after numbers. – Skillmon Dec 16 '18 at 18:33
  • Thanks for staying with me! Actually the real url is of a similar length and also composed of a similar length of random characters (or base64 strings) after the tld. This is what confuses me. The url is literally a string of random characters and latex decides not to break at one random point that is at the end of the regular line but instead after the next character. I tried setting biburlnumpenalty, it did not have an impact either. – pomeloy Dec 16 '18 at 18:36
  • Mmh, In this case, let's see what folks have to say. – gusbrs Dec 16 '18 at 18:39
  • 2
    As to your comment "I do not want to use any weird workarounds like using the url package and changing the bibliography when biblatex supports urls natively with biber." Actually biblatex loads the url package and it is url that provides biblatex's support for urls. So, you might as well use its options, if they do get things better. – gusbrs Dec 16 '18 at 18:47

You could insert a bit stretchable space:

\usepackage[left=3cm, right=3cm, bottom=3cm, top=3cm]{geometry}


  \Urlmuskip=0mu plus 3mu\relax
    {\def\do##1{\appto\UrlSpecials{\do##1{\mathchar`##1 \mskip 0mu plus 1mu\penalty\value{biburlnumpenalty}}}}%
    {\def\do##1{\appto\UrlSpecials{\do##1{\mathchar`##1 \mskip 0mu plus 1mu\penalty\value{biburlucpenalty}}}}%
    {\def\do##1{\appto\UrlSpecials{\do##1{\mathchar`##1 \mskip 0mu plus 1mu\penalty\value{biburllcpenalty}}}}%



enter image description here

  • +1 I played with this definition quite a lot, to no avail. But why does placing the glue inside \UrlSpecials differs from setting a larger glue in \Urlmuskip? – gusbrs Dec 16 '18 at 20:36
  • 1
    \Urlmuskip has an effect only at the dot and the slash. It doesn't affect the problematic line. – Ulrike Fischer Dec 16 '18 at 20:39
  • Ah! so that's why I had to go up to 10mu just to get a lousy result... – gusbrs Dec 16 '18 at 20:41



enter image description here

  • Tried, did not work at all. The url now overshoots the page by about 10 cm. – pomeloy Dec 16 '18 at 19:25
  • see edited answer – user2478 Dec 16 '18 at 19:51
  • Is using a whole different mono font the only way to fix one single linebreak? – pomeloy Dec 16 '18 at 19:52
  • this font is only an example! – user2478 Dec 16 '18 at 19:54
  • 1
    I'm sorry, I can not follow. Your example literally changes the font and my problem is about an url not breaking the way I want it to. – pomeloy Dec 16 '18 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.