diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty | 167 |
1 files changed, 158 insertions, 9 deletions
diff --git a/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty b/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty index 93bee4fbf2c..10ec71fb078 100644 --- a/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty +++ b/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty @@ -1,4 +1,4 @@ -%% LaTeX package crossreftools - version 0.2 (2017/10/25 -- 23:08:36) +%% LaTeX package crossreftools - version 0.3 (2017/10/31 -- 08:23:52) %% Source file for crossreftools.sty %% %% @@ -19,21 +19,17 @@ %% %% -\def\crossreftoolspackageversion{0.2} +\def\crossreftoolspackageversion{0.3} \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{crossreftools}[2017/10/25 - v\crossreftoolspackageversion] +\ProvidesPackage{crossreftools}[2017/10/31 - v\crossreftoolspackageversion] % Some helper macros -\newcommand{\crt@firstoffive}[5]{#1} \newcommand{\crt@refundefined}{[UNDEFINED]} -\long\def\crt@gobblethree#1#2#3{} -\long\def\crt@gobbletwo#1#2{} -\long\def\crt@gobbleone#1{} -% Splitters +% Splitters for cleveref \def\crt@@cref@@splitter@@first[#1][#2][#3]#4\@nil{% #1% @@ -121,7 +117,7 @@ \expandafter\ifx\csname r@#2@\@@crt@@cref@@suffix\endcsname\relax \crt@refundefined% \else - \expandafter\expandafter\expandafter\expandafter\expandafter\csname crt@cref@splitter@#1\expandafter\endcsname\csname r@#2@cref\endcsname% + \expandafter\expandafter\expandafter\expandafter\expandafter\csname crt@cref@splitter@#1\expandafter\endcsname\csname r@#2@\@@crt@@cref@@suffix\endcsname% \fi } @@ -151,5 +147,158 @@ } +%%%%% + +% Default cref format + +\newcommand{\crtcref}[1]{% + \expandafter\ifx\csname r@#1\endcsname\relax + \crt@refundefined% + \else + \crtcrefnamebylabel{#1} \crtcrefnumber{#1}% + \fi +} + +\newcommand{\crtCref}[1]{% + \expandafter\ifx\csname r@#1\endcsname\relax + \crt@refundefined% + \else + \crtCrefnamebylabel{#1} \crtcrefnumber{#1}% + \fi +} + + +% refcount - like support + + +\newif\if@crt@hyperrefloaded + + +\@ifpackageloaded{hyperref}{\global\@crt@hyperrefloadedtrue}{} + + +\AtBeginDocument{% + \if@crt@hyperrefloaded + \def\crt@@ref@@splitter@@first#1#2#3#4#5\@nil{% + #1% + } + + \def\crt@@ref@@splitter@@second#1#2#3#4#5\@nil{% + #2% + } + + \def\crt@@ref@@splitter@@third#1#2#3#4#5\@nil{% + #3% + } + + \def\crt@@ref@@splitter@@fourth#1#2#3#4#5\@nil{% + #4% + } + + \def\crt@@ref@@splitter@@fifth#1#2#3#4#5\@nil{% + #5% + } + \else + % No hyperref + \def\crt@@ref@@splitter@@first#1#2\@nil{% + #1% + } + + \def\crt@@ref@@splitter@@second#1#2\@nil{% + #2% + } + + \def\crt@@ref@@splitter@@third#1#2\@nil{% + % Nothing for convenience + } + + \def\crt@@ref@@splitter@@fourth#1#2\@nil{% + % Nothing for convenience + } + + \def\crt@@ref@@splitter@@fifth#1#2\@nil{% + % Nothing for convenience + } + \fi +} + + \def\crt@ref@splitter@firstarg#1{% + \expandafter\crt@@ref@@splitter@@first#1\@nil% + } + + \def\crt@ref@splitter@secondarg#1{% + \expandafter\crt@@ref@@splitter@@second#1\@nil% + } + + \def\crt@ref@splitter@thirdarg#1{% + \expandafter\crt@@ref@@splitter@@third#1\@nil% + } + + \def\crt@ref@splitter@fourtharg#1{% + \expandafter\crt@@ref@@splitter@@fourth#1\@nil% + } + + \def\crt@ref@splitter@fiftharg#1{% + \expandafter\crt@@ref@@splitter@@fifth#1\@nil% + } + + +\newcommand{\@@crtextr@ct@ref}[2]{% + \expandafter\ifx\csname r@#2\endcsname\relax + \crt@refundefined% + \else + \expandafter\expandafter\csname crt@ref@splitter@#1\endcsname\csname r@#2\endcsname% + \fi +} + +\let\crt@ref@splitter@reference\crt@ref@splitter@firstarg +\let\crt@ref@splitter@page\crt@ref@splitter@secondarg +\let\crt@ref@splitter@name\crt@ref@splitter@thirdarg +\let\crt@ref@splitter@anchor\crt@ref@splitter@fourtharg +\let\crt@ref@splitter@unused\crt@ref@splitter@fiftharg + + +\newcommand{\crtextractref}[2]{% + \@@crtextr@ct@ref{#1}{#2}% +} + + +\newcommand{\crtrefnumber}[1]{% + \@@crtextr@ct@ref{reference}{#1}% +} + + +\newcommand{\crtrefpage}[1]{% + \@@crtextr@ct@ref{page}{#1}% +} + +\newcommand{\crtrefanchor}[1]{% + \@@crtextr@ct@ref{anchor}{#1}% +} + +\newcommand{\crtrefname}[1]{% + \@@crtextr@ct@ref{name}{#1}% +} + +%%% Hyperref wrappers, not expandable. + + +\newcommand{\crthyperlink}[2]{% + \if@crt@hyperrefloaded + \hyperlink{#1}{#2}% + \else + #2% + \fi +} + +\newcommand{\crthypercref}[1]{% + \crthyperlink{\crtrefanchor{#1}}{\crtcref{#1}}% +} + +\newcommand{\crthyperCref}[1]{% + \crthyperlink{\crtrefanchor{#1}}{\crtCref{#1}}% +} + + \endinput |