texlive[46724] Master/texmf-dist: crossreftools (23feb18)
commits+karl at tug.org
commits+karl at tug.org
Fri Feb 23 23:07:41 CET 2018
Revision: 46724
http://tug.org/svn/texlive?view=revision&revision=46724
Author: karl
Date: 2018-02-23 23:07:41 +0100 (Fri, 23 Feb 2018)
Log Message:
-----------
crossreftools (23feb18)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/crossreftools/README
trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf
trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex
trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf
trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex
trunk/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty
Modified: trunk/Master/texmf-dist/doc/latex/crossreftools/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/crossreftools/README 2018-02-23 22:07:28 UTC (rev 46723)
+++ trunk/Master/texmf-dist/doc/latex/crossreftools/README 2018-02-23 22:07:41 UTC (rev 46724)
@@ -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
Modified: trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex 2018-02-23 22:07:28 UTC (rev 46723)
+++ trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex 2018-02-23 22:07:41 UTC (rev 46724)
@@ -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,8 +93,10 @@
\@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 @@
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 @@
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 @@
\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,7 +754,46 @@
\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}
For some reason it might be useful to have a list of all defined labels available. Currently, the support from \CHDocPackage{crossreftools} for this limited, however.
@@ -882,6 +916,15 @@
\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
Modified: trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex 2018-02-23 22:07:28 UTC (rev 46723)
+++ trunk/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex 2018-02-23 22:07:41 UTC (rev 46724)
@@ -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 @@
\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 @@
\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
Modified: trunk/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty 2018-02-23 22:07:28 UTC (rev 46723)
+++ trunk/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty 2018-02-23 22:07:41 UTC (rev 46724)
@@ -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 at cref@splitter at pageref{%
\@secondoftwo%
}
+\else
+\def\crt at cref@splitter at 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 at cref}{#3}{#2}%
+}
+
+\newcommand{\crtcrefifundefinedlabel}[3]{%
+ \@ifundefined{r@#1 at cref}{#2}{#3}%
+}
+
+
%%%%%%%%%%%%%%
More information about the tex-live-commits
mailing list