# Changing the font of Eprint fields in biblatex

I would like to have Eprint information displayed in my bibliography, but in the same font as the surrounding text. Changing the verbatim font for the document apparently does not accomplish this.

Here is a minimum working example demonstrating the problem. the \verb|text| command within the document appears in \rmfamily as it should, but the arXiv pre-print information in the bibliography still appears in \ttfamily.

\documentclass{article}

\begin{filecontents}{\jobname.bib}
@article{paper,
Author = {Some One},
Title = {Important things},
Journal = {A.~Reput.~J.},
Year = {2000},
Eprint = {1234.5678},
Eprintclass = {fa.KE},
Eprinttype = {arXiv}
}
\end{filecontents}

\usepackage[bibstyle=numeric]{biblatex}
\addbibresource{\jobname.bib}

\makeatletter
\def\verbatim@font{\normalfont\rmfamily}
\makeatother

\begin{document}
One paper is \cite{paper}, and some verbatim text is
\verb|arXiv:1234.5678 [fa.KE]|.

\printbibliography
\end{document}


This results in the following output, with the arXiv reference in the main text appearing in \rmfamily even though it was typeset with the \verb command, but the same text in the bibliography still in \ttfamily:

How can I change the font used to display Eprint records in a biblatex bibliography?

-

## 1 Answer

My first thought was that \urlstyle{same} should be sufficient, but it turned out that a few hardcoded instances of \texttt had to be removed as well.

\documentclass{article}

\usepackage{biblatex}

\usepackage{hyperref}

\makeatletter
\def\verbatim@font{\normalfont\rmfamily}
\makeatother

\urlstyle{same}

\makeatletter
\DeclareFieldFormat{eprint:arxiv}{%
arXiv\addcolon\space
\ifhyperref
{\href{http://arxiv.org/\abx@arxivpath/#1}{%
\nolinkurl{#1}%
\iffieldundef{eprintclass}
{}
%    {\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}}
{\addspace\mkbibbrackets{\thefield{eprintclass}}}}}
{\nolinkurl{#1}
\iffieldundef{eprintclass}
{}
%       {\addspace\texttt{\mkbibbrackets{\thefield{eprintclass}}}}}}
{\addspace\mkbibbrackets{\thefield{eprintclass}}}}}
\makeatother

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@article{paper,
Author = {Some One},
Title = {Important things},
Journal = {A.~Reput.~J.},
Year = {2000},
Eprint = {1234.5678},
Eprintclass = {fa.KE},
Eprinttype = {arXiv}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
One paper is \cite{paper}, and some verbatim text is
\verb|arXiv: 1234.5678 [fa.KE]|.

\printbibliography
\end{document}


-
This works perfectly in the MWE (and in fact the redefinition of the \verbatim@font is no longer needed) but it turns out that if you also use the hyperref package, it stops working and the following error is generated: Undefined control sequence. http://arxiv.org/\abx @arxivpath/1234.5678 \end {document}. Do you know why this would be? –  Michael Underwood Oct 24 '12 at 17:51
@MichaelUnderwood Because I forgot to add \makeatletter/\makeatother. –  lockstep Oct 24 '12 at 18:00
Aah, thank you! That was the first thing I thought of, but I tried putting it inside the \DeclareFieldFormat command and for whatever reason that doesn't solve the problem. –  Michael Underwood Oct 24 '12 at 18:10