% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2026-07-19.22}
+\def\texinfoversion{2026-07-23.18}
%
% Copyright 1985, 1986, 1988, 1990-2026 Free Software Foundation, Inc.
%
\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi
\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi
+% scratch count register
+\newcount\countA
+
% Give the space character the catcode for a space.
\def\spaceisspace{\catcode`\ =10\relax}
\newtoks\toksD
\newbox\boxA
\newbox\boxB
-\newcount\countA
\newif\ifpdf
\newif\ifpdfmakepagedest
% type (Ynumbered, Yappendix, Ynothing). #2 is the section title.
%
\def\donoderef#1#2{%
- \ifx\lastnode\empty\else
+ \ifx\lastnode\empty
+ \setrefshadow{#1}{#2}%
+ \else
\setref{\lastnode}{#1}{#2}%
\global\let\lastnode=\empty
\setnodeseenonce
%
\def\setref#1#2#3{%
\pdfmkdest{#1}%
+ \dosetref{#1}{#2}{#3}{xrdef}%
+}
+\def\dosetref#1#2#3#4{%
\iflinks
{%
\requireauxfile
% match definition in \xrdef, \refx, \xrefX.
\def\value##1{##1}%
\edef\writexrdef##1##2{%
- \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef
+ \write\auxfile{@#4{#1-% #1 of \setref, expanded by the \edef
##1}{##2}}% these are parameters of \writexrdef
}%
\toks0 = {#3}%
\immediate \writexrdef{title}{\the\toks0 }%
- \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
- \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
+ \immediate \writexrdef{snt}{\csname #2\endcsname}%
+ \safewhatsit{\writexrdef{pg}{\folio}}%
}%
\fi
}
+% Similar to \setref, but used for targets created by sectioning commands.
+% Write information about this target using @xrshad instead of @xrdef.
+\def\setrefshadow#1#2{%
+ % For PDF, output the target with \pdfdest. Note pdfTeX issues a warning
+ % if we output two targets with the same name.
+ \pdfmkdest{\pdfshadowprefix#2}%
+ \dosetref{#2}{#1}{#2}{xrshad}%
+}
+
+\def\pdfshadowprefix{XXSHADOW-}
+
% @xrefautosectiontitle on|off says whether @section(ing) names are used
% automatically in xrefs, if the third arg is not explicitly specified.
% This was provided as a "secret" @set xref-automatic-section-title
\def\infofilename{\ignorespaces #4}%
\setbox\infofilenamebox = \hbox{\infofilename\unskip}%
%
- \startxreflink{#1}{#4}%
+ \ifdim \wd\printedmanualbox = 0pt
+ \checkshadowactive{#1}\countA
+ \expandafter\ifnum\countA = 1
+ \startxreflink{\pdfshadowprefix#1}{}%
+ \else
+ \startxreflink{#1}{}%
+ \fi
+ \else
+ \startxreflink{#1}{#4}%
+ \fi
+ %
\getrefx{#1-title}\Xthisreftitle
%
% Float references are printed completely differently: "Figure 1.2"
\fi
}
+\def\xrdefctxt{%
+ % Context for expanding the node or anchor name to remove control sequences.
+ % \turnoffactive stops 8-bit characters being changed to commands
+ % like @'e.
+ \indexnofonts
+ \turnoffactive
+ \def\value##1{##1}%
+}
+
% Set #2 to xref string #1
\def\getrefx#1#2{%
\requireauxfile
{%
- \indexnofonts
- \turnoffactive
- \def\value##1{##1}%
+ \xrdefctxt
\expandafter\global\expandafter\let\expandafter#2\csname XR#1\endcsname
+ \ifx#2\relax
+ % try a shadow definition
+ \expandafter\global\expandafter\let\expandafter#2\csname SXR#1\endcsname
+ \ifx#2\empty
+ \let#2\relax
+ \fi
+ \fi
}%
}
+% Check if shadow definitions are active for target name #1, setting the
+% count register sequence in #2 to 1 if so.
+\def\checkshadowactive#1#2{%
+ \requireauxfile
+ {%
+ \xrdefctxt
+ \expandafter\global\expandafter\let\expandafter\tmp\csname SXR#1-title\endcsname
+ }%
+ \ifx\tmp\relax
+ #2=0 % no definitions made
+ \else
+ \ifx\tmp\empty
+ #2=0 % shadow definitions were disabled
+ \else
+ \expandafter\let\expandafter\tmp\csname XR#1-title\endcsname
+ \ifx\tmp\relax
+ #2=1 % yes, shadow definitions are active
+ \else
+ #2=0 % no, a real definition was made.
+ \fi
+ \fi
+ \fi
+}%
+
% This is the macro invoked by entries in the aux file. Define a control
% sequence for a cross-reference target (we prepend XR to the control sequence
% name to avoid collisions). The value is the page number. If this is a float
% type, we have more work to do.
%
\def\xrdef#1#2{%
- {% Expand the node or anchor name to remove control sequences.
- % \turnoffactive stops 8-bit characters being changed to commands
- % like @'e. \refx does the same to retrieve the value in the definition.
- \indexnofonts
- \turnoffactive
- \def\value##1{##1}%
- \xdef\safexrefname{#1}%
- }%
+ {\xrdefctxt \xdef\safexrefname{#1}}%
%
\bgroup
\expandafter\gdef\csname XR\safexrefname\endcsname{#2}%
\ignorespaces % ignore ends of line in aux file
}
+% Like \xrdef, but used for "shadow" definitions.
+\def\xrshad#1#2{%
+ {\xrdefctxt \xdef\safexrefname{#1}}%
+ \bgroup
+ \expandafter\ifx\csname XR\safexrefname\endcsname\relax
+ \expandafter\ifx\csname SXR\safexrefname\endcsname\relax
+ % safe to make shadow definition.
+ \expandafter\gdef\csname SXR\safexrefname\endcsname{#2}%
+ \else
+ % earlier shadow definition. disable.
+ \expandafter\gdef\csname SXR\safexrefname\endcsname{}%
+ \fi
+ \else
+ % blocked by node or anchor definition
+ \fi
+ \egroup
+}
+
% If working on a large document in chapters, it is convenient to
% be able to disable indexing, cross-referencing, and contents, for test runs.
% This is done with @novalidate at the beginning of the file.