1

I have a large project that uses the RevTeX documentclass. Sections are incorporated using \include{}. The problem is that labels are not correctly resolved (Reference `xxx' on page 1 undefined). A strange aspect of the issue is that many (most?) references work, but some do not.

Here is a minimum working example

 %\documentclass[12pt]{article}
 \documentclass[12pt]{revtex4-1}
 \newcommand{\be}{\begin{eqnarray}}
 \newcommand{\ee}{\end{eqnarray}}
 \begin{document}
 Eq. \ref{test2}
 \be
 \label{test2}
 1+1=2
 \ee
 \include{eos}
 Eq. \ref{test3}
 \be
 \label{test3}
 1+1=2
 \ee
 \end{document}

where eos.tex is

Eq. \ref{test}
\be
\label{test}
1+1=2
\ee

The label in eos.tex is not resolved. The other labels are. The problem can be fixed by replacing \include{} by \input{}, or by not using RevTeX.

Is this a known incompatibility? Or some kind of intended behavior?

Thomas
  • 111
  • RevTeX does redefine a lot of kernel code: I never investigated the reason but the issue already popped out on this site (see e.g. https://tex.stackexchange.com/q/357821/82917). Anyway, given that \include starts a new page and is thought more for \chapters (which don't exist in revtex) I'd say that using \input is better. You can always include a manual \clearpage if you want. – campa Jun 10 '21 at 13:50
  • unrelated to the question I think but eqnarray is deprecated it is better to use align from amsmath but if you do use it the there must be two & per row one either side of the relation. – David Carlisle Jun 10 '21 at 13:54
  • @campa Thanks. I posted, in part, because I spent many hours yesterday night to reduce the problem to a MWE, and then figure out that \input{} solves the issue. I'm hoping to spare others some of the pain. – Thomas Jun 10 '21 at 13:57
  • I can't reproduce the issue. However, \include always adds \clearpage at the beginning and end, and it's unlikely you really want it. – egreg Jun 10 '21 at 16:32
  • @egreg Interesting. I first encountered the issue in overleaf, and thought it might be an overleaf problem, but my own TeX distribution (TexLive/Ubuntu) exhibits the same behavior. – Thomas Jun 10 '21 at 18:04
  • @egreg Strange, I can. I've tested it also with revtex4-2. – campa Jun 10 '21 at 20:48
  • @campa OK, I get the issue with TL 2019 and 2020, but not with TL 2021 – egreg Jun 10 '21 at 21:19
  • @egreg Er, sometimes I forget that I run TL2017... Interestingly, I can reproduce the problem by using the latest revtex4-2 with LaTeX2e <2017-04-15>. Do you have any idea what change might have fixed the issue? – campa Jun 12 '21 at 13:58

0 Answers0