I created a project on Overleaf which used TeX Live 2021 by default. Now I finished the project and wanted to submit it to arXiv.org which uses TeX Live 2020. This is when I observed the undefined reference warnings appearing. So I went back to Overleaf and selected TeX Live 2020 in the settings for my project and the same warnings appear there (resulting in "??" in the generated pdf). All these warnings disappear when changing back to TeX Live 2021.
I can't make sense of this behavior especially since only a subset of all references are affected. Some still work while others don't. There is no common pattern, it affects all kinds of things, equations, figures, tables, sections. But at the same time, other references to other equations, figures, ... still work. Sometimes the referenced objects are in the same file and sometimes they are in different files.
Things I tried:
- On Overleaf, after changing to TeX Live 2020, I pressed "Recompile from scratch" (multiple times).
- I verified that there are no "weird" characters in my labels (I use only
[a-zA-Z:-]).
MCVE
The following is a minimal reproducible example. I seems that the issue lies with the revtex documentclass together with \include{}, as the problem disappears when I change it to article.
% \documentclass{article} % this works
\documentclass{revtex4-2} % this doesn't work
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\begin{document}
% Copying the content directly here (i.e. not using \include) makes the error disappear.
\include{content}
\end{document}
where content.tex contains:
\section{First section}
Figure~\ref{fig:test}.
\begin{figure}
\includegraphics{example-image-a}
\caption{Test}
\label{fig:test}
\end{figure}
The resulting log is:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2020.9.10) 26 OCT 2022 13:51
entering extended mode
\write18 enabled.
%&-line parsing enabled.
**main.tex
(/compile/main.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-07-17> (/usr/local/texlive/2020/texmf-dist/tex/latex/revtex/revtex4-2.cls
Document Class: revtex4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/revtex/ for documentation)
Copyright (c) 2019 American Physical Society.
mailto:revtex@aps.org
Licensed under the LPPL:
http://www.ctan.org/tex-archive/macros/latex/base/lppl.txt
Arthur Ogawa <arthur_ogawa at sbcglobal dot net>
Based on work by David Carlisle <david at dcarlisle.demon.co.uk>Version (4.2c): Modified by Mark Doyle
.
ltxutil[2019/01/18/14:29:48 4.2c utilities package (portions licensed from W. E. Baxter web at superscript.com)]
LaTeX Info: Redefining \@centercr on input line 315.
Class revtex4-2 Info: Repairing broken LaTeX eqnarray on input line 365.
\eqncolsep=\skip47
Class revtex4-2 Info: Repairing hyperref-unfriendly LaTeX definition of \mpfootnote on input line 440.
Class revtex4-2 Info: Repairing broken LateX \@sect on input line 762.
\intertabularlinepenalty=\count168
\@tbpen=\count169
\@arstrutbox@hline=\box45
Class revtex4-2 Info: Repairing broken LaTeX \@xbitor on input line 1793.
Class revtex4-2 Info: Making \typeout \long on input line 2053.
ltxfront[2019/01/18/14:29:48 4.2c frontmatter package (AO,DPC,MD)]
\c@affil=\count170
\c@collab=\count171
\absbox=\box46
ltxgrid[2019/01/18/14:29:48 4.2c page grid package (portions licensed from W. E. Baxter web at superscript.com)]
\c@linecount=\count172
\output@latex=\toks15
\box@size@1=\box47
\box@size@2=\box48
\@protection@box=\box49
\@topmark@saved=\toks16
\footins@saved=\box50
\footins@recovered=\box51
\column@recovered=\box52
\pagesofar=\box53
\footsofar=\box54
\pagegrid@col=\count173
Class revtex4-2 Warning: Failed to recognize @vspace, @vspacer, @no@pgbk, @newline, and \; no patches applied. Please get a more up-to-date class, .
\c@part=\count174
\c@section=\count175
\c@subsection=\count176
\c@subsubsection=\count177
\c@paragraph=\count178
\c@subparagraph=\count179
\abovecaptionskip=\skip48
\belowcaptionskip=\skip49
\c@figure=\count180
\fbox@1=\box55
\c@table=\count181
\fbox@2=\box56
\c@video=\count182
\fbox@4=\box57
@bibdataout=\write3
\widetext@top=\box58
\widetext@bot=\box59
Class revtex4-2 Warning: No Society specified, using default society aps.
(/usr/local/texlive/2020/texmf-dist/tex/latex/revtex/aps4-2.rtx
File: aps4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/revtex/ for documentation)
Class revtex4-2 Info: RevTeX society APS selected on input line 37.
)
Class revtex4-2 Warning: No journal specified, using default pra.
Class revtex4-2 Info: APS journal PRA selected on input line 7584.
Class revtex4-2 Warning: No type size specified, using default 10.
(/usr/local/texlive/2020/texmf-dist/tex/latex/revtex/aps10pt4-2.rtx
File: aps10pt4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/revtex/ for documentation)
Class revtex4-2 Info: RevTeX pointsize 10pt selected on input line 36.
) (/usr/local/texlive/2020/texmf-dist/tex/latex/textcase/textcase.sty
Package: textcase 2019/09/14 v1.00 Text only upper/lower case changing (DPC)
) (/usr/local/texlive/2020/texmf-dist/tex/latex/url/url.sty
\Urlmuskip=\muskip16
Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc.
) (/usr/local/texlive/2020/texmf-dist/tex/latex/natbib/natbib.sty
Package: natbib 2010/09/13 8.31b (PWD, AO)
\bibhang=\skip50
\bibsep=\skip51
LaTeX Info: Redefining \cite on input line 694.
\c@NAT@ctr=\count183
)
Class revtex4-2 Info: Repairing natbib's \BibitemShut on input line 7588.
(/usr/local/texlive/2020/texmf-dist/tex/latex/revtex/revsymb4-2.sty
Package: revsymb4-2 2019/01/18/14:29:48 4.2c (https://journals.aps.org/revtex/ for documentation)
LaTeX Info: Redefining \REV@mathfrak on input line 125.
)) (/usr/local/texlive/2020/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2018/08/11 v1.3c Input encoding file
\inpenc@prehook=\toks17
\inpenc@posthook=\toks18
) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2019/11/30 v1.2a Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks19
) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2019/11/30 v1.4a Standard LaTeX Graphics (DPC,SPQR)
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
) (/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 105.
(/usr/local/texlive/2020/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
))
\Gin@req@height=\dimen134
\Gin@req@width=\dimen135
)
Class revtex4-2 Info: Unrecognized LaTeX tabular. Please update this document class! (Proceeding with fingers crossed.) on input line 6.
Class revtex4-2 Info: cite was not loaded (OK!) on input line 6.
Class revtex4-2 Info: mcite was not loaded (OK!) on input line 6.
Class revtex4-2 Info: multicol was not loaded (OK!) on input line 6.
(/usr/local/texlive/2020/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
File: l3backend-pdfmode.def 2020-06-29 L3 backend support: PDF mode
\l__kernel_color_stack_int=\count184
\l__pdf_internal_box=\box60
) (/compile/output.aux (/compile/content.aux))
\openout1 = `output.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info: ... okay on input line 6.
(/usr/local/texlive/2020/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count185
\scratchdimen=\dimen136
\scratchbox=\box61
\nofMPsegments=\count186
\nofMParguments=\count187
\everyMPshowfont=\toks20
\MPscratchCnt=\count188
\MPscratchDim=\dimen137
\MPnumerator=\count189
\makeMPintoPDFobject=\count190
\everyMPtoPDFconversion=\toks21
) (/usr/local/texlive/2020/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for .eps' on input line 485. (/usr/local/texlive/2020/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Live )) \openout3 =outputNotes.bib'.
\openout2 = `content.aux'.
(/compile/content.tex
LaTeX Warning: Reference `fig:test' on page 1 undefined on input line 3.
<example-image-a.pdf, id=1, 321.2pt x 240.9pt>
File: example-image-a.pdf Graphic file (type pdf)
<use example-image-a.pdf>
Package pdftex.def Info: example-image-a.pdf used on input line 6.
(pdftex.def) Requested size: 321.19922pt x 240.8994pt.
) (/compile/output.bbl) [1{/usr/local/texlive/2020/texmf-var/fonts/map/pdftex/updmap/pdftex.map}
@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Test}}{1}{}}
\newlabel{fig:test}{{1}{1}{}{}{}}
@writefile{toc}{\contentsline {section}{\numberline {I}First section}{1}{}}
</usr/local/texlive/2020/texmf-dist/tex/latex/mwe/example-image-a.pdf>] (/compile/output.aux (/compile/content.aux))
LaTeX Warning: There were undefined references.
)
Here is how much of TeX's memory you used:
3184 strings out of 480906
43678 string characters out of 5908280
290135 words of memory out of 5000000
18790 multiletter control sequences out of 15000+600000
536003 words of font info for 32 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
36i,5n,33p,214b,264s stack positions out of 5000i,500n,10000p,200000b,80000s
</usr/local/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/local/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx9.pfb></usr/local/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/local/texlive/2020/texmf-dist/fonts/type1/public/amsfonts/cm/cmr9.pfb></usr/local/texlive/2020/texmf-dist/fonts/type1/public/lm/lmss17.pfb>
Output written on /compile/output.pdf (1 page, 50713 bytes).
PDF statistics:
32 PDF objects out of 1000 (max. 8388607)
22 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
6 words of extra memory for PDF output out of 10000 (max. 10000000)
tab:experiment:tunes(among others) despite a corresponding label being created a few lines later (as can be seen from the log). – a_guest Oct 26 '22 at 12:33\ref{}not finding a corresponding\label{}(despite the label being defined). So it doesn't seem to be related to the bibliography. – a_guest Oct 26 '22 at 12:48revtex4-2documentclass in conjunction with\include{}. When I change the documentclass toarticle, it works, and it also works when I copy the content from the other file directly in the main file (rather than using\include). – a_guest Oct 26 '22 at 13:59\newpageat the end of content.tex. – Teepeemm Oct 26 '22 at 14:09