[OS X TeX] disappearing cross-reference

Murray Eisenberg murrayeisenberg at gmail.com
Mon Jun 28 23:08:59 CEST 2021


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
Mobile (413)-427-5334
503 King Farm Blvd #101		
Rockville, MD 20850-6667	





-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/macostex-archives/attachments/20210628/36c87a41/attachment.html>
-------------- next part --------------
----------- 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
                https://email.esm.psu.edu/pipermail/macosx-tex/
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.