Multilingual bibliography out of margin

I am using sources in multiple languages in my BibLaTeX bibliography (in this case French and English). The main language of my document is English.

In this situation, the references in French are spilling out of margins, even though I specified the langid parameter in my bib-file. Hereunder is a screenshot of the behaviour.

It appears that if I set French as the main language of the document, the problem is partly solved: the title displays correctly but the link is still spilling out of margins. This is the reason I think it is linked to the languages of my bibliography entries.

Do you know how to make my bibliography entries stay within margins, keeping English as the main language of my document?

Here are is a MWE:

\documentclass[11pt, a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[frenchb, main=english]{babel}
\usepackage[autostyle=true]{csquotes}
\usepackage[style=numeric, backend=biber, maxbibnames=10, sorting=nyt, autolang=hyphen]{biblatex}
\usepackage[top=2.2cm, bottom=2.5cm, left=2cm, right=2cm]{geometry}

\DeclareFieldFormat{url}{\newline\url{#1}}
\DefineBibliographyStrings{english}{
urlseen = {consulted on},
}

\begin{document}
Let's cite them all: \cite{ITU_climate} and \cite{ITU_2005}.
\printbibliography
\end{document}


And my bib-file:

@online{ITU_climate,
langid      = {french},
author      = {{International Telecommunication Union}},
title       = {Rôle des télécommunications/technologies de l'information et de la communication en ce qui concerne les changements climatiques et la protection de l'environnement},
year        = {2010},
url         = {https://itunews.itu.int/fr/1794-Role-des-telecommunicationstechnologies-de-linformation-et-de-la-communication-en-ce-qui-concerne-les-changements-climatiques-et-la-protection-de-lenv.note.aspx},
urldate     = {2015-21-11}
}
@online{ITU_2005,
langid      = {english},
langidopts  = {variant=british},
author      = {{International Telecommunication Union}},
title       = {Twenty Years of Measuring the Missing Link},
year        = {2005},
month       = {Oct.},
urldate     = {2015-21-11}
}


As far as I can tell, the real issue here is that the hyphenrules environment cannot deal with breaks in words with special characters.

The environment hyphenrules can be used to select only the hyphenation rules to be used (it can be used as command, too). [...] Except for [...] simple uses, hyphenrules is discouraged and otherlanguage* (the starred version) is preferred, as the former does not take into account possible changes in encodings or characters like, say, ’ done by some languages (eg, italian, frenchb, ukraineb).

So the trouble is that l'information and l'environnement do not get hyphenated in hyphenrules.

A first try can be the microtype package. It can help with a lot of trouble, but not with all.

If you use autolang=other or set frenchb as main document language hyphenation works just fine.

Both have additional effects you might want to avoid in which case you could help yourself supplying the correct break points manually

@online{ITU_climate,
langid      = {french},
author      = {{International Telecommunication Union}},
title       = {Rôle des télécommunications/technologies de l'in\-for\-ma\-tion et de la communication en ce qui concerne les changements climatiques et la protection de l'en\-vi\-ron\-ne\-ment},
year        = {2010},
url         = {https://itunews.itu.int/fr/1794-Role-des-telecommunicationstechnologies-de-linformation-et-de-la-communication-en-ce-qui-concerne-les-changements-climatiques-et-la-protection-de-lenv.note.aspx},
urldate     = {2015-21-11},
}


Alternatively, we can define an apostrophe after which breaks in words are still possible

\def\apost{'\nobreak\hspace{0pt}}


and use it instead of '

@online{ITU_climate,
langid      = {french},
author      = {{International Telecommunication Union}},
title       = {Rôle des télécommunications/technologies de l\apost information et de la communication en ce qui concerne les changements climatiques et la protection de l\apost environnement},
year        = {2010},
url         = {https://itunews.itu.int/fr/1794-Role-des-telecommunicationstechnologies-de-linformation-et-de-la-communication-en-ce-qui-concerne-les-changements-climatiques-et-la-protection-de-lenv.note.aspx},
urldate     = {2015-21-11},
}


• Thank you for your answer. The use of autolang=other* did the trick for the title and did not change the overal style of the French reference (as does autolang=other). The use of \sloppy proposed in this thread solved the problem with urls. – hakutakun Nov 24 '15 at 4:32

At last there are two problems in each bibliography: correct hyphenating and breaking of (long) urls.

Because bibliographys are not text to be read like the text in your document, there is no need to use the same justifying in the bibliography and the text.

Using only left justifying in the bibliography has the advantage, that LaTeX is able to break the lines in the bibliography better (without going over the margins) ...

At last you should add package microtype, add option hyphens to package url (better breaking of urls), and use command \raggedright for the bibliography to be left justified.

Complete code (see changes marked with <=================):

\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@online{ITU_climate,
langid      = {french},
author      = {{International Telecommunication Union}},
title       = {Rôle des télécommunications/technologies de l'information et de la communication en ce qui concerne les changements climatiques et la protection de l'environnement},
year        = {2010},
url         = {https://itunews.itu.int/fr/1794-Role-des-telecommunicationstechnologies-de-linformation-et-de-la-communication-en-ce-qui-concerne-les-changements-climatiques-et-la-protection-de-lenv.note.aspx},
urldate     = {2015-21-11},
}
@online{ITU_2005,
langid      = {english},
langidopts  = {variant=british},
author      = {{International Telecommunication Union}},
title       = {Twenty Years of Measuring the Missing Link},
year        = {2005},
month       = {Oct.},
urldate     = {2015-21-11},
}
\end{filecontents*}

\documentclass[11pt, a4paper]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[frenchb, main=english]{babel} % frenchb
\usepackage{microtype} % <==============================================
\usepackage[hyphens]{url} % <===========================================
\usepackage{showframe} % <========================== to show typing area

\usepackage[autostyle=true]{csquotes}
\usepackage[top=2.2cm, bottom=2.5cm, left=2cm, right=2cm]{geometry}
\usepackage[%
style=numeric,
backend=biber,
maxbibnames=10,
sorting=nyt,
autolang=hyphen,
]{biblatex}
\DeclareFieldFormat{url}{\newline\url{#1}}
\DefineBibliographyStrings{english}{%
urlseen = {consulted on},
}

\begin{document}
Let's cite them all: \cite{ITU_climate} and \cite{ITU_2005}.
Let's cite them all, let's cite them all, let's cite them all, let's
cite them all, let's cite them all, let's cite them all, let's cite them
all, let's cite them all, let's cite them all, let's cite them all,
let's cite them all, let's cite them all, let's cite them all, let's
cite them all, let's cite them all, let's cite them all, let's cite them
all.
{\raggedright % <================================== only left justified!
\printbibliography
} % <============================================== ends left justifing!
\end{document}


and the result:

I used package showframe to mark the typing area and margins and package filecontents to include the bib file into the MWE. Read the documentations with texdoc showframe and texdoc filecontents.

• As far as I can tell \usepackage[hyphens]{url} doesn't really do anything in this case. Indeed biblatex's URL setup allows breaks after hyphens (- is a BigBreak by default with biblatex; it is a BigBreak with the url package if the package is loaded with the hyphens option). microtype is a great idea as always, though. – moewe Nov 23 '15 at 21:49