diff options
author | Karl Berry <karl@freefriends.org> | 2017-03-05 21:39:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-03-05 21:39:46 +0000 |
commit | 80eb6890ed8748ee4e3da233c40143094c31c971 (patch) | |
tree | 57023688fe2bc5c84e2ca687959c4b14dd1050d4 /Master/texmf-dist/doc | |
parent | b285d50cc7e7b5dd13f1ba3f1859b9f6dc5abb02 (diff) |
xassoccnt (5mar17)
git-svn-id: svn://tug.org/texlive/trunk@43408 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc')
23 files changed, 322 insertions, 69 deletions
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/README b/Master/texmf-dist/doc/latex/xassoccnt/README index f31c3bbc79c..d19fd6cb79e 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/README +++ b/Master/texmf-dist/doc/latex/xassoccnt/README @@ -1,9 +1,9 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% README file for xassoccnt.sty %% %% %% ------------------------------------------------------------------------------------------- -%% Copyright (c) 2015 -- 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> +%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> %% ------------------------------------------------------------------------------------------- %% %% This work may be distributed and/or modified under the @@ -26,7 +26,7 @@ the associated counters as well. This package can be regarded as a supplement to the totcount package by Vasileios Koutavas (http://www.ctan.org/pkg/totcount), but can be used without it too. -As of 2017/03/04 xassoccnt does not supersede the package assoccnt by the same author, however, -the older package isn't declared obsolete as of 2017/03/04 +As of 2017/03/05 xassoccnt does not supersede the package assoccnt by the same author, however, +the older package isn't declared obsolete as of 2017/03/05 diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf Binary files differindex 690761aa73f..e9039a28add 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex index d693a185002..7f056dacc36 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_backupcounters_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file for backup counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf Binary files differindex 1fb2e41f82e..769838c75b7 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex index 825e748f578..68de4dc97aa 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_coupledcounters_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file for coupled counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf Binary files differindex e921a3a58fc..1a890e51dac 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex index 2ecf4cb802c..f2d7dfc8798 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_doc.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Documentation file for xassoccnt.sty %% %% @@ -99,6 +99,8 @@ \@namedef{xassoccntversion1.2}{v1.2 2017-03-03} +\@namedef{xassoccntversion1.3}{v1.3 2017-03-04} + \newcommand{\authorname}{Autor} @@ -382,7 +384,7 @@ pdfsubject={Documentation of \PackageDocName\ package}, pdfkeywords={LaTeX, counters}, bookmarksopen=true, - bookmarksopenlevel=4, + bookmarksopenlevel=2, bookmarksnumbered=true, pdfcreator={LaTeX} } @@ -390,7 +392,7 @@ \begin{document} -\mmddyyyydate +\yyyymmdddate \setlength{\parindent}{0em} @@ -401,7 +403,7 @@ \bfseries \node [concept] {Counters} child[concept color=red!30!yellow,grow=30] { node [concept] {Associated counters}} - child[grow=80,white,concept color=red!80!blue] { node [concept] {Backup \& Restore of counters}} + child[grow=85,white,concept color=red!80!blue] { node [concept] {Backup \& Restore of counters}} child[grow=300,concept color=yellow!90!red] { node [concept] {Extensions to \LaTeXe} child[grow=230,concept color={yellow!20!green}] {node [concept] {Query macros}} child[grow=290,concept color={yellow!30!cyan}] {node [concept] {Document counters}} } @@ -410,7 +412,8 @@ child[grow=170,concept color=red!30!yellow] { node [concept] {Total} child[concept color=yellow!30!,grow=150] {node[concept] {Super total counters}}} child[grow=260,concept color=red!30!green] { node [concept] {Loops on counters}} child[grow=200,concept color=red!30!green] { node [concept] {Counter output}} - child[grow=230,concept color=red!20!cyan] { node [concept] {Coupled counters} child [grow=250,concept color=cyan!50!blue] {node[concept] {Coupled counter groups}}}; + child[grow=230,concept color=red!20!cyan] { node [concept] {Coupled counters} child [grow=250,concept color=cyan!50!blue] {node[concept] {Coupled counter groups}}} + child[grow=57,concept color=red!20!yellow] { node [concept] {Label}}; \end{tikzpicture} \CHPackageTitlePage[packageauthor={Christian Hupfer}]{Associated counters stepping simultaneously\\ (and other gadgets)} @@ -791,7 +794,7 @@ The optional argument is not used as of version \packageversion\ for none of tho On occasions it might be important to have some information which counter has been changed last. Since there are four commands manipulating counter values, there are four corresponding routines for this: -\begin{docCommand}{LastAddedToCounter}{} +\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastAddedToCounter}{} This command has no arguments and expands to the name of the counter which was used last in \cs{addtocounter}. There is no further typesetting done with the countername. \begin{dispExample} @@ -808,18 +811,21 @@ This command has no arguments and expands to the name of the counter which was u \end{marker} -\begin{docCommand}{LastSteppedCounter}{} +\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastSteppedCounter}{} + This command has no arguments and expands to the name of the counter which was stepped last using \cs{stepcounter}. There is no further typesetting done with the countername. + \begin{dispExample} \stepcounter{SomeCounter} - The last counter being stepped was \LastSteppedCounter. \end{dispExample}% \end{docCommand}% -\begin{docCommand}{LastRefSteppedCounter}{} +\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastRefSteppedCounter}{} + +This macro gives the last counter being used in \cs{refstepcounter} and is expandable.%{\ChDocVersion{1.3}} \begin{dispExample} \begin{equation} @@ -830,13 +836,14 @@ This command has no arguments and expands to the name of the counter which was s The last counter being refstepped was \LastRefSteppedCounter. \end{dispExample}% + \end{docCommand}% -\begin{docCommand}{LastSetCounter}{} +\begin{docCommand}[before={\CHDocExpCommand\par\CHDocUpdate{1.3}}]{LastSetCounter}{} This command has no arguments and expands to the name of the counter which was set last using \cs{setcounter}. There is no further typesetting done with the countername. \begin{dispExample} @@ -986,6 +993,24 @@ This command displays the reset list of a counter on the terminal as the \cs{sho \end{docCommand} +\begin{docCommand}[before={\CHDocNew{1.3}}]{GetAllResetLists}{} + This determines all reset lists and stores the information internally. It should be called right before \cs{begin{document}} or at any time inside the document environment, when new counters are added there (which is not recommended) + +The information can be retrieved with \refCom{GetParentCounter}. + +\end{docCommand} + +\begin{docCommand}[before={\CHDocExpCommand\par\CHDocNew{1.3}}]{GetParentCounter}{\marg{counter}} +This macro tries to detect the counter that was responsible for the resetting of the counter named \marg{counter} and is expandable. +In order to minimize the amount of searching and maintaining expandability, the counter reset data must be stored beforehand, i.e. with \refCom{GetAllResetLists}. + +\begin{marker} +If a counter has been added to more than one parent counter as their resetting driver counter, only the most recent addition is in action. This may be correct in some occasions but there is no guarantee that the given counter name really caused the last reset of the counter given as argument. +\end{marker} +\end{docCommand} + + + \section[Loops on multiple counters]{Performing the same action for many counters} \CHDocNew{0.7} Sometimes it might be necessary to set the values of many counters at once. This can be done with consecutive \cs{setcounter} statements, for example. This poses no problem, but might become tedious if there are more than three counters or if this task occurs more than once. \CHDocPackage{\PackageDocName} provides some macros that can do the usual operations like stepping, refstepping, adding to, resetting or setting counter values. @@ -1495,51 +1520,6 @@ This commands tests, whether a given counter name is a driver counter and expand \end{docCommand}% -\subsection{Associated counters -- Experimental features}\label{subsec::associated_counters_experimental} -\begin{marker} -\marginnote{\bcbombe} -The content here is only of experimental nature and there is no guarantee that the feature will be maintained in future releases. -\end{marker} - -\begin{marker} -To enable the redefined \refCom{label} macro, specify the package option \refKey{redefinelabel} -\end{marker} - - - -\begin{docCommand}[before={\CHDocNew{1.2}}]{label}{\oarg{cleveref-counter-overrule}\marg{label name}\oarg{options for associated counters}} - \begin{docKey}{all}{=\meta{true,false}}{initially \meta{false}}\CHDocNew{1.2} - This will enable that all associated counters to a driver counter will cause the generation of a label too. By default this option is \meta{false}. - This option deliberately overrules \refKey{select}, the value of the option \refKey{prefix} is disregarded. - \end{docKey} - \begin{docKey}{select}{={counter1, counter2,\dots}}{initially empty}\CHDocNew{1.2} - Select only some of the associated counters to be able to be labeled. - As of version \packageversion{} there is no check whether the given names refer to counters at all or are associated counters to the last counter that has been used with \cs{refstepcounter}. - \end{docKey} - \begin{docKey}{prefix}{=\meta{text}}{initially empty}\CHDocNew{1.2} - This gives the prefix of the label of the associated counter. If the option \refKey{all} is enabled, the label name is generated from the name of the associated counter, the value of \refKey{prefix-sep} and the value of the 2nd argument. - \newcounter{morefoobar} - \begin{dispExample*}{listing only} - % Assume that some counter has the associated counters foobar, morefoobar and yetanotherfoobar - \label{foo}[prefix=assoc,all] - \end{dispExample*} - will cause a label named \texttt{foobar::foo}, \texttt{morefoobar::foo} and \texttt{yetanotherfoobar::foo}, whereas - \begin{dispExample*}{listing only} - \label{foo}[prefix=assoc,select=morefoobar] - \end{dispExample*} - would generate the label \texttt{assocc::foobar} only and will be tied to the value of the counter \texttt{morefoobar} - \end{docKey} - \begin{docKey}{prefix-sep}{=\meta{text}}{initially ::}\CHDocNew{1.2} - Defines the separator between the \refKey{prefix} and the label name for the driver counter, i.e. the 2nd argument of the \refCom{label} command. - \end{docKey} -\end{docCommand} - - -\begin{marker} -\marginnote{\bcbombe} -If the package option \refKey{redefinelabel} is set to \meta{false}, the usage of the third optional argument will leave spurious content at the position \cs{label} was used. The reason is that the content of third optional argument with \texttt{[]} is not recognized as an argument any longer. -\end{marker} - \section[Counter backup/restoration]{Backup and restore of counter values}\CHDocNew{1.0}\label{section::new_backuprestore} @@ -2281,7 +2261,99 @@ This macro checks if a counter is under the administration of the super total co This package adds a counter of its own: \CHDocCounter{numberofruns} which is a super total counter and is stepped each compilation run. It's added in \cs{AtBeginDocument} and can be retrieved with \refCom{TotalValue}. Use the \refKey{nonumberofruns} package option to prevent the definition of this counter. -\clearpage{ + +\section{Experimental features}\label{subsec::associated_counters_experimental} + + +\begin{marker} +\marginnote{\bcbombe} +The content here is only of experimental nature and there is no guarantee that the feature will be maintained in future releases. +\end{marker} + + +\subsection{Labels} + + + +\begin{marker} +To enable the redefined \refCom{label} macro, specify the package option \refKey{redefinelabel} +\end{marker} + + + +\begin{docCommand}[before={\CHDocNew{1.2}}]{label}{\oarg{cleveref-counter-overrule}\marg{label name}\oarg{options for associated counters}} + \begin{docKey}{all}{=\meta{true,false}}{initially \meta{false}}\CHDocNew{1.2} + This will enable that all associated counters to a driver counter will cause the generation of a label too. By default this option is \meta{false}. + This option deliberately overrules \refKey{select}, the value of the option \refKey{prefix} is disregarded. + \end{docKey} + \begin{docKey}{select}{={counter1, counter2,\dots}}{initially empty}\CHDocNew{1.2} + Select only some of the associated counters to be able to be labeled. + As of version \packageversion{} there is no check whether the given names refer to counters at all or are associated counters to the last counter that has been used with \cs{refstepcounter}. + \end{docKey} + \begin{docKey}{prefix}{=\meta{text}}{initially empty}\CHDocNew{1.2} + This gives the prefix of the label of the associated counter. If the option \refKey{all} is enabled, the label name is generated from the name of the associated counter, the value of \refKey{prefix-sep} and the value of the 2nd argument. + \newcounter{morefoobar} + \begin{dispExample*}{listing only} + % Assume that some counter has the associated counters foobar, morefoobar and yetanotherfoobar + \label{foo}[prefix=assoc,all] + \end{dispExample*} + will cause a label named \texttt{foobar::foo}, \texttt{morefoobar::foo} and \texttt{yetanotherfoobar::foo}, whereas + \begin{dispExample*}{listing only} + \label{foo}[prefix=assoc,select=morefoobar] + \end{dispExample*} + would generate the label \texttt{assocc::foobar} only and will be tied to the value of the counter \texttt{morefoobar} + \end{docKey} + \begin{docKey}{prefix-sep}{=\meta{text}}{initially ::}\CHDocNew{1.2} + Defines the separator between the \refKey{prefix} and the label name for the driver counter, i.e. the 2nd argument of the \refCom{label} command. + \end{docKey} +\end{docCommand} + + +\begin{marker} +\marginnote{\bcbombe} +If the package option \refKey{redefinelabel} is set to \meta{false}, the usage of the third optional argument will leave spurious content at the position \cs{label} was used. The reason is that the content of third optional argument with \texttt{[]} is not recognized as an argument any longer. +\end{marker} + + +\begin{docCommand}[before={\CHDocNew{1.3}}]{LaTeXLabel}{\oarg{cleveref-counter-overrule}\marg{label name}} + This is the default label macro, either with the \CHDocPackage{cleveref} extension or the classical \LaTeX2e\ macro (eventually modified by \CHDocPackage{hyperref}) and is not modified by this package. + + +The feature of label hooks from \refCom{RegisterPreLabelHook} or \refCom{RegisterPostLabelHook} is not used here. +\end{docCommand} + + +\subsection{Hooks} + + +This feature is experimental and only realized for the modified \refCom{label} command until now. See \nolinkurl{xassoccnt_getparentcounter_example.tex} as an example of usage. + +\begin{docCommand}[before={\CHDocNew{1.3}}]{RegisterPreLabelHook}{\marg{command name1, command name2,\dots}} + +This macro declares a possible list of hooks (commands) that should be executed \textbf{before} the traditional \cs{label} command is applied. If the hook name refers to some unknown macro, nothing is done. + +The hook names must be given with the \textbackslash as command sequence indicator, i.e. \cs{zlabel}, more than one macro name is possible by using comma as separator. + +As of version \packageversion\ the hook macro does not allow more than one argument, which is automatically used from the surrounding \cs{label} call and is the usual label name. + + +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{1.3}}]{RegisterPostLabelHook}{\marg{command name1, command name2,\dots}} + +This macro declares a possible list of hooks (commands) that should be executed after the traditional \cs{label} command is applied. If the hook name refers to some unknown macro, nothing is done. + +The hook names must be given with the \textbackslash as command sequence indicator, i.e. \cs{zlabel}, more than one macro name is possible by using comma as separator. + +As of version \packageversion\ the hook macro does not allow more than one argument, which is automatically used from the surrounding \cs{label} call and is the usual label name. + +\end{docCommand} + + + + + +\clearpage \part{Meta-Information} \parttoc @@ -2352,6 +2424,14 @@ write this documentation. \begin{itemize}[itemsep=15pt] +\item \CHDocFullVersion{1.3} +\begin{itemize} + \item Provided the \refCom{LaTeXLabel} macro to access the non-xassoccnt version of the \refCom{label} command. + \item \CHDocExperimentalFeature Added the concept of label hooks, see \cref{subsec::associated_counters_experimental} for more information. + \item The macros \cs{Last...} are defined with \CHDocPackage{expl3} methods. + \item Added \refCom{GetAllResetLists} and \refCom{GetParentCounter} for information on parent (or driver) counters. +\end{itemize} + \item \CHDocFullVersion{1.2} \begin{itemize} \item Corrected some typos in the manual. diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.pdf Binary files differindex 12b008b3ce7..40000678198 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex index 8cd63b0b31c..a7097a65c7c 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_driver_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Driver file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf Binary files differindex 173d3bc2dbd..43b6bd68345 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex index 88a1d1505b2..1fb419b065d 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf Binary files differnew file mode 100644 index 00000000000..137271c11c5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex new file mode 100644 index 00000000000..93f29e8db31 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex @@ -0,0 +1,152 @@ +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) +%% Example file for determing the parent counter of a counter and referring to it file for xassoccnt.sty +%% +%% +%% ------------------------------------------------------------------------------------------- +%% Copyright (c) 2017 by Dr. Christian Hupfer <typography dot with dot latex at gmail dot com> +%% ------------------------------------------------------------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% +%% This work has the LPPL maintenance status `author-maintained` +%% +%% + + +% Source was a question on TeX.SE by user gigabytes: http://tex.stackexchange.com/questions/353491/how-to-show-also-the-name-of-the-parent-counter-with-cleveref +% The provided answer by Christian Hupfer did not use xassoccnt but the features were incorporated in the package. + +\documentclass{book} +\usepackage{lipsum} +\usepackage{xassoccnt} +\usepackage{xpatch} +\usepackage{hyperref} +\usepackage[user,counter,hyperref]{zref} +\usepackage{cleveref} + +\makeatletter +\AtEndPreamble{ + \newif\if@hyperrefloaded + +\@ifpackageloaded{hyperref}{% + \@hyperrefloadedtrue +}{ + \@hyperrefloadedfalse +} +} +\makeatother + + + + +\usepackage{xparse} +\makeatletter + +\ExplSyntaxOn +\prop_new:N \g_latex_parentcounters_prop +\seq_new:N \g_latex_counters_seq + +\cs_generate_variant:Nn \str_head:n {x,o,V} +\cs_generate_variant:Nn \str_tail:n {x,o,V} +\cs_generate_variant:Nn \str_upper_case:n {x,o,V} +\cs_generate_variant:Nn \str_set:Nn {Nx,No} + +% Store all reset lists and make a property list for each counter and its possible parent counter + +% Make the first character of a word upper case +\newcommand{\FirstUpcase}[1]{% + \str_set:Nx \l_tmpa_str {#1}% + \str_upper_case:x {\str_head:N \l_tmpa_str}\str_tail:V {\l_tmpa_str}% +} + +\ExplSyntaxOff + + + + +% Define new properties +\zref@newprop{childcountervalue}{\arabic{\LastRefSteppedCounter}}% This is the naked value +\zref@newprop{parentcountervalue}{\csname the\GetParentCounter{\LastRefSteppedCounter}\endcsname} +\zref@newprop{parentcountername}{\GetParentCounter{\LastRefSteppedCounter}} + +% Add the new properties to the main property list stored with \zlabel +\zref@addprops{main}{childcountervalue,parentcountervalue,parentcountername} + +% Command for uppercase output +\NewDocumentCommand{\parentCref}{m}{% + \zref@ifrefundefined{#1}{% + \Cref{#1}% + }{% + \edef\@tmpb@{\zref@extract{#1}{parentcountervalue}}% + \edef\@tmpa@{\csname the\zref@extract{#1}{parentcountername}\endcsname}% + \ifx\@tmpb@\@tmpa@ + \Cref{#1}% + \else + \if@hyperrefloaded + \FirstUpcase{\zref@extract{#1}{counter}} \hyperlink{\zref@extract{#1}{anchor}}{\zref@extract{#1}{childcountervalue}} of \FirstUpcase{\zref@extract{#1}{parentcountername}} \hyperlink{\zref@extract{#1}{anchor}}{\zref@extract{#1}{parentcountervalue}}% + \else + \FirstUpcase{\zref@extract{#1}{counter}} \zref@extract{#1}{childcountervalue} of \FirstUpcase{\zref@extract{#1}{parentcountername}} \zref@extract{#1}{parentcountervalue}% + \fi + \fi + }% +} + +% Command for lowercase output +\NewDocumentCommand{\parentcref}{m}{% + \zref@ifrefundefined{#1}{% + \cref{#1}% + }{% + \edef\@tmpb@{\zref@extract{#1}{parentcountervalue}}% + \edef\@tmpa@{\csname the\zref@extract{#1}{parentcountername}\endcsname}% + \ifx\@tmpb@\@tmpa@ + \Cref{#1}% + \else + \if@hyperrefloaded + \zref@extract{#1}{counter} \hyperlink{\zref@extract{#1}{anchor}}{\zref@extract{#1}{childcountervalue}} of \zref@extract{#1}{parentcountername} \hyperlink{\zref@extract{#1}{anchor}}{\zref@extract{#1}{parentcountervalue}}% + \else + \zref@extract{#1}{counter} \zref@extract{#1}{childcountervalue} of \zref@extract{#1}{parentcountername} \zref@extract{#1}{parentcountervalue}% + \fi + \fi + }% +} + +\makeatother + + +\GetAllResetLists +\RegisterPostLabelHook{\zlabel} + + + +\begin{document} +\chapter{Chapter One} + Please look at \parentCref{othersection} or at \parentCref{foosubsection} or at \parentcref{foosubsection} + + + \section{Section One.One} + \label{mysection} + \lipsum + + \section{Section One.Two} + + \subsection{A subsection} \label{foosubsection} + Please ignore \parentCref{mysection}. + + \chapter{Chapter Two} + \section{Section Two.One} + + As you may have noticed, \parentCref{mysection} is useless. + + + \chapter{Chapter Three} + \section{Section Three.One} % + \section{Section Three.Two}\label{othersection} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.pdf Binary files differindex a729e13d57f..b35903e19a5 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex index 01d305561be..a3e2321d1f3 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_label_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file the the usage of labels with associated counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf Binary files differindex 9f2c3354fa2..4af97ba7c5c 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex index 164ad4f1e7d..827d72a1b9b 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_periodiccounters_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file for periodic counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf Binary files differindex 790e2515f55..8555d6a643b 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex index b480a43dd12..ff23de95e9c 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetlist_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file for reset list features file for xassoccnt.sty %% %% @@ -25,11 +25,14 @@ \usepackage{xassoccnt} +\DeclareDocumentCounter{dummyctra}[chapter] + \newcommand{\showfullresetlist}[1]{% \item Counter name: #1 \hfill \csname the#1\endcsname%\leavevmode% } \begin{document} +\tableofcontents \chapter{First} @@ -60,6 +63,7 @@ \AddToReset{section}{chapter} + \chapter{Third Chapter} \section{First section in 3rd chapter} @@ -71,5 +75,22 @@ \caption{Another dummy figure} \end{figure} +\GetAllResetLists + +\chapter[Parent counter of another counter]{Determing the parent counter of a counter} + +\section{Some dummy section} + +The last ref stepped counter is \LastRefSteppedCounter + +\fbox{\GetParentCounter{\LastRefSteppedCounter}} + +\AddToReset{dummyctra}{section} + +\GetAllResetLists +\noindent\GetParentCounter{dummyctra} + + + \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf Binary files differindex f52b8584ce6..044026ab36b 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex index c36c71f6969..be3ebae7ed7 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_suspendedcounters_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file for suspended counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf Binary files differindex 6e8c7a432d0..08576d9c494 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex index 9bb7b552ce8..e3a3f2cb29f 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_totalcounters_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.2 (2017/03/04 -- 00:46:43) +%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) %% Example file for total counters file for xassoccnt.sty %% %% |