\def\UsedOnPackageVersion{0.4.0} \def\UsedOnPackageDate{2023-04-21} % \iffalse meta-comment % % Package `cleveref-usedon' to use with LaTeX2e % % Copyright (C) 2023 by Sven Pistre % % Written and maintained by Sven Pistre % % The development version of this package can be found at % % http://github.com/SvenPistre/cleveref-usedon % % for those people who are interested. Please report bugs by creating a % github issue or sending an email to cleveref-usedon@sven-pistre.com. % --------------------------------------------------------------------------- % This file may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either % version 1.3 of this license or (at your option) any later % version. The latest version of this license is in: % % http://www.latex-project.org/lppl.txt % % and version 1.3 or later is part of all distributions of % LaTeX version 2005/12/01 or later. % ----------------------------------------------------------------------- % This work consists of the files cleveref-usedon.dtx and cleveref-usedon.ins % and the derived filebase cleveref-usedon.sty. % %\NeedsTeXFormat{LaTeX2e}[2021-06-01] %\ProvidesExplPackage{cleveref-usedon} % {\UsedOnPackageDate} % {\UsedOnPackageVersion} % {Patches the cleveref package and adds forward-referencing functionality} % %<*driver> \ProvidesFile{cleveref-usedon.dtx} \documentclass{l3doc} \usepackage{amssymb} \usepackage{mathtools} \usepackage{amsthm} \usepackage{thmtools} \usepackage{hyperref} \usepackage[capitalise]{cleveref-usedon}[2023/03/29] \declaretheorem[ numberwithin=section, name=Theorem]{theorem} \declaretheorem[ sibling=theorem, name=Lemma]{lemma} \declaretheorem[ sibling=theorem, name=Corollary]{corollary} \crefname{page}{page}{pages} % do NOT capitalise pages for more visual appeal \EnableCrossrefs \CodelineIndex \RecordChanges \begin{document} \DocInput{\jobname.dtx} \end{document} % % \fi %% % \DoNotIndex{ % \arabic, \AtBeginDocument, \AtEndDocument, % \emph, \enquote, \ExplSyntaxOn, \ExplSyntaxOff, % \MessageBreak % } % % \changes{v0.1.0}{2023-03-29}{Initial version} % \changes{v0.2.0}{2023-04-07}{% % Manually \texttt{\textbackslash{}Require}'d the packages \pkg{expl3} and \pkg{xparse}% % for users of older \LaTeX{} installations.% % Added \texttt{\_\_UsedOn\_}-guards to the macros \texttt{\textbackslash{}origlabel},% % \texttt{\textbackslash{}origcref}, and \texttt{\textbackslash{}origCref} to prevent them from leaking.% % } % \changes{v0.3.0}{2023-04-18}{% % Added the options \texttt{UsedBy} and \texttt{UsedByAndOn} upon request of % \href{https://people.math.umass.edu/~murray/}{Murray Eisenberg}. Thank you for this input. % For now these options remain experimental because you need to use proof environments in an unusual way, % see \cref{sec:UsedByAndOn}. % } % \changes{v0.4.0}{2023-04-21}{% % Rewritten some parts slightly, % most notably changed the documentation class for this documentation % from \cls{ltxdoc} to \cls{l3doc}. % } % % \GetFileInfo{cleveref-usedon.dtx} % % % % \title{The \pkg{cleveref-usedon} package% % \thanks{This document corresponds to % \pkg{cleveref-usedon}~v\UsedOnPackageVersion, % last revised~\UsedOnPackageDate.}} % \author{Sven Pistre% % \thanks{ % E-mail: % \href{mailto:cleveref-usedon@sven-pistre.com?subject=[cleveref-usedon]}{cleveref-usedon@sven-pistre.com}} % } % \date{Released \UsedOnPackageDate} % % \maketitle % % \begin{documentation} % % \begin{abstract} % This package adds \enquote{forward-referencing} to the \pkg{cleveref} package. % Any label can be referenced with the new optional argument |UsedOn| % passed to |\cref|. Doing so, will print an info message at the original label % location (in a theorem environment, say) which reads % \enquote{\emph{Used on pages \meta{list of pages}.}}. % This functionality is complementary to \pkg{hyperref}'s |pagebackref| % or \pkg{biblatex}'s |backref| option for the bibliography. % It might be useful for authors of longer texts such as textbooks or theses, % where a lot of supplementary results and information are given in early % chapters, appendices or exercises. The message on which pages these % results will be used can be a helpful information for the reader of the final text. % Additionally, a bug in \pkg{cleveref v0.21.4} is patched. % \end{abstract} % % \tableofcontents % % % \section{Introduction} % \label{sec:introduction} % % Imagine you are reading a long mathematical text such as a text book or % a thesis. There are plenty of supplementary lemmas, propositions, theorems % and/or exercises throughout the whole text. % You ask yourself ``Gosh, while Lemma 1.12 is certainly an interesting result % \emph{where} is this result used later on in this long text? I really would find % that helpful to decide \emph{why} I should read the proof.'' % You can, of course, use the PDF search function of your viewer to look up the % string \enquote{Lemma 1.12} but wouldn't it be more helpful if Lemma 1.12 already % indicates all or at least its most useful/crucial applications via an info message? % % This is what the package \pkg{cleveref-usedon} tries to address. % The info message \enquote{\emph{Used on p. 40, 43-45 and 101.}} would then be % printed to the header of Lemma 1.12. % For example, we have given the following theorem the label % \begin{quote} % |\label{thm:SqrtTwoIrrational}|. % \end{quote} % \begin{theorem} \label{thm:SqrtTwoIrrational} % The number $\sqrt{2}$ is irrational. % \end{theorem} % Now we can reference this theorem via % \begin{quote} % |\cref[UsedOn]{thm:SqrtTwoIrrational}|: % \end{quote} % A proof of \cref[UsedOn]{thm:SqrtTwoIrrational} can be traced back to Euclid. % % We will now reference this theorem without the optional argument % |[UsedOn]|. So let's clear the page of this PDF, so that we can see the effects of % calling % \begin{quote} % |\cref{thm:SqrtTwoIrrational}| % \end{quote} % more clearly. % \clearpage % Note that the current page number \thepage{} is not included in the list of % page references in the header of \cref{thm:SqrtTwoIrrational}. % % % \section{Usage} % \label{sec:usage} % % The \pkg{cleveref-usedon} package uses \pkg{cleveref v0.21.4} % as its base. % To freely cite from the \pkg{cleveref} documentation: \newline % The \pkg{cleveref-usedon} package is loaded in the usual way, by % putting the line % \begin{quote} % |\usepackage{cleveref-usedon}| % \end{quote} % in your document's preamble. However, care must be taken when using % \pkg{cleveref} in conjunction with other packages that modify % \LaTeX{}'s referencing system (see Section 13 of \pkg{cleveref}'s % documentation). Basically, \pkg{cleveref-usedon} must be loaded % \emph{last} but definitely AFTER \pkg{hyperref}. % \begin{function}{\cref, \Cref} % \begin{syntax} % \cs{cref}\oarg{Option}\marg{LabelName} % \cs{Cref}\oarg{Option}\marg{LabelName} % \end{syntax} % \end{function} % The |\cref| macro can be called with options |UsedOn| (see \cref{sec:UsedOn}), % |UsedBy| (experimental, see \cref{sec:UsedByAndOn}) and |UsedByAndOn| (experimental, see \cref{sec:UsedByAndOn}) % or their short forms |uo|, |ub|, |ubao|. % This is case-insensitive, i.e. you could also write\footnote{But why would you want to?} % \begin{quote} % |\cref[UsEdOn]|\marg{LabelName}, \newline % |\cref[uO]|\marg{LabelName}. % \end{quote} % The package \pkg{cleveref-usedon} is implemented using the \LaTeX3 programming layer |expl3|. % If you are interested, I have spent some time to document and comment % on the implementation in \cref{sec:implementation}. % On an abstract level the implementation is as follows: % Whenever the label \meta{LabelName} gets % referenced with one of the options at some location via |\cref|\oarg{Option}\marg{LabelName}, % an additional auxiliary label is created at % this very location. This auxiliary label has the form \meta{Option}@\meta{LabelName}@\meta{Counter} % where \meta{Counter} is an integer that counts how often the label \meta{LabelName} has % been referenced with \meta{Option}. At the end of the \LaTeX{} run, the final value of this counter % is written to the .aux file as a key-value pair: % \begin{quote} % \meta{Option}@\meta{LabelName} = \meta{MaxCounter} % \end{quote} % In the second \LaTeX{} run, we read this counter from the .aux file. % Then, at the original location of the referenced label \meta{LabelName}, we can now pass % the list of auxiliary labels % \begin{quote} % \meta{Option}@\meta{LabelName}@1, ..., \meta{Option}@\meta{LabelName}@\meta{MaxCounter} % \end{quote} % to |\cpageref| (and |\cref| for the experimental options) and write the forward-referencing info message. % \subsection{The option \oarg{UsedOn}} % \label{sec:UsedOn} % % \begin{variable}{UsedOn} % This option adds the message % \begin{quote} % \emph{(Used on page(s) \meta{list of page(s)}.)} % \end{quote} % The text is followed by a line break % and is set after the original location of the referenced label \meta{LabelName}. % If \pkg{hyperref} has been loaded, there will also be hyperlinks % to the corresponding pages from where the label has been referenced. % \end{variable} % % If the original label has been set in a theorem-like environment such as % \begin{quote} % \begin{verbatim} % \begin{theorem} \label{thm:SqrtTwoIrrational} % The number $\sqrt{2}$ is irrational. % \end{theorem} % \end{verbatim} % \end{quote} % then the info message is printed in the header of this theorem-like % environment. The same functionality can be used for |\Cref|. % % % \subsection{The experimental options \oarg{UsedBy} and \oarg{UsedByAndOn}} % \label{sec:UsedByAndOn} % % \begin{variable}{UsedBy, UsedByAndOn} % The option \oarg{UsedBy} adds the message % \begin{quote} % \emph{(Used by \meta{list of theorem-like destination(s)}.)} % \end{quote} % The option \oarg{UsedByAndOn} adds the message % \begin{quote} % \emph{(Used by \meta{list of theorem-like destination(s)} on page(s) \meta{list of page(s)}.)} % \end{quote} % Each text is followed by a line break % and is set after the original location of the referenced label \meta{LabelName}. % If \pkg{hyperref} has been loaded, there will also be hyperlinks to the destinations. % \end{variable} % % For example, suppose we have the following lemma. % \begin{lemma} \label{lemma:SmoothFunction} % Any smooth function $f\colon \mathbb{R}\to \mathbb{R}$ is continuous. % \end{lemma} % And we will use it in the proof of the following result. % \begin{corollary} \label{cor:DerivativeContinuous} % Suppose $f\colon \mathbb{R}\to \mathbb{R}$ is smooth. % The derivative $f^{\prime}\colon \mathbb{R}\to \mathbb{R}$ is continuous. % \begin{proof} % The derivative of a smooth map is itself smooth. % Hence, the claim follows by \cref[UsedBy]{lemma:SmoothFunction}. % \end{proof} % \end{corollary} % The previous result will in turn be used in the proof of the next one. % \begin{corollary} \label{cor:AllDerivativesContinuous} % Suppose $f\colon \mathbb{R}\to \mathbb{R}$ is smooth and $k\in\mathbb{N}$. % The $k$th derivative $f^{(k)}\colon \mathbb{R}\to \mathbb{R}$ is continuous. % \begin{proof} % This follows from \cref[UsedByAndOn]{cor:DerivativeContinuous} by induction. % \end{proof} % \end{corollary} % The code for the above examples is as follows: % \begin{quote} % \begin{verbatim} % \begin{lemma} \label{lemma:SmoothFunction} % Any smooth function $f\colon \mathbb{R}\to \mathbb{R}$ % is continuous. % \end{lemma} % % \begin{corollary} \label{cor:DerivativeContinuous} % Suppose $f\colon \mathbb{R}\to \mathbb{R}$ is smooth. % The derivative $f^{\prime}\colon \mathbb{R}\to \mathbb{R}$ % is continuous. % \begin{proof} % The derivative of a smooth map is itself smooth. % Hence, the claim follows by \cref[UsedBy]{lemma:SmoothFunction}. % \end{proof} % \end{corollary} % % \begin{corollary} \label{cor:AllDerivativesContinuous} % Suppose $f\colon \mathbb{R}\to \mathbb{R}$ is smooth and % $k\in\mathbb{N}$. The $k$th derivative % $f^{(k)}\colon \mathbb{R}\to \mathbb{R}$ % is continuous. % \begin{proof} % This follows from % \cref[UsedByAndOn]{cor:DerivativeContinuous} by induction. % \end{proof} % \end{corollary} % \end{verbatim} % \end{quote} % Unfortunately, due to how this package is currently implemented, to get these % experimental options to work it is necessary to abuse the usage of proof environments. % Namely, one needs to nest the proof environment \emph{inside} the theorem-like environment. % Note carefully how the proof environments are (ab)used in the above code example. % % This is -- as far is I know -- not how these environments are supposed to be used. % In particular, placing text between theorem-like environment and the corresponding proof, % as is often common, will result in a wrong reference. Namely, instead of referencing the % theorem-like environment by name only the corresponding section name would be printed, e.g. % \enquote{\emph{Used by \cref{sec:UsedByAndOn}.}}. % You can see this for yourself, if you move the proof environment out of the theorem-like % environment in the above examples. % Hence, using proof environments correctly results in messages which are less helpful to the reader. % On the other hand, using this experimental functionality to help the reader forces users (i.e. authors) % of this package to use proof environments incorrectly. % This sounds like a No-Free-Lunch theorem... % Therefore, use these two experimental options at your own discretion! % % % \section{Hints and tips} % \label{sec:tips} % % If you use the |capitalise| option for \pkg{cleveref}, you might want % to revert this capitalisation for page references for more visual appeal by putting % \begin{quote} % |\crefname{page}{page}{pages}| % \end{quote} % in your document's preamble, after loading \pkg{cleveref-usedon}. % % It is recommended to not use the optional arguments for equation-like % environments such as \cref[UsedOn]{eq:Stokes} because sometimes\footnote{I haven't quite tracked down this bug.} % the info message will --- unhelpfully --- be printed inside the equation % environment, like so (this might or might not\footnote{ % In version 0.2.0 of this package, the text \enquote{\emph{Used on page 2.}} % was printed right after the formula in the equation environment.} % show undesired behaviour): % \begin{equation} % \int_{M}\mathrm{d}\omega =\int_{\partial M}\omega. \label{eq:Stokes} % \end{equation} % So, one should use this functionality only for theorem-like % environments such as theorems, lemmas and exercises etc. % % If one references the same label multiple times but with different options, say |UsedOn| and |UsedBy|, % then \emph{both} info messages are printed after the original label location. % This is not how this functionality was intended and you shouldn't use it like that. % I am not going to implement a check which various combinations of these options are used for the same label. % % \subsection{Editing the info messages} % \label{subsec:EditInfoMsg} % % \begin{function}{\UsedOnMessage, \UsedByMessage, \UsedByAndOnMessage} % \begin{syntax} % \cs{UsedOnMessage}\marg{PageList from cpageref} % \cs{UsedByMessage}\marg{EnvironmentList from cpageref} % \cs{UsedByAndOnMessage}\marg{EnvironmentList from cpageref}\marg{PageList from cpageref}{} % \end{syntax} % The standard messages which get printed to the first line of the labelled % environment are % \begin{quote} % \emph{(Used on \meta{PageList}.)}, \newline % \emph{(Used by \meta{EnvironmentList}.)}, \newline % \emph{(Used by \meta{EnvironmentList}) on \meta{PageList}.)}, % \end{quote} % respectively % --- followed by a line break --- where \meta{PageList} is generated internally % by \pkg{cleveref} via |\cpageref| and \meta{EnvironmentList} is generated internally % by \pkg{cleveref} via |\cref|. % You can change these behaviours by redefining the macros |\UsedOnMessage|, |\UsedByMessage| % and |\UsedByAndOnMessage|, e.g. as % \begin{quote} % \begin{verbatim} % \RenewDocumentCommand{\UsedOnMessage}{ m }{ % \emph{(Will be cited on #1.)} \newline % } % \RenewDocumentCommand{\UsedByMessage}{ m }{ % \emph{(Will be applied in #1.)} \newline % } % \RenewDocumentCommand{\UsedByAndOnMessage}{ m m }{ % \emph{(Will be applied in #1 on #2.)} \newline % } % \end{verbatim} % \end{quote} % \end{function} % % % \section{Interaction with other packages} % \label{sec:OtherPackages} % % All interactions with other packages mentioned in Section 13 of % \pkg{cleveref}'s documentation also apply to \pkg{cleveref-usedon}. % In fact (if \pkg{cleveref-usedon} is loaded last), % \pkg{ntheorem}'s |\thref| and % \pkg{varioref}'s |\vref| also obtain the additional |UsedOn| % functionality because \pkg{cleveref} redefines these macros to % be aliases for |\cref|. Of course, they need to be loaded in the correct order, i.e. % \begin{verbatim} % \usepackage{ntheorem} % \usepackage{hyperref} % \usepackage{cleveref-usedon} % \end{verbatim} % or % \begin{verbatim} % \usepackage{varioref} % \usepackage{hyperref} % \usepackage{cleveref-usedon} % \end{verbatim} % % % \section{Future features} % \label{sec:future} % % For all feature requests, either % \href{https://github.com/SvenPistre/cleveref-usedon/issues}{create a github issue} or % \href{mailto:cleveref-usedon@sven-pistre.com?subject=[cleveref-usedon]}{send me an email}. % % Let's just reference \cref[UsedOn]{thm:SqrtTwoIrrational} one last time for the fun of it, % check \cpageref{thm:SqrtTwoIrrational} again to see the effect to the reference list % in the header of \cref{thm:SqrtTwoIrrational}. % % \end{documentation} % % % \begin{implementation} % % % \section{Implementation} % \label{sec:implementation} % % Start the \pkg{DocStrip} guards. % \begin{macrocode} %<*package> % \end{macrocode} % % Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention). % \begin{macrocode} %<@@=UsedOn> % \end{macrocode} % % If the \LaTeX{} version is too old, then abort loading and show an error message. % The macro |\IfFormatAtLeastTF| is not be available on \LaTeX{} versions older than |2020-10-01| % so we need to provide an internal workaround. % \begin{macrocode} \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} \IfFormatAtLeastTF{2021-06-01}{% % LaTeX2e version new enough }{% \PackageError{cleveref-usedon}{% Mismatched~LaTeX~support~files~detected.\MessageBreak Your~LaTeX~format~is~dated~\fmtversion,\MessageBreak but~the~package~cleveref-usedon\MessageBreak requires~at~least~2021-06-01.\MessageBreak Update~your~TeX~distribution.\MessageBreak \MessageBreak Loading~cleveref-usedon~will~abort!}% {Update~your~TeX~distribution~using~your~TeX~package~manager.}% } % \end{macrocode} % % If the version of the \LaTeX3 kernel is too old, then abort loading and show an error message. % The macro |\IfExplAtLeastTF| currently does not exist at all\footnote{ % But might in the future, see \href{https://github.com/latex3/latex2e/issues/1004}{github issue \#1004}.}, % but we can provide an internal workaround. % \begin{macrocode} \providecommand\IfExplAtLeastTF{\@ifl@t@r\ExplLoaderFileDate} \RequirePackage{expl3}[2021-05-16] \IfExplAtLeastTF{2021-05-16}{% % expl3 version new enough }{% \PackageError{cleveref-usedon}{% Support~package~expl3~too~old.\MessageBreak The~L3~programming~layer~in~the~LaTeX~format\MessageBreak is~dated~\ExplLoaderFileDate,\MessageBreak but~the~package~cleveref-usedon\MessageBreak requires~at~least~2021-05-16.\MessageBreak Update~your~TeX~distribution.\MessageBreak \MessageBreak Loading~cleveref-usedon~will~abort!}% {Update~your~TeX~distribution~using~your~TeX~package~manager.}% } % \end{macrocode} % % \subsection{Options and requirements} % % The following package is included in the \LaTeX{} kernel since 2020-10-01. % Here, it is manually |\Require|'d for users with older \LaTeX{} versions. % For such users the loading should have been aborted anyway. % \begin{macrocode} \RequirePackage{xparse} % \end{macrocode} % % The following package options currently don't do anything. % \begin{macrocode} \bool_new:N \g_@@_StandardBehaviour_bool \bool_gset_true:N \g_@@_StandardBehaviour_bool \DeclareOption{usedon}{ \OptionNotUsed \bool_gset_true:N \g_@@_StandardBehaviour_bool } \DeclareOption{notusedon}{ \OptionNotUsed \bool_gset_false:N \g_@@_StandardBehaviour_bool } % \end{macrocode} % % All other package options get passed on to \pkg{cleveref} which is the base for the current package here. % \begin{macrocode} \DeclareOption*{ \PackageInfo{cleveref-usedon} {Passing~option~'\CurrentOption'~to~cleveref} \PassOptionsToPackage{\CurrentOption}{cleveref} } \ProcessOptions* \RequirePackage{cleveref}[2018/03/27] % \end{macrocode} % % \subsection{Patches of known bugs to \pkg{cleveref}} % % The following fixes the range bug for |\cpageref| in \pkg{cleveref v0.21.4}. % See \url{https://tex.stackexchange.com/a/620066/267438}. % (We need to temporarily reset the \pkg{DocStrip} guards.) % % \begin{macrocode} %<@@=> \newcommand*{\@setcpagerefrange}[3]{% \@@setcpagerefrange{#1}{#2}{cref}{#3}} \newcommand*{\@setCpagerefrange}[3]{% \@@setcpagerefrange{#1}{#2}{Cref}{#3}} \newcommand*{\@setlabelcpagerefrange}[3]{% \@@setcpagerefrange{#1}{#2}{labelcref}{#3}} %<@@=UsedOn> % \end{macrocode} % % \subsection{Overloading of label and cref} % % We need variants of |\str_case:nn| % which expand the input string token. % This will be used to match % options for \cs{@@_Processor}. % % \begin{macrocode} \prg_generate_conditional_variant:Nnn \str_case:nn { x } { TF } \cs_generate_variant:Nn \str_case:nn { x } % \end{macrocode} % %\begin{variable}{\g_@@_k_seq} % Let's initialise a global key sequence for those label names that % have been referenced via |[UsedOn]|, |[UsedBy]| or |[UsedByAndOn]|. % % \begin{macrocode} \seq_new:N \g_@@_k_seq % \end{macrocode} %\end{variable} % %\begin{variable}{\g_@@_kv_prop} % And we'll also create a global key-value property list with % label names as keys and the maximal amount of times they have % been referenced via |[UsedOn]| as values (possibly known from % the last pdflatex run). % % \begin{macrocode} \prop_new:N \g_@@_kv_prop % \end{macrocode} %\end{variable} % % %\begin{variable}{\g_@@_Options_clist} % This |clist| contains all options that can be passed to |\cref| which are currently implemented. % \begin{macrocode} \clist_new:N \g_@@_Options_clist \clist_set:Nn \g_@@_Options_clist {UsedOn, UsedBy, UsedByAndOn} % \end{macrocode} %\end{variable} % %\begin{macro}{\UsedOnMessage} % The following are the standard texts that get printed in the first line % of the labelled environment which later gets referenced with % |[UsedOn]|, |[UsedBy]| or |[UsedByAndOn]|. % % \begin{macrocode} \NewDocumentCommand{\UsedOnMessage}{m}{ \emph{(Used~on~#1.)} \newline } % \end{macrocode} %\end{macro} %\begin{macro}{\UsedByMessage} % \begin{macrocode} \NewDocumentCommand{\UsedByMessage}{ m }{ \emph{(Used~by~#1.)} \newline } % \end{macrocode} %\end{macro} %\begin{macro}{\UsedByAndOnMessage} % \begin{macrocode} \NewDocumentCommand{\UsedByAndOnMessage}{ m m }{ \emph{(Used~by~#1~on~#2.)} \newline } % \end{macrocode} %\end{macro} % %\begin{macro}{\@@_Printer} % Given a \meta{LabelName}, the following command records all references % via the optional |cref| arguments |[UsedOn]|, |[UsedBy]| or |[UsedByAndOn]|, i.e. % when the user called |\cref|\oarg{Option}\marg{LabelName}. % They are recorded in a temporary comma-separated list % (a |clist| in |expl3| speak). This |clist| is then passed to \pkg{cleveref}'s % |cpageref| or |cref| which in turn is passed to |\UsedOnMessage|, |\UsedByMessage| % or |\UsedByAndOnMessage| to be printed after the original label. % % \begin{macrocode} \NewDocumentCommand{\@@_Printer}{ m m }{% % \end{macrocode} % First, we will check if the reference \meta{Option}|@|\meta{LabelName}|@1| % exists. Here, the |@1| means that \meta{LabelName} has been referenced % with option \oarg{Option} at least once. If this reference does not exist, % nothing happens. %\iffalse %% % Check if the reference #1@@1 exists %% % Here the @1 means that has been referenced %% % with option #1 at least once where #1 is %% % 'UsedOn', 'UsedBy' or 'UsedByAndOn' %\fi % \begin{macrocode} \cs_if_exist:cT {r@#1@#2@1} { % \end{macrocode} % Next, we store all the references of the form % \meta{Option}|@|\meta{LabelName}|@|\meta{Number} in a temporary % comma-separated list (|clist|). We do this by looping from 1 to the value % of |LastRun@|\meta{Option}|@|\meta{LabelName} (if the latter value exists, % otherwise we set it to 1). Initially, this will need two consecutive runs of pdflatex. %\iffalse %% % In a tmp clist we store all the references of the form %% % ` % \end{macrocode} % % \end{implementation} % % \PrintChanges % \PrintIndex