2

The package amsrefs is in conflict with the document class qt2018author (of a journal).
I got the following error: ! LaTeX Error: Command \eprint already defined. I guess the problem comes from the fact that the field \eprint should appear in both.

How to solve this problem without removing amsrefs?


Below is a simple example where the problem appears:

\documentclass{qt2018author}

\usepackage{amsrefs}

\begin{document}

\begin{bibdiv}
\begin{biblist}
\bib{p3}{article}{
   author={Palcoux, Sebastien},
   title={Euler totient of subfactor planar algebras},
   journal={Proc. Am. Math. Soc.}
   volume={146},
   number={11},
   date={2018},
   pages={4775--4786},
   doi={10.1090/proc/14167}
}
\end{biblist}
\end{bibdiv}

\end{document}

Here is the error message:

! LaTeX Error: Command \eprint already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.2820 \newcommand{\eprint}[1]{\url{#1}}
2
  • OK, the class can be downloaded, but we need an example document for the conflict. – egreg Sep 20 '19 at 17:27
  • @egreg: Done! I just added a simple example. – Sebastien Palcoux Sep 21 '19 at 2:54
3

In the qt2018author class the \eprint command only occurs two times, the first time when it is defined and the second time when it is used in the \arXiv command. So you can undefine the command (see for example https://tex.stackexchange.com/a/35967/), redefine it with a different name, and change the call in the \arXiv command. The redefinitions should be performed before you load the amsrefs package.

MWE:

\documentclass{qt2018author}
\let\eprint\undefined
\newcommand*{\eprintnew}[2][arXiv]{%
 \ifstrequal{#1}{arXiv}%
  {\href{http://arxiv.org/abs/#2}{arXiv:#2}}%
  {\mbox{#1:#2}}}
\renewcommand*{\arXiv}[1]{\eprintnew[arXiv]{#1}}

\usepackage{amsrefs}

\begin{document}

\begin{bibdiv}
\begin{biblist}
\bib{p3}{article}{
   author={Palcoux, Sebastien},
   title={Euler totient of subfactor planar algebras},
   journal={Proc. Am. Math. Soc.},
   volume={146},
   number={11},
   date={2018},
   pages={4775--4786},
   doi={10.1090/proc/14167}
}
\end{biblist}
\end{bibdiv}

\end{document}

Result:

enter image description here

Note that in the original code there was a comma missing in line 12, which triggers the warning Package rkeyval Warning: Missing comma on input line 13.

Note also (as explained in the linked question) that when using \let\eprint\undefined, the macro \undefined is not a special LaTeX command, it is just something that does not exist (\let\eprint\foo would also work). This is sufficient to bypass the check for commands being already defined, which causes the error message that you encountered.

2
  • Thanks, it works! Now, what is the point of redefining it (amsrefs will do the job)? – Sebastien Palcoux Sep 21 '19 at 10:21
  • 1
    The point is that the two definitions are different, in amsrefs the definition is just \url{#1} instead of the more complex definition from qt2018author which has two arguments and the special formatting for arXiv. Therefore, if you use two arguments for \eprint or you use the \arXiv command then you need the redefinition. If you don't use that at all then you don't need the redefinition. – Marijn Sep 21 '19 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.