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?

David Purton
  • 25,884
nameless
  • 111

2 Answers2

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}
Janosh
  • 4,042
  • 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 05 '17 at 01: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? – Janosh Sep 05 '17 at 05: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 05 '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. – Janosh Sep 05 '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. – Janosh Sep 05 '17 at 11:16
  • Well, you are probably better at using optional arguments and stringing than I am. But 'click here' is useless when you're distributing hard copy, however elegant it may be from an aesthetic point of view, and all the red boxes look ugly even electronically. Of course, you can change these, but coloured links are also problematic when printing in black-and-white. hyperref and bookmark are great, but they are best used when the benefits outweigh the annoyances, as far as I'm concerned. – cfr Sep 05 '17 at 11:30
  • I suspect hyperlinking is much more common across the STEM disciplines. Possibly you don't read many philosophy papers. – cfr Sep 05 '17 at 11:32
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

David Purton
  • 25,884
  • Spelling doesn't appear to be the OP's strong point .... (Not that I should talk.) – cfr Sep 05 '17 at 01: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 05 '17 at 01: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 05 '17 at 01:46
  • The OP example does not include ᴜʀʟ: (produced by \mkbibacro{URL}\addcolon\space), so I took it out. – David Purton Sep 05 '17 at 01: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 05 '17 at 01:50
  • What I mean is that it isn't obvious why the \url{} isn't there already, as it is default. Without the code, we can't know. But it isn't as if this is handled badly by default and needs the format redeclaration. – cfr Sep 05 '17 at 01:51
  • I think they wanted to get rid of ᴜʀʟ:, but just removed a bit too much... :) – David Purton Sep 05 '17 at 01:52