From 6701b05506a127ff463d499fb6b6badaf9055b2d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 29 Dec 2018 22:50:45 +0000 Subject: crossreftools (29dec18) git-svn-id: svn://tug.org/texlive/trunk@49530 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/crossreftools/README | 2 +- .../doc/latex/crossreftools/crossreftools_doc.pdf | Bin 241851 -> 246755 bytes .../doc/latex/crossreftools/crossreftools_doc.tex | 45 ++++++++++++++++++++- .../latex/crossreftools/crossreftools_driver.pdf | Bin 102837 -> 103189 bytes .../latex/crossreftools/crossreftools_driver.tex | 7 ++-- .../tex/latex/crossreftools/crossreftools.sty | 43 ++++++++++++++++---- 6 files changed, 83 insertions(+), 14 deletions(-) (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/crossreftools/README b/Master/texmf-dist/doc/latex/crossreftools/README index c1006ba1ee0..b15ae9a4358 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.6 (2018/03/18 -- 16:34:57) +%% LaTeX package crossreftools - version 0.8 (2018/12/29 -- 16:21:53) %% 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 9fa2342515d..70d982664ee 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 2f5f3908456..a57f5930725 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.6 (2018/03/18 -- 16:34:57) +%% LaTeX package crossreftools - version 0.8 (2018/12/29 -- 16:21:53) %% Documentation file for crossreftools.sty %% %% @@ -99,6 +99,10 @@ \@namedef{crossreftoolsversion0.6}{v0.6 2018-03-18} +\@namedef{crossreftoolsversion0.7}{v0.7 2018-12-28} + +\@namedef{crossreftoolsversion0.8}{v0.8 2018-12-29} + \newcommand{\authorname}{Autor} @@ -327,7 +331,7 @@ -\def\packageversion{0.6} +\def\packageversion{0.8} \def\hyperrefversionwithfifthargument{v6.85a} @@ -503,6 +507,17 @@ This command sets the output of \cs{crt@refundefined} in the same manner like th \end{docCommand} +Similar to \refCom{crtrefundefinedtext} is \refCom{crtcrefundefinedcountervalue}, providing an integer value in calculation contexts with \cs{ifnum} or \cs{setcounter}. + +\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtcrefundefinedcountervalue}{\marg{integer value}} + + +This command sets the output of \cs{crt@crefundefinedcountervalue} in the same manner like the standard macro \cs{title} would do for \cs{@title}. + +\begin{marker} + \refCom{crtcrefundefinedcountervalue} is a preamble-only macro. +\end{marker} +\end{docCommand} \section{Extracting information from regular labels}\label{section:extractingregularlabels} @@ -618,6 +633,15 @@ doc new={\chdocextractversion{crossreftoolsversion0.1}}]{crtcrefnumber}{\marg{la This extracts the counter value (or something that is stored by \cs{cref@currentlabel} belonging to a certain label name. \end{docCommand} +\begin{docCommand}[code={\CHDocExpCommand{}}, +doc new={\chdocextractversion{crossreftoolsversion0.8}}]{crtcrefcountervalue}{\marg{label name}} + +This extracts the counter value (or something that is stored by \cs{cref@currentlabel} belonging to a certain label name and can be used in any context that requrires integer values. + +If the label does not exist, the content of \cs{crt@crefundefinedcountervalue} is returned, which is by default a number, see \refCom{crtcrefundefinedcountervalue} in order how to set the return value. +\end{docCommand} + + \begin{docCommand}[code={\CHDocExpCommand{}}, doc new={\chdocextractversion{crossreftoolsversion0.1}}]{crtcrefresult}{\marg{label name}} @@ -967,10 +991,27 @@ By default, this macro expands to nothing, but can be redefined with \cs{renewco \clearpage \part{Meta information} + +\section{Acknowledgements} \label{section::acknowledgements} + +I would like to thank Javier Bezos to pointing me out to an issue with \refCom{crtcrefnumber} when being used as counter value extracting and inserting it again into \cs{setcounter} or any other occurence where a number value is expected. + +This issue is regarded fixed with \refCom{crtcrefcountervalue}. + + \section{Version history} \begin{itemize}[itemsep=15pt] + +\item \CHDocFullVersion{0.8} + + Added \refCom{crtcrefcountervalue}, see \cref{section::acknowledgements} for some explanation. + +\item \CHDocFullVersion{0.7} + + Corrected two typos in \refCom{crtcref} and \refCom{crtCref}, leading to wrong reports of reference numbers. + \item \CHDocFullVersion{0.6} \begin{itemize} \item Corrected the typo in this manual about \refCom{crtifdefinedlabel} and \refCom{crtifundefinedlabel} diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf index 61285bac290..389b86cd008 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 ef70976aa6b..d88457fa1a5 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.6 (2018/03/18 -- 16:34:57) +%% LaTeX package crossreftools - version 0.8 (2018/12/29 -- 16:21:53) %% Driver file for crossreftools.sty %% %% @@ -21,8 +21,6 @@ \documentclass{book} - - \usepackage{hyperref} \usepackage{nameref} \usepackage[user]{zref} @@ -57,6 +55,7 @@ Let us refer the usual way: \Cref{\labeltoshow} The counter for \fbox{\labeltoshow} is \foocntr\ or \crtcrefcounter{\labeltoshow}. It is used on page \crtcrefpage{\labeltoshow}. The value for the misspelled label name is \crtcrefnumber{labeltoshowstuff}, whereas the correct value is \crtcrefnumber{\labeltoshow}. +Let us check for a subsection label: \crtcrefcounter{foosubsectionlabel} The result is \fbox{\crtcrefresult{\labeltoshow}} @@ -123,6 +122,8 @@ See \ref{somelabel} or \crtnameref{somelabel} on \cpageref{somelabel}, but \crtl \setcounter{section}{5} \section{Foo}\label{foosectionlabel} \zlabel{foosectionlabel} +\subsection{Foo subsection} \label{foosubsectionlabel} + \begin{equation} E=mc^{2}\label{firstequationlabel} \end{equation} diff --git a/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty b/Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty index cf89b6fbc97..747946de523 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.6 (2018/03/18 -- 16:34:57) +%% LaTeX package crossreftools - version 0.8 (2018/12/29 -- 16:21:53) %% Source file for crossreftools.sty %% %% @@ -19,10 +19,10 @@ %% %% -\def\crossreftoolspackageversion{0.6} +\def\crossreftoolspackageversion{0.8} \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{crossreftools}[2018/03/18 - v\crossreftoolspackageversion] +\ProvidesPackage{crossreftools}[2018/12/29 - v\crossreftoolspackageversion] \newif\ifcrtfinal \newif\ifcleverefcompatmode @@ -39,7 +39,13 @@ \newcommand{\crtrefundefinedtext}[1]{\renewcommand{\crt@refundefined}{#1}} +\newcommand{\crt@crefundefinedcountervalue}{1977} +\newcommand{\crtcrefundefinedcountervalue}[1]{\renewcommand{\crt@refundefinedcountervalue}{#1}} + + + \@onlypreamble\crtrefundefined +\@onlypreamble\crtcrefundefinedcountervalue @@ -166,28 +172,49 @@ \@@crtextr@ct@cref{page}{#1}% } +%%%%%%%%%%%%%%%% +%%%% A macro that returns \crtcrefnumber - like the counter value if the label exists +%%%% otherwise some default value in order to be able to calculate with the return value +%%%% + + + +\newcommand{\crtcrefcountervalue}[1]{% + \crtcrefifundefinedlabel{#1}{% + \crt@crefundefinedcountervalue% + }{% + \crtcrefnumber{#1}% + }% +} + -%%%%% + +%%%%%%%%%%%%%%%% % Default cref format \newcommand{\crtcref}[1]{% - \expandafter\ifx\csname r@#1\endcsname\relax + \expandafter\ifx\csname r@#1@cref\endcsname\relax \crt@refundefined% \else - \crtcrefnamebylabel{#1} \crtcrefnumber{#1}% + \crtcrefnamebylabel{#1} \crtcrefreference{#1}% \fi } \newcommand{\crtCref}[1]{% - \expandafter\ifx\csname r@#1\endcsname\relax + \expandafter\ifx\csname r@#1@cref\endcsname\relax \crt@refundefined% \else - \crtCrefnamebylabel{#1} \crtcrefnumber{#1}% + \crtCrefnamebylabel{#1} %\crtcrefreference{#1}% \fi } +%%%%% + + +%%%%% + % refcount - like support -- cgit v1.2.3