[OS X TeX] disappearing cross-reference

Herbert Schulz herbs at wideopenwest.com
Tue Jun 29 00:32:30 CEST 2021

> On Jun 28, 2021, at 4:08 PM, Murray Eisenberg <murrayeisenberg at gmail.com> wrote:
> A _very_ peculiar thing happens from time to time when running pdflatexmk -- or just running latex 3 times! -- in TeXShop 4.64 (under macOS 11.4) with TeXLive 2021 on a book-length document whose body consists of many subsidiary files: the cross-reference to one particular theorem with a \label disappears (it was there after the 3nd latex run!!) and so the \cref to that label gives a “??” in the output.
> The really peculiar thing is that if I just run typeset twice with the latex engine, everything is OK. It’s only when I then run pdflatexmk (with or without first Trashing all aux files), or after doing 3 consecutive latex runs, that the cross-reference cannot be resolved.  
> To make sure I did not accidentally put some non-printing character in the label when referencing it, I carefully retyped the original \label{…} command and did a copy-and-past of the argument there to the argument of the subsequent \cref.
> This has happened with _different_ theorems’ labels at different times while working on this document!
> In each case, the errant label will have the form “kind:long-label-hyphens-separating” where ‘kind’ might be ’thm”, e.g. The particular label creating the problem at the moment is in:
> 	\begin{theorem}%
> 	\label{thm:sup-metric-bded-cont-complete}
> 	Let $(X, d)$ be a metric space….
> 	\end{theorem}
> and the missing reference after the latex engine runs the third time occurs later in the same inputted source file in:
> 	In other words, in the notation of \cref{thm:sup-metric-bded-cont-complete},
> Here’s the relevant portion of the .aux file after the 2nd latex run:
> \newlabel{thm:sup-metric-bded-cont-complete}{{\M at TitleReference {1.85}{Completeness of sequence and functions spaces}}{200}{}{theorem.1.5.85}{}}
> \newlabel{thm:sup-metric-bded-cont-complete at cref}{{[theorem][85][1]1.85}{[1][200][]200}}
> \@writefile{lla}{\defcounter {refsection}{0}\relax }\@writefile{lla}{\contentsline {chapter}{\numberline {\crtrefnumber{thm:sup-metric-bded-cont-complete}}thm:sup-metric-bded-cont-complete}{200}{theorem.1.5.85}\protected at file@percent }
> The preamble is very complicated but includes this, in case it matters to diagnosing the problem:
> \usepackage[T2A,T1]{fontenc}
> %\usepackage{amsmath}	% avoid \dddot clash
> \usepackage{mathtools}	% avoid unicode-math clash
> \usepackage{amsthm}	% avoid openbox clash
> \usepackage[russian,french,ngerman,polish,english]{babel}
> \RequirePackage[refpage,norefeq,intoc,english,cfg]{nomencl}
> \usepackage[pdfa]{hyperref}
> \hypersetup{
>   unicode,
>   pdfapart=2, pdfaconformance=u,
>   bookmarksnumbered,bookmarksopen=true,bookmarksopenlevel=3,
>   breaklinks=true,
>   colorlinks, citecolor=red, filecolor=defaultcolor, linkcolor=blue, urlcolor=blue,
>   linktocpage=true,linktoc=all,
> }
> \usepackage[user,hyperref]{zref}%{zref-base,zref-user}
>  \zref at newprop*{pagedest}[Doc-Start]{page.\@the at H@page}
>  \zref at addprop{main}{pagedest}
>  \newcommand\hyperpageref[1]{\hyperlink{\zref at extract{#1}{pagedest}}{\pageref*{#1}}}
> %
> \RequirePackage[nameinlink,noabbrev,capitalize]{cleveref}
> %
> \RequirePackage{crossreftools}
> % Fix to crossreftools
> % https://tex.stackexchange.com/a/512175/13492
> \renewcommand{\@@crtextr at ct@ref}[2]{%
>   \expandafter\@@@crtextr at ct@ref\expandafter{\detokenize{#2}}{#1}%
> }
> \newcommand{\@@@crtextr at ct@ref}[2]{%
>   \expandafter\ifx\csname r@#1\endcsname\relax
>   \crt at refundefined%
>   \else
>   \expandafter\expandafter\csname crt at ref@splitter@#2\endcsname\csname r@#1\endcsname%
>   \fi
> }
> I would be happy to provide an archive of the entire book project’s files to anybody who might help in resolving this peculiar cross-reference error.
> ---
> Murray Eisenberg		murrayeisenberg at gmail.com


You say you have multiple files? Do you \include or \input the files? When you clean the aux files do you clean ALL the aux files including the files that are \include'd?

If you can find a way to make the document files available I'm willing to take a look at the problem but can't make a promise to solve your problem.

Good Luck,

Herb Schulz
herbs at wideopenwest.com

----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/TeX/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

More information about the macostex-archives mailing list.