<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">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.<div class=""><br class=""></div><div class="">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.  </div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">This has happened with _different_ theorems’ labels at different times while working on this document!</div><div class=""><br class=""></div><div class="">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:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>\begin{theorem}%</font></div><div class=""><font face="Courier" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>\label{thm:sup-metric-bded-cont-complete}</font></div><div class=""><font face="Courier" class=""><span class="Apple-tab-span" style="white-space:pre">    </span></font></div><div class=""><font face="Courier" class=""><span class="Apple-tab-span" style="white-space:pre">     </span>Let $(X, d)$ be a metric space….</font></div></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>\end{theorem}</font></div><div class=""><br class=""></div><div class="">and the missing reference after the latex engine runs the third time occurs later in the same inputted source file in:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class=""><span class="Apple-tab-span" style="white-space:pre">    </span>In other words, in the notation of \cref{thm:sup-metric-bded-cont-complete},</font></div></div><div class=""><br class=""></div><div class="">Here’s the relevant portion of the .aux file after the 2nd latex run:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">\newlabel{thm:sup-metric-bded-cont-complete}{{\M@TitleReference {1.85}{Completeness of sequence and functions spaces}}{200}{}{theorem.1.5.85}{}}</font></div><div class=""><font face="Courier" class="">\newlabel{thm:sup-metric-bded-cont-complete@cref}{{[theorem][85][1]1.85}{[1][200][]200}}</font></div><div class=""><font face="Courier" class="">\@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@file@percent }</font></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">The preamble is very complicated but includes this, in case it matters to diagnosing the problem:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Courier" class="">\usepackage[T2A,T1]{fontenc}</font></div><div class=""><font face="Courier" class="">%\usepackage{amsmath}<span class="Apple-tab-span" style="white-space:pre">      </span>% avoid \dddot clash</font></div><div class=""><font face="Courier" class="">\usepackage{mathtools}<span class="Apple-tab-span" style="white-space:pre">   </span>% avoid unicode-math clash</font></div><div class=""><font face="Courier" class="">\usepackage{amsthm}<span class="Apple-tab-span" style="white-space:pre">        </span>% avoid openbox clash</font></div></div><div class=""><font face="Courier" class="">\usepackage[russian,french,ngerman,polish,english]{babel}</font></div><div class=""><font face="Courier" class=""><br class=""></font></div><div class=""><font face="Courier" class="">\RequirePackage[refpage,norefeq,intoc,english,cfg]{nomencl}</font></div><div class=""><div class=""><font face="Courier" class="">\usepackage[pdfa]{hyperref}</font></div><div class=""><font face="Courier" class="">\hypersetup{</font></div><div class=""><font face="Courier" class="">  unicode,</font></div><div class=""><font face="Courier" class="">  pdfapart=2, pdfaconformance=u,</font></div><div class=""><font face="Courier" class="">  bookmarksnumbered,bookmarksopen=true,bookmarksopenlevel=3,</font></div><div class=""><font face="Courier" class="">  breaklinks=true,</font></div><div class=""><font face="Courier" class="">  colorlinks, citecolor=red, filecolor=defaultcolor, linkcolor=blue, urlcolor=blue,</font></div><div class=""><font face="Courier" class="">  linktocpage=true,linktoc=all,</font></div><div class=""><font face="Courier" class="">}</font></div></div><div class=""><div class=""><font face="Courier" class="">\usepackage[user,hyperref]{zref}%{zref-base,zref-user}</font></div><div class=""><font face="Courier" class=""> \zref@newprop*{pagedest}[Doc-Start]{page.\@the@H@page}</font></div><div class=""><font face="Courier" class=""> \zref@addprop{main}{pagedest}</font></div><div class=""><font face="Courier" class=""> \newcommand\hyperpageref[1]{\hyperlink{\zref@extract{#1}{pagedest}}{\pageref*{#1}}}</font></div></div><div class=""><div class=""><font face="Courier" class="">%</font></div><div class=""><font face="Courier" class="">\RequirePackage[nameinlink,noabbrev,capitalize]{cleveref}</font></div></div><div class=""><font face="Courier" class="">%</font></div><div class=""><font face="Courier" class="">\RequirePackage{crossreftools}</font></div><div class=""><div class=""><font face="Courier" class="">% Fix to crossreftools</font></div><div class=""><font face="Courier" class="">% <a href="https://tex.stackexchange.com/a/512175/13492" class="">https://tex.stackexchange.com/a/512175/13492</a></font></div><div class=""><font face="Courier" class="">\renewcommand{\@@crtextr@ct@ref}[2]{%</font></div><div class=""><font face="Courier" class="">  \expandafter\@@@crtextr@ct@ref\expandafter{\detokenize{#2}}{#1}%</font></div><div class=""><font face="Courier" class="">}</font></div><div class=""><font face="Courier" class="">\newcommand{\@@@crtextr@ct@ref}[2]{%</font></div><div class=""><font face="Courier" class="">  \expandafter\ifx\csname r@#1\endcsname\relax</font></div><div class=""><font face="Courier" class="">  \crt@refundefined%</font></div><div class=""><font face="Courier" class="">  \else</font></div><div class=""><font face="Courier" class="">  \expandafter\expandafter\csname crt@ref@splitter@#2\endcsname\csname r@#1\endcsname%</font></div><div class=""><font face="Courier" class="">  \fi</font></div><div class=""><font face="Courier" class="">}</font></div></div><div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class=""><div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">---<br class="">Murray Eisenberg<span class="Apple-tab-span" style="white-space: pre;">                </span><a href="mailto:murrayeisenberg@gmail.com" class="">murrayeisenberg@gmail.com</a></div><div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Mobile (413)-427-5334<br class="">503 King Farm Blvd #101<span class="Apple-tab-span" style="white-space: pre;">             </span><br class="">Rockville, MD 20850-6667<span class="Apple-tab-span" style="white-space: pre;">     </span><br class=""><br class=""><br class=""><br class=""><br class=""></div>
</div>
<br class=""></div></body></html>