(Another) problem with url hyphenation in bibliography
What I am about to ask has already been asked many times, but nothing seems to work for me so far. Basically I am having troubles in getting urls hyphenated correctly in the bibliography.
I modified the command \UrlBreaks so that it allows hyphenation everywhere, but this seems to be ignored in the bibliography, while in the rest of the document it does work.
Here is a MWE:
% !TEX encoding = UTF-8
% !TEX program = xelatex
\documentclass[12pt,english,a4paper]{article}%
\usepackage[backend=bibtex,defernumbers=true,sorting=nty]{biblatex}%
\usepackage[breaklinks,plainpages=false]{hyperref}%
\def\UrlBreaks{\do\/\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:}
\addbibresource{Biblio.bib}
\begin{document}
See \cite{citation} for further details or visit \url{http://www.joifewoirjecpwoirjcpewrijcpenwrjcpnewrjicpnwerjincpejricpejripcne.com}.
\printbibliography
\end{document}
and the references are in the file Biblio.bib as follows
@book{citation,
author = {Doe, John},
title = {The Book},
url = {http://www.joifewoirjecpwoirjcpewrijcpenwrjcpnewrjicpnwerjincpejricpejripcne.com}
}
Compiling with xelatex (or pdflatex) and bibtex results in the following output:
A curiosity (hope it helps in finding the bug): the image above is what comes out compiling with xelatex; compiling with pdflatex gives the same output, except for the cyan countour line of the link which, ironically, gets hyphenated:
Using \sloppy does something better, but still doesn't make the links hyphenate where I want, i.e. anywhere:
As you may imagine, \raggedright doesn't solve the issue either.
What I am looking for is some code that allows a good hyphenation of the urls in the bibliography with these constraints (I don't know if they are relevant):
it has to work with xelatex and bibtex (backend=biber option to biblatex doesn't work for me somehow)
package polyglossia must not be required, rather it has to work with babel
compatible with package hyperref
compatible with book document class
What I am about to ask has already been asked many times, but nothing seems to work for me so far. Basically I am having troubles in getting urls hyphenated correctly in the bibliography.
I modified the command \UrlBreaks so that it allows hyphenation everywhere, but this seems to be ignored in the bibliography, while in the rest of the document it does work.
Here is a MWE:
% !TEX encoding = UTF-8
% !TEX program = xelatex
\documentclass[12pt,english,a4paper]{article}%
\usepackage[backend=bibtex,defernumbers=true,sorting=nty]{biblatex}%
\usepackage[breaklinks,plainpages=false]{hyperref}%
\def\UrlBreaks{\do\/\do\a\do\b\do\c\do\d\do\e\do\f\do\g\do\h\do\i\do\j\do\k\do\l\do\m\do\n\do\o\do\p\do\q\do\r\do\s\do\t\do\u\do\v\do\w\do\x\do\y\do\z\do\A\do\B\do\C\do\D\do\E\do\F\do\G\do\H\do\I\do\J\do\K\do\L\do\M\do\N\do\O\do\P\do\Q\do\R\do\S\do\T\do\U\do\V\do\W\do\X\do\Y\do\Z\do0\do1\do2\do3\do4\do5\do6\do7\do8\do9\do=\do/\do.\do:}
\addbibresource{Biblio.bib}
\begin{document}
See \cite{citation} for further details or visit \url{http://www.joifewoirjecpwoirjcpewrijcpenwrjcpnewrjicpnwerjincpejricpejripcne.com}.
\printbibliography
\end{document}
and the references are in the file Biblio.bib as follows
@book{citation,
author = {Doe, John},
title = {The Book},
url = {http://www.joifewoirjecpwoirjcpewrijcpenwrjcpnewrjicpnwerjincpejricpejripcne.com}
}
Compiling with xelatex (or pdflatex) and bibtex results in the following output:
A curiosity (hope it helps in finding the bug): the image above is what comes out compiling with xelatex; compiling with pdflatex gives the same output, except for the cyan countour line of the link which, ironically, gets hyphenated:
Using \sloppy does something better, but still doesn't make the links hyphenate where I want, i.e. anywhere:
As you may imagine, \raggedright doesn't solve the issue either.
What I am looking for is some code that allows a good hyphenation of the urls in the bibliography with these constraints (I don't know if they are relevant):
it has to work with xelatex and bibtex (backend=biber option to biblatex doesn't work for me somehow)
package polyglossia must not be required, rather it has to work with babel
compatible with package hyperref
compatible with book document class
No comments:
Post a Comment