1

I'm using revtex-4-2 to write my manuscript and want to include clickable links (doi) in my bibliography. If I use the doi package, I get an error (LaTeX Error: Command \doi already defined.) even though the compilation seems ok. How do I fix this? Here is my MWE (adapted from Overleaf template):

\documentclass[prb,floatfix,reprint]{revtex4-2}
\usepackage{doi}

\begin{document}
\preprint{APS/123-QED}

\title{paper title}

\author{Ann Author}
\altaffiliation[Also at ]{Physics Department, XYZ University.}
\author{Second Author} 
\email{[email protected]}
\affiliation{Authors' institution and/or address}
\collaboration{MUSO Collaboration}
\author{Charlie Author}
\homepage{http://www.Second.institution.edu/~Charlie.Author}
\affiliation{Second institution and/or address}
\affiliation{Third institution, the second for Charlie Author}
\author{Delta Author}
\affiliation{Authors' institution and/or address}
\collaboration{CLEO Collaboration}

\begin{abstract}
This is my abstract. This is a useful reference \cite{mylabel}. 
\end{abstract}

\keywords{Suggested keywords}
\maketitle

\bibliography{myref}

\end{document}

and bibtex file

@PREAMBLE{
 "\providecommand{\noopsort}[1]{}" 
 # "\providecommand{\singleletter}[1]{#1}%" 
}

@article{mylabel,
author = "J. Pleschiutschnig and O. Blaschko and W. Reichardt",
title = "Lattice dynamics of lutetium",
journal = "Phys. Rev. B",
volume = "41",
pages = "975",
year = "1990",
doi = "10.1103/PhysRevB.41.975",
}
2
  • 1
    If you remove \usepackage{doi} and insert \usepackage{hyperref} then revtex will insert links to the DOIs, is this sufficient?
    – Dai Bowen
    Feb 3, 2023 at 19:23
  • thanks, it works Feb 3, 2023 at 19:34

1 Answer 1

3

revtex itself has a built-in mechanism for inserting DOIs into bibliographies, as part of that it defines its own \doi macro which conflicts with the \doi macro that the doi package defines, making the two packages incompatible.

As revtex will already add DOI links in the bibliography simply omitting the doi package should be sufficient in most cases.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .