Open wmoreland opened 5 years ago
It seems that \doitext
is \edef
-expanded when \doi
is typeset.
https://github.com/ho-tex/doi/blob/28dbd16ca59a89fb0cbe49754803338e32d55dc0/doi.sty#L93
That does not work well for \textsc
as it is not expandable. A workaround could be \noexpand
, but it might be worth checking if it possible to get \doitext
in unexpanded form here.
\documentclass[a4paper]{article}
\usepackage{natbib}
\usepackage{hyperref}
\usepackage{doi}
\renewcommand{\doitext}{\noexpand\textsc{doi:}}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{appleby,
author = {Humphrey Appleby},
title = {On the Importance of the Civil Service},
year = {1980},
journal = {Civil Service Journal},
doi = {10.2214/ajr.12.9928},
}
\end{filecontents}
\begin{document}
This is a test \citep{appleby}.
\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}
I'm struggling to make two changes to how the DOI is formatted by this package: 1) change the format of the prefix to use small caps; and 2) change the colour of the hyperlink.
\doitext
command in doi.sty to:\newcommand{\doitext}{\textsc{doi: }}
but when I compile my document I get an error associated with the .bbl file:Missing control sequence inserted. \newblock \doi{10.1002/andp.19053221004}
Does anyone have any suggestions? I've included my MWE file contents below. The doi.sty file is unchanged except for when I tried that one change described above.
Cheers!