%% %% This is file `cleveref-usedon.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% cleveref-usedon.dtx (with options: `package') %% %% This is a generated file. %% %% 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. %% ----------------------------------------------------------------------- %% \def\UsedOnPackageVersion{0.4.0} \def\UsedOnPackageDate{2023-04-21} \NeedsTeXFormat{LaTeX2e}[2021-06-01] \ProvidesExplPackage{cleveref-usedon} {\UsedOnPackageDate} {\UsedOnPackageVersion} {Patches the cleveref package and adds forward-referencing functionality} %% \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.}% } \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.}% } \RequirePackage{xparse} \bool_new:N \g__UsedOn_StandardBehaviour_bool \bool_gset_true:N \g__UsedOn_StandardBehaviour_bool \DeclareOption{usedon}{ \OptionNotUsed \bool_gset_true:N \g__UsedOn_StandardBehaviour_bool } \DeclareOption{notusedon}{ \OptionNotUsed \bool_gset_false:N \g__UsedOn_StandardBehaviour_bool } \DeclareOption*{ \PackageInfo{cleveref-usedon} {Passing~option~'\CurrentOption'~to~cleveref} \PassOptionsToPackage{\CurrentOption}{cleveref} } \ProcessOptions* \RequirePackage{cleveref}[2018/03/27] \newcommand*{\@setcpagerefrange}[3]{% \@@setcpagerefrange{#1}{#2}{cref}{#3}} \newcommand*{\@setCpagerefrange}[3]{% \@@setcpagerefrange{#1}{#2}{Cref}{#3}} \newcommand*{\@setlabelcpagerefrange}[3]{% \@@setcpagerefrange{#1}{#2}{labelcref}{#3}} \prg_generate_conditional_variant:Nnn \str_case:nn { x } { TF } \cs_generate_variant:Nn \str_case:nn { x } \seq_new:N \g__UsedOn_k_seq \prop_new:N \g__UsedOn_kv_prop \clist_new:N \g__UsedOn_Options_clist \clist_set:Nn \g__UsedOn_Options_clist {UsedOn, UsedBy, UsedByAndOn} \NewDocumentCommand{\UsedOnMessage}{m}{ \emph{(Used~on~#1.)} \newline } \NewDocumentCommand{\UsedByMessage}{ m }{ \emph{(Used~by~#1.)} \newline } \NewDocumentCommand{\UsedByAndOnMessage}{ m m }{ \emph{(Used~by~#1~on~#2.)} \newline } \NewDocumentCommand{\__UsedOn_Printer}{ m m }{% %% % 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' \cs_if_exist:cT {r@#1@#2@1} { %% % In a tmp clist we store all the references of the form %% % `