diff options
author | Karl Berry <karl@freefriends.org> | 2018-02-23 22:07:41 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-02-23 22:07:41 +0000 |
commit | a634832239bc23a946c5ce5d60c139981f3f141b (patch) | |
tree | 72941e0e0ebe9fd0f431641d9be171838c5a800c | |
parent | fc5c9edd95a17a5ca54c6a9c8d6a5348afa5f6e5 (diff) |
crossreftools (23feb18)
git-svn-id: svn://tug.org/texlive/trunk@46724 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/crossreftools/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf | bin | 229067 -> 236148 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex | 83 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf | bin | 100690 -> 102704 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex | 26 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty | 44 |
6 files changed, 128 insertions, 29 deletions
diff --git a/Master/texmf-dist/doc/latex/crossreftools/README b/Master/texmf-dist/doc/latex/crossreftools/README index cca2568b691..935fa9a310e 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/README +++ b/Master/texmf-dist/doc/latex/crossreftools/README @@ -1,9 +1,9 @@ -%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15) +%% LaTeX package crossreftools - version 0.5 (2018/02/23 -- 13:46:13) %% README file for crossreftools.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> +%% Copyright (c) 2017 -- 2018 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf Binary files differindex 6c1b7c45c21..65e8b07ec93 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf +++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex index cb21cf87e31..06b4159ed19 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex +++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex @@ -1,9 +1,9 @@ -%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15) +%% LaTeX package crossreftools - version 0.5 (2018/02/23 -- 13:46:13) %% Documentation file for crossreftools.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> +%% Copyright (c) 2017 -- 2018 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -93,7 +93,9 @@ \@namedef{crossreftoolsversion0.3}{v0.3 2017-10-29} -\@namedef{crossreftoolsversion0.4}{v0.4 2017-12-06} +\@namedef{crossreftoolsversion0.4}{v0.4 2017-12-26} + +\@namedef{crossreftoolsversion0.5}{v0.5 2018-02-23} \newcommand{\authorname}{Autor} @@ -323,7 +325,7 @@ -\def\packageversion{0.4} +\def\packageversion{0.5} \def\hyperrefversionwithfifthargument{v6.85a} @@ -441,6 +443,13 @@ As of version \packageversion\ \CHDocPackage{\PackageDocName} does have followin This disables the feature \CHDocTag{List of Labels}, see \crtcrefcounter{section::listoflabels} \nameref{section::listoflabels} for more information about this feature -- it is considered to be unnecessary having a List of Labels in a final version of document. By default, the package works in \texttt{draft} - mode, unless the class option \texttt{final} is specified already. In this case, the package option \texttt{final} can be omitted. +\item \texttt{cleverefcompat} + +Use this option if the \CHDocPackage{cleveref} version is older than 0.21. + +\begin{marker} +With the release of \CHDocPackage{cleveref} version 0.21 (dating to 2018/02/08) the format of stored information by \cs{label} changed and causes wrong output of \refCom{crtcrefpage}. Since version \makeatletter\@nameuse{crossreftoolsversion0.5}\makeatother\ this change is caught with \refCom{crtcrefpage}. +\end{marker} \end{itemize} @@ -510,10 +519,9 @@ This command will extract one of the properties \texttt{reference}, \texttt{page For convenience, there are shortcuts to extract a specific property: -\begin{docCommand}[code={\CHDocExpCommand{}}, -doc new={\chdocextractversion{crossreftoolsversion0.3}}]{crtcrefpage}{\marg{label name}} +\begin{docCommand}[code={\CHDocExpCommand{}},doc new and updated={\chdocextractversion{crossreftoolsversion0.3}}{\chdocextractversion{crossreftoolsversion0.5}},after=\par]{crtcrefpage}{\marg{label name}}% -This extracts the page number that would be printed by \cs{pageref}. + This extracts the page number that would be printed by \cs{cpageref}. \end{docCommand} @@ -621,19 +629,6 @@ This extracts the reference that would be printed by \cs{cref} or \cs{Cref}, wit \end{docCommand} \begin{docCommand}[code={\CHDocExpCommand{}}, -doc new={\chdocextractversion{crossreftoolsversion0.1}}]{crtcrefpage}{\marg{label name}} - -This extracts the page number that would be printed by \cs{pageref}. -\end{docCommand} - - -\section{Additional macros and utilities} - -\subsection{Expandable Commands} - -\CHDocPackage{\PackageDocName} provides some expandable helper macros in order to query the cross reference names that are stored with \cs{crefname} and \cs{Crefname} from \CHDocPackage{cleveref}. - -\begin{docCommand}[code={\CHDocExpCommand{}}, doc new={\chdocextractversion{crossreftoolsversion0.1}}]{crtcrefname}{\marg{counter name}} This extracts the lower case cross reference name of a given counter. @@ -759,6 +754,45 @@ This behaves like \refCom{crtcrossreflabel} but suppresses the output of the 2nd \end{docCommand} +\clearpage +\section{Checking for label existence}\label{sec:checkinglabelexistence} + +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{crtcrefifdefinedlabel} +\end{itemize} + +check for the label existence and execute the relevant true or false conditions for labels defined the usual \cs{label} macro and for their \CHDocPackage{cleveref} version. + +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{crtcrefifundefinedlabel} +\end{itemize} + + +\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.5}}]{crtrefifdefinedlabel}{\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}} +This checks whether the label 'label name' is undefined and executes the true branch, otherwise the false branch. +\end{docCommand} + +\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.5}}]{crtcrefifdefinedlabel}{\marg{label name}\marg{true branch}\marg{false branch}} +This checks whether the label 'label name' is defined by \CHDocPackage{cleveref} and executes the true branch, otherwise the false branch. +\end{docCommand} + + +\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.5}}]{crtcrefifundefinedlabel}{\marg{label name}\marg{true branch}\marg{false branch}} +This checks whether the label 'label name' is undefined by \CHDocPackage{cleveref} and executes the true branch, otherwise the false branch. +\end{docCommand} + + \section{Displaying label information}\label{section::listoflabels} @@ -882,6 +916,15 @@ By default, this macro expands to nothing, but can be redefined with \cs{renewco \begin{itemize}[itemsep=15pt] +\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} \item Corrected typos in this documentation diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf Binary files differindex 214fa8e7445..36b9f71283e 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf +++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex index f4aa243eebc..69b1863d933 100644 --- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex +++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex @@ -1,9 +1,9 @@ -%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15) +%% LaTeX package crossreftools - version 0.5 (2018/02/23 -- 13:46:13) %% Driver file for crossreftools.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> +%% Copyright (c) 2017 -- 2018 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -24,6 +24,7 @@ \usepackage{hyperref} +\usepackage[user]{zref} \usepackage{cleveref} \usepackage{crossreftools} @@ -118,7 +119,7 @@ See \ref{somelabel} or \nameref{somelabel} on \cpageref{somelabel} \chapter{This is foo}\label{foochapterlabel} \setcounter{section}{5} -\section{Foo}\label{foosectionlabel} +\section{Foo}\label{foosectionlabel} \zlabel{foosectionlabel} \begin{equation} E=mc^{2}\label{firstequationlabel} @@ -135,4 +136,23 @@ See \ref{somelabel} or \nameref{somelabel} on \cpageref{somelabel} \begin{equation} a^{2} + b^{2}=c^{2}\label[section]{pythagoreantheorem}% Explicitly use a wrong counter type here for testing \end{equation} + + +\chapter{Checking for label existence} + +\crtifdefinedlabel{firstfooequationlabel}{% + Yes, that label exists% +}{ + No, that label does not exist% +} + +\crtcrefifdefinedlabel{fooequationlabel}{% + Yes, that cleveref label exists% +}{ + No, that cleveref label does not exist% +} + + + + \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty b/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty index bacb9cfc8db..ea1e98c410a 100644 --- a/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty +++ b/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty @@ -1,9 +1,9 @@ -%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15) +%% LaTeX package crossreftools - version 0.5 (2018/02/23 -- 13:46:13) %% Source file for crossreftools.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> +%% Copyright (c) 2017 -- 2018 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -19,13 +19,16 @@ %% %% -\def\crossreftoolspackageversion{0.4} +\def\crossreftoolspackageversion{0.5} \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{crossreftools}[2017/12/26 - v\crossreftoolspackageversion] +\ProvidesPackage{crossreftools}[2018/02/23 - v\crossreftoolspackageversion] \newif\ifcrtfinal +\newif\ifcleverefcompatmode + \DeclareOption{final}{\global\crtfinaltrue} +\DeclareOption{cleverefcompat}{\global\cleverefcompatmodetrue} \DeclareOption{draft}{\global\crtfinalfalse} \ProcessOptions* @@ -38,6 +41,8 @@ \@onlypreamble\crtrefundefined + + % Splitters for cleveref \def\crt@@cref@@splitter@@first[#1][#2][#3]#4\@nil{% @@ -80,9 +85,15 @@ } +\ifcleverefcompatmode \def\crt@cref@splitter@pageref{% \@secondoftwo% } +\else +\def\crt@cref@splitter@pageref#1#2{% + \expandafter\crt@@cref@@splitter@@fourth#2\@nil% +} +\fi \newcommand{\crtcrefname}[1]{% @@ -464,6 +475,31 @@ }% } + + +%%%%%%%%%%%%%%%%% + +%%% Checking for existence of a label + + +\newcommand{\crtifdefinedlabel}[3]{% + \@ifundefined{r@#1}{#3}{#2}% +} + +\newcommand{\crtifundefinedlabel}[3]{% + \@ifundefined{r@#1}{#2}{#3}% +} + + +\newcommand{\crtcrefifdefinedlabel}[3]{% + \@ifundefined{r@#1@cref}{#3}{#2}% +} + +\newcommand{\crtcrefifundefinedlabel}[3]{% + \@ifundefined{r@#1@cref}{#2}{#3}% +} + + %%%%%%%%%%%%%% |