From 5e4b8348654b7629a0fc624aa7b48492a7e6249a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 18 Mar 2018 21:51:41 +0000 Subject: crossreftools (18mar18) git-svn-id: svn://tug.org/texlive/trunk@47012 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/crossreftools/README | 2 +- .../doc/latex/crossreftools/crossreftools_doc.pdf | Bin 236148 -> 241851 bytes .../doc/latex/crossreftools/crossreftools_doc.tex | 76 +++++++++++++-- .../latex/crossreftools/crossreftools_driver.pdf | Bin 102704 -> 102837 bytes .../latex/crossreftools/crossreftools_driver.tex | 8 +- .../tex/latex/crossreftools/crossreftools.sty | 108 ++++++++++++++++++++- 6 files changed, 179 insertions(+), 15 deletions(-) (limited to 'Master/texmf-dist') diff --git a/Master/texmf-dist/doc/latex/crossreftools/README b/Master/texmf-dist/doc/latex/crossreftools/README index 935fa9a310e..c1006ba1ee0 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/README +++ b/Master/texmf-dist/doc/latex/crossreftools/README @@ -1,4 +1,4 @@ -%% LaTeX package crossreftools - version 0.5 (2018/02/23 -- 13:46:13) +%% LaTeX package crossreftools - version 0.6 (2018/03/18 -- 16:34:57) %% README file for crossreftools.sty %% %% diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf index 65e8b07ec93..9fa2342515d 100644 Binary files a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf and b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf differ diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex index 06b4159ed19..2f5f3908456 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex +++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex @@ -1,4 +1,4 @@ -%% LaTeX package crossreftools - version 0.5 (2018/02/23 -- 13:46:13) +%% LaTeX package crossreftools - version 0.6 (2018/03/18 -- 16:34:57) %% Documentation file for crossreftools.sty %% %% @@ -97,6 +97,8 @@ \@namedef{crossreftoolsversion0.5}{v0.5 2018-02-23} +\@namedef{crossreftoolsversion0.6}{v0.6 2018-03-18} + \newcommand{\authorname}{Autor} @@ -325,7 +327,7 @@ -\def\packageversion{0.5} +\def\packageversion{0.6} \def\hyperrefversionwithfifthargument{v6.85a} @@ -710,6 +712,59 @@ This generates a linked reference to a given label like \cs{Cref} would do. If \ For the lower case version see \refCom{crthypercref}. \end{docCommand} +\section{Lower and upper case references} + +\begin{docCommand}[doc new=\chdocextractversion{crossreftoolsversion0.6}] +{crtlnameref}{\marg{label name}} + +This generates a linked reference to the name like \cs{nameref} would do, but the first character is used in lower case mode. % given label like \cs{Cref} would do. +If \CHDocPackage{hyperref} is not loaded, no link but only the reference text is displayed. +For the upper case version see \refCom{crtunameref}. +\end{docCommand} + +\begin{docCommand}[doc new=\chdocextractversion{crossreftoolsversion0.6}] +{crtlnameref*}{\marg{label name}} + +This generates a reference like \cs{nameref*} would do, but the first character is used in lower case mode -- no links are generated. +For the upper case version see \refCom{crtlnameref*}. +\end{docCommand} + + +\begin{docCommand}[doc new=\chdocextractversion{crossreftoolsversion0.6}] +{crtunameref}{\marg{label name}} + +This generates a linked reference to the name like \cs{nameref} would do, but the first character is used in upper case mode. % given label like \cs{Cref} would do. +If \CHDocPackage{hyperref} is not loaded, no link but only the reference text is displayed. +For the lower case version see \refCom{crtlnameref}. +\end{docCommand} + +\begin{docCommand}[doc new=\chdocextractversion{crossreftoolsversion0.6}] +{crtunameref*}{\marg{label name}} + +This generates a reference like \cs{nameref*} would do, but the first character is used in upper case mode -- no links are generated. +For the lower case version see \refCom{crtlnameref*}. +\end{docCommand} + + +\section{Convenience macros} + +In case \CHDocPackage{hyperref} shouldn't be loaded, \CHDocPackage{crossreftools} provides some convenience wrapper macros + +\begin{docCommand}[doc new=\chdocextractversion{crossreftoolsversion0.6}] +{crtnameref}{\marg{label name}} + +This generates a reference like \cs{nameref*} would do. +If \CHDocPackage{hyperref} is not loaded but \CHDocPackage{nameref} is used, no link is generated, so \refCom{crtnameref} acts like \refCom{crtnameref*} +For the unlinked version see \refCom{crtnameref*}. +\end{docCommand} + +\begin{docCommand}[doc new=\chdocextractversion{crossreftoolsversion0.6}] +{crtnameref*}{\marg{label name}} + +This generates a reference like \cs{nameref*} would do and does not generate a link. If neither \CHDocPackage{nameref} nor \CHDocPackage{hyperref} is used no output is generated from this macro. +For the linked version see \refCom{crtnameref}. +\end{docCommand} + \section{Placing more generic labels}\label{section::placing-generic-labels} @@ -760,7 +815,7 @@ This behaves like \refCom{crtcrossreflabel} but suppresses the output of the 2nd Sometimes it is necessary to check whether some label exists in order to refer to it. The macros \begin{itemize} - \item \refCom{crtrefifdefinedlabel} + \item \refCom{crtifdefinedlabel} \item \refCom{crtcrefifdefinedlabel} \end{itemize} @@ -769,17 +824,17 @@ check for the label existence and execute the relevant true or false conditions Those macros have related commands that revert the test, i.e. they check for the non-existence of a label: \begin{itemize} - \item \refCom{crtrefifundefinedlabel} + \item \refCom{crtifundefinedlabel} \item \refCom{crtcrefifundefinedlabel} \end{itemize} -\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.5}}]{crtrefifdefinedlabel}{\marg{label name}\marg{true branch}\marg{false branch}} +\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.5}}]{crtifdefinedlabel}{\marg{label name}\marg{true branch}\marg{false branch}} This checks whether the label 'label name' is defined and executes the true branch, otherwise the false branch. \end{docCommand} -\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.5}}]{crtrefifundefinedlabel}{\marg{label name}\marg{true branch}\marg{false branch}} +\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.5}}]{crtifundefinedlabel}{\marg{label name}\marg{true branch}\marg{false branch}} This checks whether the label 'label name' is undefined and executes the true branch, otherwise the false branch. \end{docCommand} @@ -916,14 +971,19 @@ By default, this macro expands to nothing, but can be redefined with \cs{renewco \begin{itemize}[itemsep=15pt] +\item \CHDocFullVersion{0.6} + \begin{itemize} + \item Corrected the typo in this manual about \refCom{crtifdefinedlabel} and \refCom{crtifundefinedlabel} + \item Added the macros \refCom{crtlnameref} and \refCom{crtunameref} for providing a lower and upper case version of the first character in a \cs{nameref} - like usage. + \item Provided the convenience wrappers \refCom{crtnameref} and \refCom{crtnameref*} in order to make code compilable if \CHDocPackage{hyperref} is not loaded. + \end{itemize} + \item \CHDocFullVersion{0.5} \begin{itemize} \item Added the \texttt{cleverefcompat} option. \item Changed the internal code of \refCom{crtcrefpage} which was necessary after the update of \CHDocPackage{cleveref} to version 0.21 \item Added some macros that check for label existence, see \cref{sec:checkinglabelexistence} about this. \end{itemize} -\item \CHDocFullVersion{0.3} - \item \CHDocFullVersion{0.4} \begin{itemize} diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf index 36b9f71283e..61285bac290 100644 Binary files a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf and b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf differ diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex index 69b1863d933..ef70976aa6b 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex +++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex @@ -1,4 +1,4 @@ -%% LaTeX package crossreftools - version 0.5 (2018/02/23 -- 13:46:13) +%% LaTeX package crossreftools - version 0.6 (2018/03/18 -- 16:34:57) %% Driver file for crossreftools.sty %% %% @@ -24,6 +24,7 @@ \usepackage{hyperref} +\usepackage{nameref} \usepackage[user]{zref} \usepackage{cleveref} @@ -107,13 +108,14 @@ See \crthyperCref{fooequationlabel} and \cref{pythagoreantheorem}. \chapter{Placing more generic labels} \clearpage -\crtcrossreflabel[Let us place a label without a counter]{Let us plant a label not being connected to a counter:}[somelabel] +\crtcrossreflabel[Let us place a label without a counter]{Let us plant a label not being connected to a counter:}[somelabel] and \crtcrossreflabel*{some visible text that is invisibly placed here}[invisiblelabel] + \clearpage -See \ref{somelabel} or \nameref{somelabel} on \cpageref{somelabel} +See \ref{somelabel} or \crtnameref{somelabel} on \cpageref{somelabel}, but \crtlnameref{somelabel}. \crtunameref{invisiblelabel} \chapter{This is foo}\label{foochapterlabel} diff --git a/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty b/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty index ea1e98c410a..cf89b6fbc97 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.5 (2018/02/23 -- 13:46:13) +%% LaTeX package crossreftools - version 0.6 (2018/03/18 -- 16:34:57) %% Source file for crossreftools.sty %% %% @@ -19,10 +19,10 @@ %% %% -\def\crossreftoolspackageversion{0.5} +\def\crossreftoolspackageversion{0.6} \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{crossreftools}[2018/02/23 - v\crossreftoolspackageversion] +\ProvidesPackage{crossreftools}[2018/03/18 - v\crossreftoolspackageversion] \newif\ifcrtfinal \newif\ifcleverefcompatmode @@ -309,9 +309,12 @@ } \newcommand{\crtrefcounter}[1]{% + \if@crt@hyperrefloaded \@ifundefined{r@#1}{\crt@refundefined}{% \expandafter\crt@split@anchor\expandafter{\csname r@#1\endcsname}% }% + \else + \fi } @@ -476,6 +479,105 @@ } +%%%% + +% First lower case and first uppercase support + + +\def\crt@first@up#1#2\relax{\uppercase{#1}#2}% +\def\crt@first@low#1#2\relax{\lowercase{#1}#2} + +\newcommand{\crt@firstupper}[1]{\expandafter\expandafter\expandafter\crt@first@up#1\relax}% +\newcommand{\crt@firstlower}[1]{\expandafter\expandafter\expandafter\crt@first@low#1\relax}% + +\def\crt@@lowercase@@splitter#1#2#3#4#5\@nil{% + \crt@firstlower{#3}% +} + +\def\crt@@uppercase@@splitter#1#2#3#4#5\@nil{% + \crt@firstupper{#3}% +} + + +\newcommand{\crt@lowercasesplitter}[1]{% + \expandafter\crt@@lowercase@@splitter#1\@nil% +} +\newcommand{\crt@uppercasesplitter}[1]{% + \expandafter\crt@@uppercase@@splitter#1\@nil% +} + + +\newcommand{\crtlnameref}{% + \@ifstar{\@crtlnameref@starred}{\@crtlnameref@unstarred} +} + +\newcommand{\@crtlnameref@starred}[1]{% + \crtifdefinedlabel{#1}{% + \expandafter\crt@lowercasesplitter\csname r@#1\endcsname% + }{}% +} + +\newcommand{\@crtlnameref@unstarred}[1]{% + \crtifdefinedlabel{#1}{% + \if@crt@hyperrefloaded + \hyperlink{\crtrefanchor{#1}}{\expandafter\crt@lowercasesplitter\csname r@#1\endcsname}% + \else + \@crtlnameref@starred{#1}% + \fi + }{}% +} + + + +\newcommand{\crtunameref}{% + \@ifstar{\@crtunameref@starred}{\@crtunameref@unstarred} +} + +\newcommand{\@crtunameref@starred}[1]{% + \crtifdefinedlabel{#1}{% + \expandafter\crt@uppercasesplitter\csname r@#1\endcsname% + }{}% +} + +\newcommand{\@crtunameref@unstarred}[1]{% + \crtifdefinedlabel{#1}{% + \if@crt@hyperrefloaded + \hyperlink{\crtrefanchor{#1}}{\expandafter\crt@uppercasesplitter\csname r@#1\endcsname}% + \else + \@crtunameref@starred{#1}% + \fi + }{}% +} + +%%%%% + +% Convenience wrappers + +\newcommand{\crtnameref}{% + \crt@nameref% +} + +\newcommand{\crt@nameref}{% + \@ifstar{\crt@nameref@starred}{\crt@nameref@unstarred} +} + +\newcommand{\crt@nameref@starred}[1]{% + \crtifdefinedlabel{#1}{% + \crtrefname{#1}% + }{} +} + +\newcommand{\crt@nameref@unstarred}[1]{% + \crtifdefinedlabel{#1}{% + \if@crt@hyperrefloaded + \hyperlink{\crtrefanchor{#1}}{\crtrefname{#1}}% + \else + \crt@nameref@starred{#1}% + \fi + }{}% +} + + %%%%%%%%%%%%%%%%% -- cgit v1.2.3