I've got a custom formatting style for the arXiv eprint field in biblatex (with biber). However, for some citation, this results in the contents running into the margin. For example, the bibliography produced by the MWE attached below will produce the following output (using geometry package to show the page dimensions):
As you can see, the arXiv identifier runs into the margin. It eventually breaks at the second dot while it probably should break at the first hyphen. I've tried replacing the \texttt call in the MWE below to the macro defined in the tex.se question Line break in texttt but that did not work either. The line-break shifted to after the forward slash which still is within the margin. I suspect this has something to do with (token) expansion rules?
After spending way too much time trying to fix this myself when I should really be producing content, I'm turning to tex.SE for help :-) Please find my MWE below.
MWE:
\RequirePackage{filecontents}
\begin{filecontents}{bib.bib}
@article{dummy,
author = {A. Author},
title = {Title},
note = {a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z},
}
@article{2010arXiv1010.0632D,
author = {{D'Agostini}, G.},
title = "{Improved iterative Bayesian unfolding}",
archivePrefix = "arXiv",
eprint = {1010.0632},
primaryClass = "physics.data-an",
year = 2010,
month = 10,
}
\end{filecontents}
\documentclass{scrbook}
\usepackage[showframe]{geometry}
\usepackage[
hyperref=true,
backend=biber,
style=numeric-comp, % Sort and compress
backref=true, % Print Backreferences
backrefstyle=three, % start combining pages after third page
sorting=none, % Do not sort!
firstinits=true, % First and Middle names as initials
maxbibnames=3, % Maximum number of authors to print in Bibliography
]{biblatex}
% Hide certain fields
\AtEveryBibitem{
\clearfield{issn}
\clearfield{month}
\ifentrytype{book}{}{
\clearfield{isbn}
}
}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{title}{\textit{#1}}
\DeclareFieldFormat
{year}{\mkbibbold{#1}}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{month}{\mkbibbold{#1}}
\DeclareFieldFormat
[article,inbook,incollection,inproceedings,patent,thesis,unpublished]
{day}{\mkbibbold{#1}}
\DeclareFieldFormat
{date}{\mkbibbold{#1}}
\renewbibmacro{in:}{%
\ifentrytype{article}{%
}{%
\printtext{\bibstring{in}\intitlepunct}%
}%
}
\makeatletter
\DeclareFieldFormat{eprint:arxiv}{%
{\small\texttt{arXiv}\addcolon}\space%
\href{http://arxiv.org/\abx@arxivpath/#1}{%
\iffieldundef{eprintclass}{}{
\texttt{\thefield{eprintclass}/}%
}\nolinkurl{#1}%
}%
}%
\makeatother
%% links and hyperref
\usepackage{url}
%% hypertexnames=false is required(?) by autonum package but makes
%% pagerefs (e.g. backref etc.) point to the wrong page.
\usepackage[%linktocpage=true,
final,
pdftex,
bookmarks=true,
colorlinks]{hyperref}
\bibliography{bib}
\begin{document}
Test \cite{dummy} \cite{2010arXiv1010.0632D}
\printbibliography
\end{document}

