我希望 Eprint 信息显示在我的参考书目中,但字体与周围文本相同。更改verbatim
文档的字体显然无法实现这一点。
下面是一个演示该问题的最小工作示例。\verb|text|
文档中的命令\rmfamily
按应有的方式出现在中,但参考书目中的 arXiv 预印本信息仍然出现在中\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}
\rmfamily
这会产生以下输出,尽管使用该命令排版,但正文中的 arXiv 引用仍会出现在 中,\verb
但参考书目中的相同文本仍然出现在 中\ttfamily
:
如何更改用于显示biblatex
书目中的 Eprint 记录的字体?
答案1
我的第一个想法是这\urlstyle{same}
应该足够了,但事实证明\texttt
还必须删除一些硬编码实例。
\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}