summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-12-26 22:07:36 +0000
committerKarl Berry <karl@freefriends.org>2017-12-26 22:07:36 +0000
commitab34d559eee3be0fcacb000229e72c45e2a56ad2 (patch)
treec6c44ee1c1aff2666c3f825a2359f37c5bb67f1f
parent700227e76504f7d34cad2c0c3bf6bbc7616f862a (diff)
crossreftools (26dec17)
git-svn-id: svn://tug.org/texlive/trunk@46142 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/crossreftools/README2
-rw-r--r--Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdfbin196192 -> 229067 bytes
-rw-r--r--Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex297
-rw-r--r--Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdfbin85058 -> 100690 bytes
-rw-r--r--Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex34
-rw-r--r--Master/texmf-dist/tex/latex/crossreftools/crossreftools.sty197
6 files changed, 490 insertions, 40 deletions
diff --git a/Master/texmf-dist/doc/latex/crossreftools/README b/Master/texmf-dist/doc/latex/crossreftools/README
index fd5fb45c6a5..cca2568b691 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.3 (2017/10/31 -- 08:23:52)
+%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15)
%% 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 22a83063e81..6c1b7c45c21 100644
--- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf
+++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_doc.tex
index b0f297be8f0..cb21cf87e31 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.3 (2017/10/31 -- 08:23:52)
+%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15)
%% Documentation file for crossreftools.sty
%%
%%
@@ -21,6 +21,16 @@
\documentclass[12pt,a4paper,oneside]{article}
+\usepackage[T1]{fontenc}
+\usepackage{graphicx}%
+
+
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{minitoc}
+\usepackage{tocbibind}
+
+
@@ -34,7 +44,6 @@
\usepackage[x11names]{xcolor}
\usepackage{imakeidx}
\usepackage{fontawesome}
-\usepackage[most,documentation]{tcolorbox}
\usepackage[tikz]{bclogo}
\usepackage{marginnote}
\usepackage{fancyhdr}
@@ -44,11 +53,14 @@
\usepackage{xparse}
\usepackage{totcount}
\usepackage{enumitem}
-\usepackage{microtype}
\usepackage{caption}
+\usepackage{microtype}
\usepackage[T1]{fontenc}
\usepackage[scaled=0.92]{helvet}
+\usepackage[most,documentation]{tcolorbox}
+
+
\newlist{codeoptionsenum}{enumerate}{1}
\setlist[codeoptionsenum,1]{label={\textcolor{blue}{\#\arabic*}}}
@@ -81,6 +93,8 @@
\@namedef{crossreftoolsversion0.3}{v0.3 2017-10-29}
+\@namedef{crossreftoolsversion0.4}{v0.4 2017-12-06}
+
\newcommand{\authorname}{Autor}
@@ -300,24 +314,16 @@
}
-\usepackage[T1]{fontenc}
-\usepackage{graphicx}%
-
-
-\usepackage{amsmath}
-\usepackage{amssymb}
-\usepackage{minitoc}
-\usepackage{tocbibind}
-
\usepackage{bookmark}
+
\usepackage{cleveref}
-\def\packageversion{0.3}
+\def\packageversion{0.4}
\def\hyperrefversionwithfifthargument{v6.85a}
@@ -358,6 +364,7 @@
}
+
\begin{document}
\yyyymmdddate
@@ -369,7 +376,7 @@
-\CHPackageTitlePage[packageauthor={Christian Hupfer}]{Expandable extraction of cleveref and other label data}
+\CHPackageTitlePage[packageauthor={Christian Hupfer}]{Expandable extraction of cleveref or cross reference data and label utilities}
\clearpage
@@ -379,6 +386,8 @@
\CHDocConventions
\clearpage
+\crtlistoflabels
+
\pagestyle{plain}
@@ -396,9 +405,10 @@ This package provides expandable extraction of information stored in labels gene
Whereas \CHDocPackage{cleveref} provides \cs{labelcref} and other commands or \cs{ref} from standard \LaTeX2e kernel none of those are expandable and can not be used in an \cs{edef} - approach.
\begin{marker}
-Most times class and package authors will benefit of this package, but there might be usual documents that need the features of |\PackageDocName|
+Most times class and package authors will benefit of this package, but there might be usual documents that need the features of \CHDocPackage{\PackageDocName}
\end{marker}
+All macros from this package use the prefix \cs{crt\dots}, eg \refCom{crtrefname}.
\section{Requirements, loading and incompatibilities}%
@@ -411,21 +421,54 @@ The package does not require features from Xe\LaTeX\ or Lua\LaTeX\ but can be ru
No packages are loaded by \CHDocPackage{crossreftools}, this package does neither load \CHDocPackage{hyperref} nor \CHDocPackage{cleveref} itself.
-\subsection{Loading of the package}
+\subsection{Loading of the package} \label{subsection::loadingofpackage}
Loading is done with
-\begin{tcblisting}{listing only}
-\usepackage[options]{crossreftools}
-\end{tcblisting}
+\begin{tcolorbox}
+\verb!\usepackage[options]{crossreftools}!
+\end{tcolorbox}
+
+As of version \packageversion\ \CHDocPackage{\PackageDocName} does have following option(s):
-As of version \packageversion\ \CHDocPackage{\PackageDocName} does not have options.
+\begin{itemize}
+ \item \texttt{draft}
+
+ By default, unless specified as package or class option, \CHDocPackage{\PackageDocName} works in draft mode, i.e. \CHDocTag{List of Labels} is enabled, see \crtcrefcounter{section::listoflabels} \nameref{section::listoflabels} for more on this.
+
+ \item \texttt{final}
-There is no loading order required. The macros expand to \makeatletter\fbox{\crt@refundefined}\makeatother\ if \CHDocPackage{cleveref} is not loaded.
+ 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.
+\end{itemize}
+
+
+
+
+There is no loading order required. The macros related to \CHDocPackage{cleveref} expand to \makeatletter\fbox{\crt@refundefined}\makeatother\ if \CHDocPackage{cleveref} is not loaded.
+
+\begin{marker}
+ In order to ensure that the changes to the cross referencing system introduced by \CHDocPackage{hyperref} and \CHDocPackage{cleveref} it is recommened to load \CHDocPackage{\PackageDocName} after both packages.
+\end{marker}
\subsection{Incompatibilities}\label{subsection:incompatibilities}
-As of \packageversion\ this package cannot be used with plain \TeX\
+\begin{itemize}
+ \item Plain \TeX:
+
+
+As of \packageversion\ this package cannot be used with plain \TeX, since there is no real built-in support for cross-referencing in plain \TeX.
+\item Issue with \cs{tcb@cs} from the \CHDocPackage{tcolorbox} and its \fbox{documentation} library regarding the \cs{crtlistoflabels} usage.
+
+ As of \packageversion\ this package cannot cope with labels produced from \CHDocPackage{tcolorbox} for documented code -- this inserts an unexpandable call of \cs{tcb@cs} in the label content which leaves unpleasant content in the List Of Labels (see \nameref{section::listoflabels}). As long as no other solution is available, \cs{tcb@cs} is redefined to gobble its argument only and doing nothing inside the \refCom{crtlistoflabels} macro.
+
+\begin{marker}
+ This is the cause for the special \cs{refCom} macro provided by the documentation library from \CHDocPackage{tcolorbox}.
+\end{marker}
+
+\item Similarly any unexpandable content written to the \CHDocFileExt{aux} - file by redefinitions of \cs{label} or \cs{@currentlabel} etc. will cause problems.
+\end{itemize}
\clearpage
@@ -433,6 +476,24 @@ As of \packageversion\ this package cannot be used with plain \TeX\
\parttoc
+\section{Indicating undefined references}
+
+\CHDocPackage{\PackageDocName} uses the content of the internal macro \cs{crt@refundefined} which defaults to \makeatletter\crt@refundefined\makeatother.
+Use \refCom{crtrefundefinedtext} to change the output of \cs{crt@refundefined}.
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtrefundefinedtext}{\marg{undefined reference indication text}}
+
+
+This command sets the output of \cs{crt@refundefined} in the same manner like the standard macro \cs{title} would do for \cs{@title}.
+
+\begin{marker}
+ \refCom{crtrefundefinedtext} is a preamble-only macro.
+\end{marker}
+\end{docCommand}
+
+
+
+
\section{Extracting information from regular labels}\label{section:extractingregularlabels}
Depending on loading of \CHDocPackage{hyperref} there is some more information (properties) stored with a \cs{label} command. Common properties are \texttt{reference} and \texttt{page}, additions of \CHDocPackage{hyperref} are \texttt{name}, \texttt{anchor} and the (yet) unused 5th argument of \cs{newlabel}, the property is called \texttt{unused} as of version \packageversion.
@@ -462,7 +523,7 @@ doc new={\chdocextractversion{crossreftoolsversion0.3}}]{crtrefnumber}{\marg{lab
This extracts the reference value (or something that is stored by \cs{@currentlabel} belonging to a certain label name.
\end{docCommand}
-With \CHDocPackage{hyperref} being loaded, following return non-empty label information, without \CHDocPackage{hyperref} they are available, but expand to nothing.
+With \CHDocPackage{hyperref} being loaded, following commands return non-empty label information, without \CHDocPackage{hyperref} they are available, but expand to nothing.
\begin{docCommand}[code={\CHDocExpCommand{}},
doc new={\chdocextractversion{crossreftoolsversion0.3}}]{crtrefname}{\marg{label name}}
@@ -482,15 +543,23 @@ doc new={\chdocextractversion{crossreftoolsversion0.3}}]{crtrefunused}{\marg{lab
This extracts the yet unused 5th argument of labels generated after \CHDocPackage{hyperref} is loaded. As of version \hyperrefversionwithfifthargument\ of \CHDocPackage{hyperref}, this argument has no meaning yet. If this is going to be change in future, \refCom{crtrefunused} will probably be removed and replaced by another macro that reflects the meaning of this 5th argument.
\end{docCommand}
+\begin{docCommand}[code={\CHDocExpCommand{}},
+doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtrefcounter}{\marg{label name}}
+
+This macro tries to extract the counter name related to the label assuming that the standard anchor type is used: \texttt{X.Y} where \texttt{X} stands for the counter name and \texttt{Y} is some alphanumerical value constructed from \cs{theHX}, e.g. \cs{theHchapter}. If this pattern fails, \refCom{crtrefcounter} will not compile.
+
+\end{docCommand}
\section{Extracting information from cleveref}
The \CHDocPackage{cleveref} package redefines the \cs{label} macro and stores another label with the same basic name and a suffix \string @cref, so
-\begin{tcblisting}{listing only}
-\label{foo}
-\end{tcblisting}
+\tcbinputlisting{breakable,listing only,listing file=labelstuff.tex}
+
+%\begin{tcblisting}{listing only}
+%\section{Stuff}
+%\end{tcblisting}
would generate both the labels \verb!foo! and \verb!foo@cref!. The \CHDocPackage{cleveref} - version of a label saves basically five properties to the \CHDocFileExt{.aux} - file.
@@ -516,8 +585,6 @@ would generate both the labels \verb!foo! and \verb!foo@cref!. The \CHDocPackage
This property stores the page number of the \cs{label} usage.
\end{itemize}
-
-\clearpage
\CHDocPackage{\PackageDocName} extracts those properties with \refCom{crtextractcref}.
\begin{docCommand}[code={\CHDocExpCommand{}},
@@ -637,7 +704,7 @@ This is a wrapper to the \cs{hyperlink} macro from \CHDocPackage{hyperref} to th
This generates a linked reference to a 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{crtcref}.
+For the upper case version see \refCom{crthyperCref}.
\end{docCommand}
\begin{docCommand}[doc new=\chdocextractversion{crossreftoolsversion0.3}]
@@ -645,11 +712,158 @@ For the upper case version see \refCom{crtcref}.
This generates a linked reference to a 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{crtcref}.
+For the lower case version see \refCom{crthypercref}.
+\end{docCommand}
+
+
+\section{Placing more generic labels}\label{section::placing-generic-labels}
+
+Sometimes it is necessary to refer to content that is not connected to a counter and \cs{refstepcounter}. In this case the macros \refCom{crtprovidecurrentlabel}, \refCom{crtprovidecurrentlabelname},
+
+\refCom{crtprovidecurrentlabelinfo} and \refCom{crtcrossreflabel} may be useful.
+
+\begin{marker}
+ None of the macros placing 'arbitrary' labels described in this section is expandable!
+\end{marker}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtprovidecurrentlabel}{\marg{usual label content}}
+This sets \cs{@currentlabel} which is later on stored to be the label content with \cs{label} and being displayed with the various variants of \cs{ref} or \cs{cref} etc. from \CHDocPackage{cleveref}.
+\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtprovidecurrentlabelname}{\marg{nameref label content}}
+This sets \cs{@currentlabelname} which is later on stored to be the label content with \cs{label} and being displayed with the various variants of \cs{nameref} from \CHDocPackage{hyperref}.
+\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtprovidecurrentlabelinfo}{\marg{usual label content}\marg{nameref label content}}
+This is a convenience macro in order to provide both \cs{@currentlabel} and \cs{@currentlabelname} at once. If \CHDocPackage{hyperref} is loaded, a \cs{phantomsection} call is used before calling
+
+\refCom{crtprovidecurrentlabel} and \refCom{crtprovidecurrentlabelname}.
+\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtcrossreflabel}{\oarg{nameref label content}\marg{usual label content}\oarg{label name}}
+
+This macro is an even more convenient wrapper for \refCom{crtprovidecurrentlabelinfo} by using the 2nd (mandatory) argument both for the usual label and the nameref label content if the 1st optional argument is not specified. This resembles the \cs{caption[]\textbraceleft\textbraceright} or e.g. \cs{section[]\textbraceleft\textbraceright} mechanism where the first optional argument is used for the ToC - related entries.
+
+The 2nd optional argument is placing the \cs{label} with the relevant label name.
+
+\begin{marker}
+ Please note that depending on the presence of the 1st optional argument either the 2nd or der 1st argument is displayed in the input stream, i.e. in the document text. If this is not requested, use the starred form \refCom{crtcrossreflabel*}.
+\end{marker}
+
+
+\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtcrossreflabel*}{\oarg{nameref label content}\marg{usual label content}\oarg{label name}}
+
+This behaves like \refCom{crtcrossreflabel} but suppresses the output of the 2nd or 1st argument explicitly. Use this to place hidden labels and anchors.
+\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.
+
+\begin{marker}
+ \CHDocPackage{crossreftools} redefines \cs{label} at the beginning of the document body. It takes care about a potential optional argument of \cs{label} as is introduced by \CHDocPackage{cleveref}.
+\end{marker}
+
+
+\subsection{Useful macros for the list of labels}
+
+
+
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtlistoflabels}{}
+This displays a list of all cross-reference labels in the order of their definition, the heading has the title \texttt{\listoflabelsname}, in order to change the title redefine \refCom{listoflabelsname}.
+
+An ordinary entry to the list - of - labels file (default extension \CHDocFileExt{lla}) is written with \cs{addcontentsline}
+
+\tcbinputlisting{breakable,listing only,listing file=addcontentslineforlistoflabels.tex}
+
+where \refCom{crt@listoflabelsfileextension} and \refCom{crt@listoflabelsstructurelevel} are internal versions of \refCom{crtlistoflabelsfileextension} and
+
+\refCom{crtlistoflabelsstructurelevel}.
+
+This command does add an entry into the table of contents (\CHDocFileExt{toc} - file) either on chapter or on section level, depending whether the class is \CHDocClass{book} or not.
+
+If no ToC - entry should be made, use \refCom{crtlistoflabels*}.
+
+\begin{marker}
+ If the package (or class) option \texttt{final} is enabled, the \CHDocTag{List of Labels} feature is disabled and \refCom{crtlistoflabels} expands to nothing.
+\end{marker}
+
+
+\end{docCommand}
+
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtlistoflabels*}{}
+This behaves like \refCom{crtlistoflabels} but does not generate an entry in the table of contents.
+
+\end{docCommand}
+
+
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtlistoflabelsfileextension}{\marg{extension}}
+
+This changes the extention of the list of labels file. The value is stored internally in
+
+ \refCom{crt@listoflabelsfileextension} which defaults to \texttt{lla}
+
+\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crt@listoflabelsfileextension}{}
+
+This holds the extension (without a dot in the name) of the list of labels file. Do not change this macro directly, but use \refCom{crtlistoflabelsfileextension} instead.
+
+\end{docCommand}
+
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{listoflabelsname}{}
+This is the title of the list of labels heading, it defaults to \texttt{\listoflabelsname}.
+
+It can be changed with \cs{renewcommand}.
+
\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtlistoflabelsstructurelevel}{\marg{counter name}}
+
+This changes the level of the label entries in the list of labels. The value is stored internally in \cs{crt@listoflabelsstructurelevel} which defaults to \texttt{section}
+
+\begin{marker}
+This is a preamble - only macro.
+\end{marker}
+\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crt@listoflabelsstructurelevel}{}
+
+This holds the structure level of the list of labels entries. Do not change this macro directly, but use \refCom{crtlistoflabelsstructurelevel} instead.
+
+\end{docCommand}
+
+
+\subsection{Useful macros for the label command}
+
+\CHDocPackage{crossreftools} provides two hook macros to be usable inside of the \cs{label} command
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtprelabelhook}{\marg{argument}}
+This hook is executed before the internally stored \cs{label} is called, the argument can be 'anything'.
+
+By default, this macro expands to nothing, but can be redefined with \cs{renewcommand}.
+
+\end{docCommand}
+
+\begin{docCommand}[doc new={\chdocextractversion{crossreftoolsversion0.4}}]{crtpostlabelhook}{\marg{argument}}
+This hook is executed after the internally stored \cs{label} is called, the argument can be 'anything'.
+
+By default, this macro expands to nothing, but can be redefined with \cs{renewcommand}.
+
+\end{docCommand}
+
+
\clearpage
\part{Examples}
@@ -659,14 +873,31 @@ For the lower case version see \refCom{crtcref}.
\tcbinputlisting{breakable,listing only,listing file=crossreftools_driver.tex}
+
+
+
\clearpage
+\part{Meta information}
\section{Version history}
\begin{itemize}[itemsep=15pt]
-\item \CHDocFullVersion{0.3} Added the extraction macros for regular labels (i.e. not the \CHDocPackage{cleveref} - related ones) and convenience wrappers for generating links.
-\item \CHDocFullVersion{0.2} Introduced a check in \refCom{crtcrefnamebylabel} and \refCom{crtCrefnamebylabel} whether given label exists
-\item \CHDocFullVersion{0.1} First version
+\item \CHDocFullVersion{0.4}
+ \begin{itemize}
+ \item Corrected typos in this documentation
+ \item Added the \CHDocTag{List of Labels} feature and the relevant macros from \cref{section::listoflabels}.
+ \item Added the \texttt{final} and \texttt{draft} package options.
+ \item Introduced more generic label content macros.
+\end{itemize}
+\item \CHDocFullVersion{0.3}
+
+Added the extraction macros for regular labels (i.e. not the \CHDocPackage{cleveref} - related ones) and convenience wrappers for generating links.
+\item \CHDocFullVersion{0.2}
+
+Introduced a check in \refCom{crtcrefnamebylabel} and \refCom{crtCrefnamebylabel} whether given label exists
+\item \CHDocFullVersion{0.1}
+
+First version
\end{itemize}
diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf
index ef7b8cf627a..214fa8e7445 100644
--- a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf
+++ b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex b/Master/texmf-dist/doc/latex/crossreftools/crossreftools_driver.tex
index 38c5858af4d..f4aa243eebc 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.3 (2017/10/31 -- 08:23:52)
+%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15)
%% Driver file for crossreftools.sty
%%
%%
@@ -36,10 +36,17 @@
\def\equationlabeltoshow{fooequationlabel}
+\crtlistoflabelsstructurelevel{section}
\begin{document}
+\tableofcontents
-\setcounter{chapter}{16}
+\crtlistoflabels*
+
+\clearpage
+
+\chapter{Some easy usages of crossreftools}
+%\setcounter{chapter}{16}% Just for checking
Let us refer the usual way: \Cref{\labeltoshow}
@@ -72,6 +79,7 @@ If the \fbox{hyperref} package is loaded, further properties are retrievable:
The 5th (and usually empty) label property introduced by hyperref is unused as of version v6.85a of that package -- \crtextractref{unused}{labelname} will return nothing here, i.e. the expansion is empty.
+This works only if there is usual hyper anchor for the counter: \crtrefcounter{fooequationlabel}.
\section{Extracting the cleveref names}
@@ -91,7 +99,20 @@ The 5th (and usually empty) label property introduced by hyperref is unused as o
The macro \verb!\crtextractcref! is expandable!\edef\counterof{\crtextractcref{counter}{\labeltoshow}} Using the stored value for counter: \counterof!
-See \crthyperCref{fooequationlabel}
+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]
+
+
+
+\clearpage
+
+See \ref{somelabel} or \nameref{somelabel} on \cpageref{somelabel}
\chapter{This is foo}\label{foochapterlabel}
@@ -107,4 +128,11 @@ See \crthyperCref{fooequationlabel}
E=mc^{2}\label{fooequationlabel}
\end{equation}
+
+\clearpage
+
+\section{Another foo bar section}
+\begin{equation}
+ a^{2} + b^{2}=c^{2}\label[section]{pythagoreantheorem}% Explicitly use a wrong counter type here for testing
+\end{equation}
\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 10ec71fb078..bacb9cfc8db 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.3 (2017/10/31 -- 08:23:52)
+%% LaTeX package crossreftools - version 0.4 (2017/12/26 -- 17:55:15)
%% Source file for crossreftools.sty
%%
%%
@@ -19,15 +19,24 @@
%%
%%
-\def\crossreftoolspackageversion{0.3}
+\def\crossreftoolspackageversion{0.4}
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{crossreftools}[2017/10/31 - v\crossreftoolspackageversion]
+\ProvidesPackage{crossreftools}[2017/12/26 - v\crossreftoolspackageversion]
+\newif\ifcrtfinal
+\DeclareOption{final}{\global\crtfinaltrue}
+\DeclareOption{draft}{\global\crtfinalfalse}
+
+\ProcessOptions*
% Some helper macros
+
\newcommand{\crt@refundefined}{[UNDEFINED]}
+\newcommand{\crtrefundefinedtext}[1]{\renewcommand{\crt@refundefined}{#1}}
+
+\@onlypreamble\crtrefundefined
% Splitters for cleveref
@@ -280,6 +289,21 @@
\@@crtextr@ct@ref{name}{#1}%
}
+%%%
+
+\def\crt@split@@@anchor#1.#2\@nil{#1}
+\def\crt@split@@anchor#1#2#3#4#5{\crt@split@@@anchor#4\@nil}
+\def\crt@split@anchor#1{%
+ \expandafter\crt@split@@anchor#1%
+}
+
+\newcommand{\crtrefcounter}[1]{%
+ \@ifundefined{r@#1}{\crt@refundefined}{%
+ \expandafter\crt@split@anchor\expandafter{\csname r@#1\endcsname}%
+ }%
+}
+
+
%%% Hyperref wrappers, not expandable.
@@ -299,6 +323,173 @@
\crthyperlink{\crtrefanchor{#1}}{\crtCref{#1}}%
}
+%%% Support for list of labels
+
+\providecommand*{\listoflabelsname}{List of labels}
+
+\@ifclassloaded{book}{
+ \providecommand*{\listoflabelstructurelevel}{%
+ chapter%
+ }
+}{%
+ \providecommand*{\listoflabelstructurelevel}{%
+ section%
+ }
+}
+
+
+\newcommand{\crt@listoflabelsfileextension}{lla}
+\newcommand{\crt@listoflabelsstructurelevel}{section}
+
+\newcommand{\crtlistoflabelsstructurelevel}[1]{%
+ \renewcommand{\crt@listoflabelsstructurelevel}{#1}%
+}
+
+\newcommand{\crtlistoflabelsfileextension}[1]{%
+ \renewcommand{\crt@listoflabelsfileextension}{#1}%
+}
+
+
+
+
+\newcommand{\crtlistoflabels@unstarred}{%
+ \addcontentsline{toc}{\listoflabelstructurelevel}{\listoflabelsname}%
+ \@crt@listofl@bels%
+}
+
+
+\newcommand{\crtlistoflabels@starred}{%
+ \@crt@listofl@bels%
+}
+
+
+\newcommand{\@crt@listofl@bels}{%
+ \begingroup
+ \makeatletter
+ % In case of loading tcolorbox documentation mode
+ \@ifundefined{tcb@cs}{}{% Redefine \tcb@cs to gobble its argument
+ \renewcommand{\tcb@cs}[1]{}%
+ }%
+ \@input{\jobname.\crt@listoflabelsfileextension}
+ \if@filesw
+ \expandafter\newwrite\csname tf@\crt@listoflabelsfileextension\endcsname
+ \immediate\openout \csname tf@\crt@listoflabelsfileextension\endcsname \jobname.\crt@listoflabelsfileextension\relax
+ \fi
+ \endgroup
+}
+
+
+
+\newcommand{\crtlistoflabels}{%
+ \ifcrtfinal
+ \else
+ \csname\listoflabelstructurelevel\endcsname*{\listoflabelsname\@mkboth{\MakeUppercase{\listoflabelsname}}{\MakeUppercase{\listoflabelsname}}}%
+ \@ifstar{\crtlistoflabels@starred}{\crtlistoflabels@unstarred}%
+ \fi
+}
+
+
+\newcommand{\crtaddlabeltotoc}[1]{%
+ \ifcrtfinal
+ \else
+ \addcontentsline{\crt@listoflabelsfileextension}{\crt@listoflabelsstructurelevel}{\protect\numberline{\expandafter\crtrefnumber{#1}}#1}%
+ \fi
+}
+
+
+\@onlypreamble{\crtlistoflabelsstructurelevel}
+
+\providecommand{\crtprelabelhook}[1]{}
+\providecommand{\crtpostlabelhook}[1]{}
+
+
+%%%%%%%%%%%%%% Support for generic labels
+
+
+
+\newcommand{\crtprovidecurrentlabelname}[1]{%
+ \protected@edef\@currentlabelname{#1}%
+}
+
+\newcommand{\crtprovidecurrentlabel}[1]{%
+ \protected@edef\@currentlabel{#1}%
+}
+
+\newcommand{\crtprovidecurrentlabelinfo}[2]{%
+ \if@crt@hyperrefloaded
+ \phantomsection%
+ \fi
+ \protected@edef\@currentlabel{#1}%
+ \protected@edef\@currentlabelname{#2}%
+}
+
+
+
+\def\crt@@genericl@belopt@rgi[#1]#2{%
+ \crtprovidecurrentlabelinfo{#2}{#1}%
+ #1%
+ \@ifnextchar[{\crt@@genericl@belopt@rgii}{}
+}
+
+
+\def\scrt@@genericl@belopt@rgi[#1]#2{%
+ \crtprovidecurrentlabelinfo{#2}{#1}%
+ \@ifnextchar[{\crt@@genericl@belopt@rgii}{}
+}
+
+
+\def\crt@@genericl@belopt@rgii[#1]{%
+ \label{#1}%
+}
+
+
+
+\def\crt@@genericl@belnoopt#1{%
+ \crtprovidecurrentlabelinfo{#1}{#1}%
+ #1%
+ \@ifnextchar[{\crt@@genericl@belopt@rgii}{}%
+}
+
+\def\scrt@@genericl@belnoopt#1{%
+ \crtprovidecurrentlabelinfo{#1}{#1}%
+ \@ifnextchar[{\crt@@genericl@belopt@rgii}{}%
+}
+
+
+\newcommand{\crtcrossreflabel}{%
+ \@ifstar{%
+ \@ifnextchar[{\scrt@@genericl@belopt@rgi}{\scrt@@genericl@belnoopt}%
+ }{%
+ \@ifnextchar[{\crt@@genericl@belopt@rgi}{\crt@@genericl@belnoopt}%
+ }%
+}
+
+%%%%%%%%%%%%%%
+
+
+
+\AtBeginDocument{%
+
+ \let\crt@l@bels@fe\label
+
+ \newcommand{\l@belwithopt@rg}[2][]{%
+ \crtprelabelhook{#2}%
+ \crt@l@bels@fe[#1]{#2}%
+ \crtaddlabeltotoc{#2}%
+ \crtpostlabelhook{#2}%
+ }
+ \newcommand{\l@belwithoutopt@rg}[1]{%
+ \crtprelabelhook{#1}%
+ \crt@l@bels@fe{#1}%
+ \crtaddlabeltotoc{#1}%
+ \crtpostlabelhook{#1}%
+ }
+
+ \renewcommand{\label}{%
+ \@ifnextchar[{\l@belwithopt@rg}{\l@belwithoutopt@rg}%
+ }
+}
\endinput
+