diff options
author | Norbert Preining <norbert@preining.info> | 2022-05-20 03:01:51 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-05-20 03:01:51 +0000 |
commit | 33fe673e1a4a678f76e23a91da0f449998af9c47 (patch) | |
tree | 54a9486c6ec7621c31e33af6e6f111666585b56a /macros/latex-dev/base/ltxref.dtx | |
parent | 049d8c10a2be69e330d26efa5116b5ec451b8eab (diff) |
CTAN sync 202205200301
Diffstat (limited to 'macros/latex-dev/base/ltxref.dtx')
-rw-r--r-- | macros/latex-dev/base/ltxref.dtx | 83 |
1 files changed, 71 insertions, 12 deletions
diff --git a/macros/latex-dev/base/ltxref.dtx b/macros/latex-dev/base/ltxref.dtx index 53224103d9..596eb2fd74 100644 --- a/macros/latex-dev/base/ltxref.dtx +++ b/macros/latex-dev/base/ltxref.dtx @@ -33,7 +33,7 @@ %<*driver> % \fi \ProvidesFile{ltxref.dtx} - [2020/12/05 v1.1o LaTeX Kernel (Cross Referencing)] + [2022/04/12 v1.1p LaTeX Kernel (Cross Referencing)] % \iffalse \documentclass{ltxdoc} \GetFileInfo{ltxref.dtx} @@ -63,17 +63,19 @@ % {Extract file ltxref from ltcntlen.} % \changes{v1.1b}{1994/05/21}{Use new warning commands} % \changes{v1.1c}{1994/05/25}{Modify documentation} +% \changes{v1.1p}{2022/04/12}{Add starred variants for the ref commands} % % \section{Cross Referencing} % The user writes |\label|\marg{foo} to define the following % cross-references: % -% |\ref|\marg{foo}: value of most recently incremented referenceable +% |\ref|*\marg{foo}: value of most recently incremented referenceable % counter. in the current environment. (Chapter, section, -% theorem and enumeration counters are -% referenceable, footnote counters are not.) +% theorem, footnote and enumeration counters and other counters +% stepped with \cs{refstepcounter} are +% referenceable.) % -% |\pageref|\marg{foo}: page number at which |\label{foo}| command +% |\pageref|*\marg{foo}: page number at which |\label{foo}| command % appeared. where foo can be any string of characters not % containing `|\|', `|{|' or `|}|'. % @@ -87,6 +89,10 @@ % leaving a space on both sides of it is equivalent to leaving % a space on either side. % +% Note: the starred versions |\ref*| and |\pageref*| are provided +% to align with the use of \pkg{hyperref}. Without \pkg{hyperref} (or some +% other package using the starred form) the star is simply ignored. +% % % \MaybeStop{} % @@ -206,8 +212,10 @@ % \end{macrocode} % \begin{macro}{\ref} % \changes{LaTeX2e}{1993/12/11}{Macro reimplemented} +% \changes{LaTeX2e}{2022/04/12}{Macro reimplemented with a starred version} % \begin{macro}{\pageref} % \changes{LaTeX2e}{1993/12/11}{Macro reimplemented} +% \changes{LaTeX2e}{2022/04/12}{Macro reimplemented with a starred version} % \begin{macro}{\@setref} % \changes{LaTeX2e}{1993/12/11}{Macro added} % \changes{v1.1h}{1995/10/24}{Switch for refundefined renamed} @@ -229,9 +237,43 @@ \else \expandafter#2#1\null \fi} -\def\ref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}} -\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname - \@secondoftwo{#1}} +% \end{macrocode} +% \begin{macrocode} +%</2ekernel> +%<*2ekernel|latexrelease> +%<latexrelease>\IncludeInRelease{2022/06/01}% +%<latexrelease> {\ref}{Add starred reference commands}% +% \end{macrocode} +% \begin{macrocode} +\def\@kernel@sref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}} +\def\@kernel@spageref#1{\expandafter\@setref\csname r@#1\endcsname + \@secondoftwo{#1}} +\let\@kernel@ref\@kernel@sref +\let\@kernel@pageref\@kernel@spageref +\NewDocumentCommand\ref{s} + {\IfBooleanTF{#1}{\@kernel@sref}{\@kernel@ref}} +\NewDocumentCommand\pageref{s} + {\IfBooleanTF{#1}{\@kernel@spageref}{\@kernel@pageref}} +% \end{macrocode} +% As the commands are now protected we also need expandable versions for use +% in \cs{ifthenelse}: +% \begin{macrocode} +\def\@kernel@pageref@exp#1{\csname cs_if_exist:cTF\endcsname + {r@#1}{\csname tl_item:cn\endcsname{r@#1}{2}}{0}} +\def\@kernel@ref@exp#1{\csname cs_if_exist:cTF\endcsname + {r@#1}{\csname tl_item:cn\endcsname{r@#1}{1}}{0}} +% \end{macrocode} +% \begin{macrocode} +%</2ekernel|latexrelease> +%<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{0000/00/00}% +%<latexrelease> {\ref}{Add starred reference commands}% +%<latexrelease>\def\ref#1{\expandafter\@setref\csname r@#1\endcsname\@firstoftwo{#1}} +%<latexrelease>\def\pageref#1{\expandafter\@setref\csname r@#1\endcsname +%<latexrelease> \@secondoftwo{#1}} +%<latexrelease> +%<latexrelease>\EndIncludeInRelease +%<*2ekernel> % \end{macrocode} % \end{macro} % \end{macro} @@ -311,8 +353,8 @@ % \begin{macrocode} %</2ekernel> %<*2ekernel|latexrelease> -%<latexrelease>\IncludeInRelease{2020/10/01}% -%<latexrelease> {\refstepcounter}{Add \@currentcounter}% +%<latexrelease>\IncludeInRelease{2022/06/01}% +%<latexrelease> {\Ref}{Add starred version}% % \end{macrocode} % % \begin{macro}{\refstepcounter} @@ -373,9 +415,14 @@ % normal \texttt{\textbackslash ref} which might spoil kerning. % Perhaps one day this needs redoing.} % \changes{v1.1l}{2019/08/22}{Commanded moved from \texttt{varioref.sty}} +% \changes{v1.1p}{2022/04/12}{Macro reimplemented with a starred version}% % \begin{macrocode} -\DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}% - \expandafter\MakeUppercase\@tempa} +\def\@kernel@Ref#1{\protected@edef\@tempa{\@kernel@ref{#1}}% + \expandafter\MakeUppercase\@tempa} +\def\@kernel@sRef#1{\protected@edef\@tempa{\@kernel@sref{#1}}% + \expandafter\MakeUppercase\@tempa} +\NewDocumentCommand\Ref{s} + {\IfBooleanTF{#1}{\@kernel@sRef}{\@kernel@Ref}} % \end{macrocode} % \end{macro} % @@ -385,6 +432,18 @@ % \begin{macrocode} %</2ekernel|latexrelease> %<latexrelease>\EndIncludeInRelease +%<latexrelease>\IncludeInRelease{2020/10/01}% +%<latexrelease> {\Ref}{Add starred version}% +%<latexrelease>\def\@currentcounter{} +%<latexrelease>\def\refstepcounter#1{\stepcounter{#1}% +%<latexrelease> \edef\@currentcounter{#1}% +%<latexrelease> \protected@edef\@currentlabel +%<latexrelease> {\csname p@#1\expandafter\endcsname\csname the#1\endcsname}% +%<latexrelease>} +%<latexrelease>\def\labelformat#1{\expandafter\def\csname p@#1\endcsname##1} +%<latexrelease>\DeclareRobustCommand\Ref[1]{\protected@edef\@tempa{\ref{#1}}% +%<latexrelease> \expandafter\MakeUppercase\@tempa} +%<latexrelease>\EndIncludeInRelease %<latexrelease>\IncludeInRelease{2019/10/01}% %<latexrelease> {\refstepcounter}{Add \labelformat and \Ref}% %<latexrelease>\let\@currentcounter\@undefined |