0

I just built a bibliography with biblatex and have the problem, that some urls in the bib are getting beyond the borders, so they are like too long or I don't know.

enter image description here This is an example of what I mean, so you see, that for example the last 2 have the exact same borders (which should be obvious, of course), but the 3rd one has a url in it, that goes far above, and thats the same for some others.

How can I achieve, that this is not the case anymore, and there are linebreaks then?

  • 1
    Please provide a minimal working example, so that other's can reproduce your problem and easily test possible solutions. – Casimir Sep 4 '17 at 11:49
  • 1
    See Heiko Oberdiek's answer to a similar question on this site. – Bernard Sep 4 '17 at 11:50
  • 2
    biblatex should handle this fine without doing anything special. Is the url in the url field of your bib entry? And is the format of the url field: \DeclareFieldFormat{url}{\url{#1}} (if you've modified it)? – David Purton Sep 4 '17 at 12:15
  • 'Beyond bonders', you say? Well, I never! – cfr Sep 5 '17 at 1:39
3

Try loading the url package and better yet combine it with the hyperref package. It might help to set the hyphens option, since by default, the url package does not consider hyphens as legal break points. (Quoted from this answer.)

\usepackage[hyphens]{url}
\usepackage{hyperref}
  • 1
    Why 'better yet'? Not if you don't need hyperlinks as you're producing hard copy, say. Then it just adds complications to no purpose. – cfr Sep 5 '17 at 1:41
  • I think hyperlinks are always a good thing to add. How often do you produce documents that are only intended for hardcopy these days? And what kind of complications do you expect to encounter anyway? – Casimir Sep 5 '17 at 5:15
  • Almost all my documents avoid hyperlinks in order to avoid complications. The exceptions are Beamer presentations. Most of the rest is intended as hardcopy or for paper-like electronic distribution. I've never seen a hyperlinked paper published in my field, for example, so anything intended for journal submission needs to not have them and most of my course materials are distributed as hard copy, so I don't want them in most teaching stuff either. hyperref introduces complications in terms of what's allowed in what. – cfr Sep 5 '17 at 11:05
  • @cfr "I've never seen a hyperlinked paper published in my field,..." That's interesting. May I ask what field that is? I come from high-energy physics where it's the norm. For instance, APS uses hyperlinks for author emails, equation, figure and section references, tocs, urls, etc. in all of their publications, i.e. Physical Review A, B, C, D and Letters. – Casimir Sep 5 '17 at 11:13
  • @cfr "hyperref introduces complications in terms of what's allowed in what." Can't remember the last time I've had problems with it and I've been using it for years in everything ranging from published articles and reviews to notes and documentation. It worked flawlessly in every setting and does a great of job of helping the reader focus on reading rather than hunting down references. Also, you don't have to write out long ugly URL. A simple "click here" does the trick. – Casimir Sep 5 '17 at 11:16
0

This question still really needs a MWE to be absolutely sure what is going on, but here at least is an example that gives the output you want.

I have used the addendum field for Interview mit Daniel Grieder, CEO von Tommy Hilfiger because this is the only suitable field that will be printed after the url field in the standard styles.

Note: You have spelt Hilfiger wrong in your screenshot.

\documentclass{article}
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{Pittroff2015,
  author = {Pittroff, Uschka and Grieder, Daniel},
  date = {2015},
  url = {http://www.manager-magazin.de/lifestyle/mode/mode-tommy-hilfiger-stellt-auf-digitalen-showroom-um-a-1014348.html},
  addendum = {Interview mit Daniel Grieder, CEO von Tommy Hilfiger}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\pagestyle{empty}
\urlstyle{same}
\DeclareFieldFormat{url}{\url{#1}}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

  • Spelling doesn't appear to be the OP's strong point .... (Not that I should talk.) – cfr Sep 5 '17 at 1:41
  • If you're using Biblatex, redeclaring the field format to cope with URLs is rather pointless, isn't it? URLs are handled out-of-the-box, whether active or not. You may need to adjust where URLs are allowed to break, but / and - are default, aren't they? – cfr Sep 5 '17 at 1:44
  • The default is \DeclareFieldFormat{url}{\mkbibacro{URL}\addcolon\space\url{#1}} so your redeclaration will just mess up the format. (Unless, of course, you want to remove the formatting.) Something else is going on the OP's code, which we don't, of course, have any way of finding. – cfr Sep 5 '17 at 1:46
  • The OP example does not include ᴜʀʟ: (produced by \mkbibacro{URL}\addcolon\space), so I took it out. – David Purton Sep 5 '17 at 1:49
  • 1
    @cfr, yes something else is going on. I suspect the OP has DeclareFieldFormat{url}{#1} which removes the possibility for the url to be broken. – David Purton Sep 5 '17 at 1:50

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.