diff options
32 files changed, 1403 insertions, 109 deletions
diff --git a/Master/texmf-dist/doc/latex/xassoccnt/README b/Master/texmf-dist/doc/latex/xassoccnt/README index d19fd6cb79e..01b38030c05 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/README +++ b/Master/texmf-dist/doc/latex/xassoccnt/README @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% README file for xassoccnt.sty %% %% @@ -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/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 +As of 2017/04/30 xassoccnt does not supersede the package assoccnt by the same author, however, +the older package isn't declared obsolete as of 2017/04/30 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 e9039a28add..51ac66915f3 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 7f056dacc36..a0985eaf549 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Example file for backup counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counterformats_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counterformats_example.pdf Binary files differnew file mode 100644 index 00000000000..4ae6bb6332b --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counterformats_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counterformats_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counterformats_example.tex new file mode 100644 index 00000000000..c611aafa290 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counterformats_example.tex @@ -0,0 +1,64 @@ +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) +%% Example file for defining new counter formats 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` +%% +%% + +\documentclass{article} + +\newcounter{foobar} + + +\usepackage{xassoccnt} + + +\begin{document} + + +%\RemoveCounterFormats{b} + + +\setcounter{foobar}{17} + +\CounterFormat{foobar!b} +\thefoobar + +\CounterFormat{foobar!h} +\thefoobar + + +\CounterFormat{foobar!H} +\thefoobar + +\CounterFormat{foobar!R} +\thefoobar + +\setcounter{foobar}{30} + +\CounterFormat{foobar!aa} +\thefoobar + +\CounterFormat{foobar!o} +\thefoobar + +\CounterFormat{foobar!AA} +\thefoobar + +\end{document} + + diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counternames_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counternames_example.pdf Binary files differnew file mode 100644 index 00000000000..ba5e7895ae1 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counternames_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counternames_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counternames_example.tex new file mode 100644 index 00000000000..1497911f367 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_counternames_example.tex @@ -0,0 +1,45 @@ +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) +%% Example file the the usage of counter names 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` +%% +%% + +\documentclass{book} + +\usepackage[utf8]{inputenc} +\usepackage{xassoccnt} + +\DeclareDocumentCounter[map-name=german,counter-name={Müller}]{foo} + +\DeclareLanguageMappings{german}{part;;;;;;Teil;;Teile , chapter;;Kapitel, section;;Abschnitt, subsection;;Unterabschnitt, subsubsection;;Unterabschnitt, paragraph;;Parragraph, subparagraph;; Unterparagraph;; figure;;Abbildung, table;;Tabelle, page;;Seite, equation;;Gleichung } + +\begin{document} + +\ExplSyntaxOn + \typeout{Mapname~is~\prop_item:Nn \g_xassoccnt_module_data_prop {map-name},~counter-name~is~\prop_item:Nn \g_xassoccnt_module_data_prop {counter-name}} +\ExplSyntaxOff +\setcounter{foo}{17} + +\ShowLanguageMappings{german} + +\RetrieveCounterSingularName{german}{chapter} + + + + +\end{document} 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 769838c75b7..dab1b60688b 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 68de4dc97aa..1a19d03cb98 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% 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 1a890e51dac..50697c37a5a 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 f2d7dfc8798..9734efed27b 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Documentation file for xassoccnt.sty %% %% @@ -101,6 +101,8 @@ \@namedef{xassoccntversion1.3}{v1.3 2017-03-04} +\@namedef{xassoccntversion1.4}{v1.4 2017-04-07} + \newcommand{\authorname}{Autor} @@ -321,6 +323,7 @@ } +\usepackage[T1]{fontenc} \usepackage{graphicx}% \usepackage[autodefinecounters=true]{xassoccnt} \usepackage{amsmath} @@ -352,6 +355,7 @@ \renewcommand{\rmdefault}{\sfdefault} +\newcounter{foobar} \newtotcounter{totalpages}% \newtotcounter{anothertotalpages}% @@ -374,7 +378,7 @@ \DeclareAssociatedCounters{proof}{totalproofs} \DeclareAssociatedCounters{page}{totalpages,anothertotalpages}% -\NewTotalDocumentCounter{foototal}% +\DeclareTotalDocumentCounter{foototal}% \RegisterTotalDocumentCounter{section}% @@ -562,7 +566,9 @@ As of version \packageversion\ \CHDocPackage{\PackageDocName} supports the packa Enables the redefinition of the \refCom{label} command and takes care of the optional argument of \refCom{label} if \CHDocPackage{cleveref} is used. This will provide \refCom{label} with a final optional argument that can be used to allow labels for associated counters (either all or only a specified list of counters), for more on this see \refCom{label} in \namecref{subsec::associated_counters_experimental} \nameref{subsec::associated_counters_experimental}. \end{docKey} - +\begin{docKey}{standardcounterformats}{=\meta{choice=on/off}}{initially \meta{on}}\CHDocNew{1.4} +This key enables (\meta{on}) or disables (\meta{off}) the definition of the standard counter formats to be used in the macro \refCom{CounterFormat}. +\end{docKey} \clearpage \part{Tools for counters} @@ -903,23 +909,36 @@ The package \CHDocPackage{chngcntr} offers the possibility of add or remove coun \subsection[Addition and Removal]{Addition and Removal of counters from the reset list}\CHDocNew{1.0} -\begin{docCommand}[before={\CHDocNew{1.0}}\par]{RemoveFromReset}{\marg{counter name}\marg{driver counter name}} -This macro removes the counter given in the first argument from the reset list of the driver counter given in the 2nd argument. +\begin{docCommand}[before={\CHDocNew{1.0}\CHDocUpdate{1.4}}\par]{RemoveFromReset}{\marg{counter name1, counter name2,\dots}\marg{driver counter name}} +This macro removes the counters given in the comma separated list in the first argument from the reset list of the driver counter given in the 2nd argument. If the 2nd argument does not point to a \LaTeXe\ counter name an error message is shipped and the compilation fails. \end{docCommand} -\begin{docCommand}[before={\CHDocNew{1.0}}]{RemoveFromFullReset}{\marg{counter name}\marg{driver counter name}} -This macro removes the counter given in the first argument and all of its own reset list from the reset list of the driver counter given in the 2nd argument. +\begin{docCommand}[before={\CHDocNew{1.0},\CHDocUpdate{1.4}}\par]{RemoveFromFullReset}{\marg{counter name1, counter name2,\dots}\marg{driver counter name}} +This macro removes the counters given in the comma separated list in the first argument and all of its own reset list from the reset list of the driver counter given in the 2nd argument. If the 2nd argument does not point to a \LaTeXe\ counter name an error message is shipped and the compilation fails. \end{docCommand} -\begin{docCommand}[before={\CHDocNew{1.0}}]{AddToReset}{\marg{counter name}\marg{driver counter name}} -This macro adds the counter given in the first argument to the reset list of the driver counter given in the 2nd argument. +\begin{docCommand}[before={\CHDocNew{1.4}}]{ClearCounterResetList}{\marg{driver counter name}} +This macro removes all counters of the given driver counter reset list. The individual counter formatting macros \cs{theX} are reset both for the driver counter as well as the counters in the reset list to use the \cs{arabic} standard output macro. \texttt{X} means some arbitray \LaTeX2e\ counter name. + +If the resetting shall not be applied, use \refCom{ClearCounterResetList*} instead. +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{1.4}}]{ClearCounterResetList*}{\marg{driver counter name}} + This behaves like \refCom{ClearCounterResetList} but does \textbf{not} reset the relevant \cs{theX} macros. +\end{docCommand} + + +\begin{docCommand}[before={\CHDocNew{1.0}\CHDocUpdate{1.4}}]{AddToReset}{\marg{counter name1, counter name2,\dots}\marg{driver counter name}} +This macro adds the counters given in the comma separated list in the first argument to the reset list of the driver counter given in the 2nd argument. If the 2nd argument does not point to a \LaTeXe\ counter name an error message is shipped and the compilation fails. + +An accidental specificiation of the driver counter to be added to its own reset list is ignored internally. \end{docCommand} @@ -1139,6 +1158,14 @@ The 2nd argument value should hold a macro with any number of arguments, but the \end{dispExample} +\begin{docCommand}[before={\CHDocNew{1.4}}\par]{LoopCounterResetList}{\marg{counter name}\marg{counter operation macro}} +This macro will perform the same action on the reset list of a the counter name given as first argument, the action is a control sequence name specified by the in the second mandatory argument. The loop provides all counters on the reset list of a counter. + +As of version \packageversion\ the counter operation macro must have two mandatory arguments, the second one is meant for the current counter in the loop. + +Do not confuse this command with \refCom{LoopFullCounterResetList} which tracks all counters recursively on the reset list, so \refCom{LoopCounterResetList} steeps only level down in the reset list hierarchy. +\end{docCommand} + \begin{docCommand}[before={\CHDocNew{1.0}}\par]{LoopFullCounterResetList}{\marg{counter name}\marg{counter operation macro}} This macro determines the full reset list of a counter, i.e. it cascades down the reset list and tracks the reset lists of all 'sub'-counters too and performs the counter operation macro on this. \begin{codeoptionsenum} @@ -1154,14 +1181,63 @@ See the macro \refCom{CounterFullResetList} for more information about the inter \end{docCommand} + +\begin{docCommand}[before={\CHDocNew{1.4}}\par]{CounterWithin}{\marg{counter nameA, counter nameB,\dots}\marg{drivercounter}} + This macro sets all counters nameA, nameB, \dots to the reset list of the \marg{drivercounter} and redefines the corresponding macros \cs{thenameA}, etc. to be prepended with \cs{thedrivercounter}, i.e. \verb!\CounterWithin{equation}{section}! would mean that \verb!\theequation! expands to \verb!\thesection.\arabic{section}! + + The default format for the counter output is arabic numbers, i.e. \cs{arabic} will be used. + +If the macros \cs{thenameA} etc. should not be changed, use the starred version of this command: \refCom{CounterWithin*}. + + \begin{marker} + Please note that the redefinition of \cs{thenameA} etc. is only local, i.e. it is group safe. + \end{marker} +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{1.4}}\par]{CounterWithin*}{\marg{counter nameA, counter nameB,\dots}\marg{drivercounter}} + This macro sets all counters nameA, nameB, \dots to the reset list of the \marg{drivercounter}, but does not change the corresponding macros \cs{thenameA}, etc. at all. + + The default format for the counter output is arabic numbers, i.e. \cs{arabic} will be used. + + If the macros \cs{thenameA} etc. should be changed, use non-starred version of this command: \refCom{CounterWithin}. + +\end{docCommand} + + +\begin{docCommand}[before={\CHDocNew{1.4}}\par]{CounterWithout}{\marg{counter nameA, counter nameB,\dots}\marg{drivercounter}} + This macro removes all counters nameA, nameB, \dots from the reset list of the \marg{drivercounter} and redefines the corresponding macros \cs{thenameA}, etc. without \cs{thedrivercounter}, i.e. \verb!\CounterWithout{equation}{section}! would mean that \verb!\theequation! expand to \verb!\arabic{section! + + The default format for the counter output is arabic numbers, i.e. \cs{arabic} will be used. + + If the macros \cs{thenameA} etc. should not be changed, use the starred version of this command: \refCom{CounterWithout*}. + + \begin{marker} + Please note that the redefinition of \cs{thenameA} etc. is only local, i.e. it is group safe. + \end{marker} + +\end{docCommand} + +\begin{docCommand}[before={\CHDocNew{1.4}}\par]{CounterWithout*}{\marg{counter nameA, counter nameB,\dots}\marg{drivercounter}} + This macro removes all counters nameA, nameB, \dots from the reset list of the \marg{drivercounter}, but does not redefine the corresponding macros \cs{thenameA}, etc. + + If the macros \cs{thenameA} etc. should be changed, use the non-starred version of this command: \refCom{CounterWithout}. +\end{docCommand} + + + + + \section{Counter output}\CHDocNew{0.7} -Once in a while it might be necessary to provide counter output not only as integer numbers, letters or Roman figures but also using binary, octal or hexdecimal number output. The \CHDocPackage{fmtcount} package has support for this already -- here are some alternatives +Once in a while it might be necessary to provide counter output not only as integer numbers, letters or Roman figures but also using binary, octal or hexdecimal number output. The \CHDocPackage{fmtcount} package has support for this already -- here are some alternatives. + +\subsection{Extra counter output types} + \begin{marker} None of the commands checks whether the argument refers to counter name. \end{marker} -\begin{docCommand}[doc new={\chdocextractversion{xassoccntversion0.7}}]{BinaryValue}{\marg{counter name}}% \CHDocNew{0.7} +\begin{docCommand}[doc new={\chdocextractversion{xassoccntversion0.7}}]{BinaryValue}{\marg{counter name}} This command will print the value of the counter using binary digits. @@ -1186,6 +1262,162 @@ This command will print the value of the counter using octal digits. \end{docCommand} +\begin{docCommand}{xalphalph}{\marg{counter name}}\CHDocNew{1.4} +This is allows to use more than 26 characters for the usual alphabet and prints the counter value with style \texttt{aa} etc. in the same manner as the \CHDocPackage{alphalph} does, but with the \cs{int\_to\_alph:n} macro from the \CHDocPackage{expl3} bundle. For usage with uppercase characters see \refCom{xAlphAlph}. +\end{docCommand} + +\begin{docCommand}{xAlphAlph}{\marg{counter name}}\CHDocNew{1.4} +This is allows to use more than 26 characters for the usual alphabet and prints the counter value with style \texttt{AA} etc. in the same manner as the \CHDocPackage{alphalph} does, but with the \cs{int\_to\_Alph:n} macro from the \CHDocPackage{expl3} bundle. For usage with uppercase characters see \refCom{xalphalph}. +\end{docCommand} + +\subsection{Quick counter output changes}\CHDocNew{1.4} + + +\begin{docCommand}{CounterFormat}{\oarg{options}\marg{counter1!formatname1,counter2!formatname2,\dots }}\CHDocNew{1.4} + +\begin{marker} + This macro needs the package option \refKey{standardcounterformats} to be activated with \meta{standardcounterformats=on}, which is the default. +\end{marker} + +\begin{codeoptionsenum} +\item \oarg{options} + \begin{docKey}[][]{recursive}{=\meta{true/false}}{default: false} + If this key is set, the same counter format is used for the relevant counter and its resetting counters, i.e. the macro will pursue the reset counter list chain and recursively adds \cs{the...} to the output format of \cs{thenameA} etc. + \begin{marker} + Since the \meta{recursive} option needs information on the parent counters, the macro \refCom{GetAllResetLists} must have been called before \refCom{CounterFormat} with this option can be applied. In order to provide the most recent information (which includes recently added counters or changed resetting levels), use \refCom{GetAllResetLists} just before \refCom{CounterFormat}. + \end{marker} + \end{docKey} + \begin{docKey}[][]{separator}{=\meta{separator character/string}}{default: !} + Specifies the separator that is used to split the counter name from the format, e.g. \meta{chapter!R} where \meta{chapter} is the counter name and \meta{R} will be recognized as a counter format, meaning \cs{Roman} here, see \cref{table--predefined-counter-formats} for a list of predefined counter formats. + + \begin{marker} + The chosen separator must be the same for all counters in the given list of the 2nd argument (see below) and mustn't occur in the counter name itself\footnote{It is not recommended to use counter names with non alphabetic characters anyway.}. + \end{marker} + \end{docKey} + \item \marg{counter1!formatname1,counter2!formatname2,\dots} + A comma separated list of counters with a given format name, each separated with a separator charactor, default is \meta{!}. If the format is omitted, the default format is \cs{arabic}, i.e. arabic numbers are used. + \end{codeoptionsenum} + +\end{docCommand} + +\begin{table}[htpb] +Currently following counter formats shorthands and their output macros are stored in \cs{AtBeginDocument} if the package option \refKey{standardcounterformats} is set to on, which is the default behaviour of the package. + +\centering +\begin{tabular}{ll} + a & \cs{alph} \tabularnewline + A & \cs{Alph} \tabularnewline + aa & \refCom{xalphalph} \tabularnewline + AA & \refCom{xAlphAlph} \tabularnewline + b & \refCom{BinaryValue} \tabularnewline + h & \refCom{hexValue} \tabularnewline + H & \refCom{HexValue} \tabularnewline + n & \cs{arabic} \tabularnewline + o & \refCom{OctalValue} \tabularnewline + r & \cs{roman} \tabularnewline + R & \cs{Roman} \tabularnewline +\end{tabular} +\caption[List of predefined counter formats]{List of predefined counter format shorthands -- please note that \meta{n} has been used in order to allow \meta{a} to be used for output with lowercase characters.}\label{table--predefined-counter-formats} +\end{table} + +\begin{dispExample*}{title=Simple usages of \refCom{CounterFormat},breakable} +% Assume foobar is a defined counter +\setcounter{foobar}{17} + +\CounterFormat{foobar!b} +\thefoobar + +\CounterFormat{foobar!h} +\thefoobar + + +\CounterFormat{foobar!H} +\thefoobar + +\CounterFormat{foobar!R} +\thefoobar + +\setcounter{foobar}{30} + +\CounterFormat{foobar!aa} +\thefoobar + +\CounterFormat{foobar!o} +\thefoobar + +\CounterFormat{foobar!AA} +\thefoobar + + +\end{dispExample*} + +\begin{dispExample*}{title={Showing the \meta{recursive} option of \refCom{CounterFormat}},breakable} +% All counters are using \arabic by default from \newcounter or \NewDocumentCounter +\NewDocumentCounter{foolevelzero} +\NewDocumentCounter{foolevelone}[foolevelzero] +\NewDocumentCounter{fooleveltwo}[foolevelone] + +% Get the current reset lists! (Important} + +\GetAllResetLists + +% Now change to Hex format (!H) for all counters in the hierarchy. +\CounterFormat[recursive]{fooleveltwo!H} + +\setcounter{foolevelzero}{20}% Should be 14 +\setcounter{foolevelone}{15}% Should be F +\setcounter{fooleveltwo}{10}% Should be A + +\thefoolevelzero % -> 14 + +\thefoolevelone % 14.F + +\thefooleveltwo % 14.F.A + +\end{dispExample*} + + +\begin{docCommand}{StoreCounterFormats}{\oarg{options}\marg{formatshorthandA!formatmacroA,formatshorthandB!formatmacroB,\dots}}\CHDocNew{1.4} + Stores the counter formats separated by the separator charactor as given in the option to the global list. Existing formats will be overwritten if the format shorthand already exists. There is no warning about this! + The only handled option is \refKey{separator} and has the same meaning as in \refCom{CounterFormat}. + + The formatmacro must be a command sequence with exactly one mandatory argument, which may not be specified in the format storage process. + +\begin{marker} + This macro will become a preamble-only command most likely. +\end{marker} +\end{docCommand} + +\begin{dispExample} + \StoreCounterFormats{foo!\Roman,foobarnice!\OctalValue} + \setcounter{foobar}{17} + \CounterFormat{foobar!foo} + \thefoobar + + \CounterFormat{foobar!foobarnice} + \thefoobar +\end{dispExample} + + + + +\begin{docCommand}{AddCounterFormats}{\oarg{options}\marg{formatshorthandA!formatmacroA,formatshorthandB!formatmacroB,\dots}}\CHDocNew{1.4} + Adds the counter formats separated by the separator charactor as given in the option to the global list, similar to \refCom{StoreCounterFormats}. Existing formats will be overwritten if the format shorthand already exists. There is no warning about this! + The only handled option is \refKey{separator} and has the same meaning as in \refCom{CounterFormat}. + + The formatmacro must be a command sequence with exactly one mandatory argument, which may not be specified in the format storage process. +\end{docCommand} + +\begin{docCommand}{RemoveCounterFormats}{\oarg{options}\marg{formatshorthandA,formatshorthandB,\dots}}\CHDocNew{1.4} + Removes the given counter formats from the global list. + + The optional argument is ignored as of version \packageversion. +\end{docCommand} + + + + + \clearpage \part{Features} @@ -1521,7 +1753,6 @@ This commands tests, whether a given counter name is a driver counter and expand - \section[Counter backup/restoration]{Backup and restore of counter values}\CHDocNew{1.0}\label{section::new_backuprestore} It might be necessary to interrupt the current sectioning, e.g. including another document's structure (an external paper, for example) such that the counting should start again and after finishing of the external structure the old values should be restored. @@ -1593,6 +1824,7 @@ There is a default counter group for backup named "scratch", if no specific coun \end{itemize} \end{itemize} + \subsubsection{Core backup/restore macros} \begin{docCommand}[before={\CHDocNew{1.0}}]{BackupCounterGroup}{\oarg{options}\marg{counter group name}} @@ -1674,6 +1906,7 @@ It might be necessary to remove a certain backup state, i.e. a collection of cou + \subsubsection[Clearing backup groups]{Clearing and deleting backup counter groups}\label{subsubsec::clearingdeletingbackupcountergroups} From time to time it might be necessary to remove counters from a group or to clear the whole group or remove even the whole group. Those operations can be achieved with \refCom{RemoveCountersFromBackupGroup}, \refCom{ClearBackupCounterGroups} and \refCom{DeleteBackupCounterGroups}. All macros remove at least all stored values belonging to a counter group. A \refCom{RestoreBackupCounterGroup} call does nothing after any of the mentioned macros have been issued. @@ -1981,6 +2214,7 @@ This macro tests if a counter is under the administration of the periodic counte \end{docCommand} + \section[Suspending and Resuming]{Suspending and resuming (associated) counters}\label{section::suspendedresumedcounters} @@ -2123,7 +2357,9 @@ There are \number\totvalue{totalequations}~equations in here! Similarly to the package \CHDocPackage{totcount} or the features of \CHDocPackage{totalcount} by Axel Sommerfeldt this package provides the possibility of defining a counter that stores its finally value to the auxiliary file and starts from this value then, if not set otherwise to another value. -The declaration of a total counter is a preamble - only event and \refCom{NewTotalDocumentCounter} is a preamble-only command in order to prevent counter register confusion. If a certain existing counter should be treated with total counter features, use \refCom{RegisterTotalDocumentCounter} instead. +The declaration of a total counter is a preamble - only event and \refCom{DeclareTotalDocumentCounter} is a preamble-only command in order to prevent counter register confusion. If a certain existing counter should be treated with total counter features, use \refCom{RegisterTotalDocumentCounter} instead. + +Use \refCom{NewTotalDocumentCounter} only in rare cases, if a total counter must be defined within the document body. \begin{marker} \tcbdocmarginnote{\bcbombe}The standard \LaTeXe\ commands \cs{stepcounter}, \cs{addtocounter} and \cs{setcounter} support the specification of a total counter, but \cs{refstepcounter} will fail since the usage of a total counter for labelling purposes is most probably of no use (as of version \packageversion) @@ -2183,6 +2419,7 @@ This macro tests if a counter is under the administration of the total counter c + \begin{docCommand}{IsTotalCounterT}{\marg{counter name}\marg{true branch}} This macro checks if a counter is under the administration of the total counter commands and expands to the code in the second argument if this is true. \end{docCommand} @@ -2207,6 +2444,8 @@ This macro checks if a counter is under the administration of the total counter The features of using other \CHDocFiles{aux} files or a different external file as provided by \CHDocPackage{totcount} is not (yet) support as of version \packageversion. \end{marker} + + \section{Super total counters}\label{section:supertotalcounters} \tcbdocmarginnote{\tcbdocnew{2015-11-25}} In addition to the concept of a total counter, there is also the possibility of using super total counters -- those counters survive the reset at the beginning of a compilation, i.e. the value of a super total counter might be stepped in each run and as such the number of compilation runs etc. can be tracked. The values of the last run are persistent as long as the \CHDocFileExt{.aux} file isn't deleted. @@ -2219,9 +2458,14 @@ This macro defines a new counter (which mustn't exist before of course) and puts \refKey{supertotal} -- this has the same meaning as in \refCom{RegisterTotalDocumentCounter} and defaults to \texttt{false}. - \item \marg{total counter name1, total counter name2,\dots}: The names of the total counter, separated by a comma. This must not be the same like the name of any already existing counter. Internally another counter is defined which has a prefix to prevent name clashes with counter names defined by the package \CHDocPackage{totalcount}. -\end{codeoptionsenum} + \item \marg{total counter name1, total counter name2,\dots}: The names of the total counter, separated by a comma. This must not be the same like the name of any already existing counter. Internally another counter is defined which has a prefix to prevent name clashes with counter names defined by the package \CHDocPackage{totcount}. + \end{codeoptionsenum} + +\end{docCommand} +\begin{docCommand}{DeclareTotalDocumentCounter}{\oarg{options}\marg{total counter name1, total counter name2,\dots}} + +This is the preamble - only version of \refCom{NewTotalDocumentCounter} and should be preferred in most cases over that command. If an already existing counter should be tracked with total counter features, use \refCom{RegisterTotalDocumentCounter} instead. @@ -2239,6 +2483,7 @@ This macro tests if a counter is under the administration of the super total cou + \begin{docCommand}{IsSuperTotalCounterT}{\marg{counter name}\marg{true branch}} This macro checks if a counter is under the administration of the super total counter commands and expands to the code in the second argument if this is true. \end{docCommand} @@ -2262,6 +2507,7 @@ 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. + \section{Experimental features}\label{subsec::associated_counters_experimental} @@ -2332,7 +2578,7 @@ This feature is experimental and only realized for the modified \refCom{label} c 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. +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. @@ -2343,7 +2589,7 @@ As of version \packageversion\ the hook macro does not allow more than one argum 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. +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. @@ -2424,6 +2670,20 @@ write this documentation. \begin{itemize}[itemsep=15pt] +\item \CHDocFullVersion{1.4} + +\begin{itemize} + \item Improved the core macros \cs{refstepcounter} and \cs{stepcounter} in order to fit the \CHDocPackage{expl3} and \CHDocPackage{xparse} changes of Februar - April 2017. + \item Added following experimental features: + \item \refCom{CounterFormat} with quick and possible recursive change of the counter output + \item \refCom{StoreCounterFormats}, \refCom{AddCounterFormats} and \refCom{RemoveCounterFormats} for defining own short hand counter formats. + \item Provided the macros \refCom{xalphalph} and \refCom{xAlphAlph} in order to allow counter output in the same manner as the \CHDocPackage{alphalph} does. + \item Added the macros \refCom{CounterWithin}, \refCom{CounterWithin*}, \refCom{CounterWithout} and \refCom{CounterWithout*} which provides a quicker access to add or remove counters from the reset list and changing the corresponding \cs{the...} macros. + \item Provided the \refCom{LoopCounterResetList} to perform the same action on all counters being in the reset list of a given counter. + \item New macros \refCom{ClearCounterResetList} and \refCom{ClearCounterResetList*} to remove all counters on first level of a driver counter. + \item Added the explanation (missing in previous versions) to the documentation that the \refCom{AddToReset}, \refCom{RemoveFromReset} and \refCom{RemoveFromFullReset} macros actually support a comma separated list of counter names for the first argument. +\end{itemize} + \item \CHDocFullVersion{1.3} \begin{itemize} \item Provided the \refCom{LaTeXLabel} macro to access the non-xassoccnt version of the \refCom{label} command. @@ -2510,7 +2770,6 @@ Improved \cs{stepcounter} to remove some incompatibilities with the \CHDocPackag \item \CHDocFullVersion{0.1} -%Version: 0.1 \CHDocNew{0.1} A major bug fixed due to some error in usage together with \CHDocPackage{calc} when the driven counters are not stepped any longer. The culprit was in \CHDocPackage{assoccnt} that the counter reset list was not really disabled. @@ -2527,7 +2786,7 @@ Improved \cs{stepcounter} to remove some incompatibilities with the \CHDocPackag \renewcommand{\theHsection}{appendix.\thesection} \renewcommand{\thesection}{\Alph{section}} -Note: The \cs{DeclareAssociatedCounters} command have to be used in the preamble of the document. It's missing here for the sake of a compact example. +Note: The \cs{DeclareAssociatedCounters} command has to be used in the preamble of the document. It's missing here for the sake of a compact example. 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 40000678198..aeb41206090 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 a7097a65c7c..85e81d54865 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% 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 43b6bd68345..4965ef90735 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 1fb419b065d..87e286d0059 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% 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 differindex 137271c11c5..a721a8a88a3 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.pdf +++ 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 index 93f29e8db31..0fefab49b03 100644 --- a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_getparentcounter_example.tex @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Example file for determing the parent counter of a counter and referring to it file for xassoccnt.sty %% %% @@ -43,10 +43,10 @@ } \makeatother +\usepackage{xparse} -\usepackage{xparse} \makeatletter \ExplSyntaxOn @@ -143,10 +143,11 @@ \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 +\end{document} + 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 b35903e19a5..bdf13e38fe2 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 a3e2321d1f3..8dccef86f67 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Example file the the usage of labels with associated counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_parentcounterchain_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_parentcounterchain_example.pdf Binary files differnew file mode 100644 index 00000000000..1a021978908 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_parentcounterchain_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_parentcounterchain_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_parentcounterchain_example.tex new file mode 100644 index 00000000000..cb00496a2f7 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_parentcounterchain_example.tex @@ -0,0 +1,94 @@ +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) +%% Example file for determing the parent counter chain of a counter 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` +%% +%% + +\documentclass{book} +%\usepackage{mathtools} + +\usepackage[utf8]{inputenc} + + + +\usepackage[standardcounterformats=on]{xassoccnt} + + +\AddCounterFormats{H!\HexValue} + + +\setcounter{secnumdepth}{6} + +\GetAllResetLists + +%\CounterWithout{subparagraph}{paragraph} +\begin{document} + + \DeclareLanguageMappings{ngerman}{% + part;;Teil;;Teile;;Teil;;Teile, + chapter;;Kapitel;;, + section;;Abschnitt;;Abschnitte, + subsection;;Unterabschnitt;;Unterabschnitte;;, + subsubsection, + Absatz, + subsubparagraph;;Einrückung, + equation, + table, + footnote, + page, + figure;;%figure;;figures;;Figure;;Figures + } + + \ShowLanguageMappings{ngerman} + + +\xassingularname{ngerman}{part} + +\setcounter{chapter}{3} + + +%\CounterFormat[recursive]{subparagraph!n} + +\CounterFormat{subparagraph!H} + + + +\chapter{The chapter} + +\section{The section} + +\subsection{The subsection} + +\subsubsection{The subsubsection} + +\setcounter{paragraph}{2} +\setcounter{subsubsection}{7} +\setcounter{subsection}{5} +\setcounter{section}{2} + +\paragraph{The paragraph} + +\setcounter{subparagraph}{128} + +\subparagraph{A subparagraph} + + + +%\GetParentCounter{paragraph} + +\end{document}
\ No newline at end of file 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 4af97ba7c5c..683db9c9978 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 827d72a1b9b..5059fc2a590 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Example file for periodic counters file for xassoccnt.sty %% %% @@ -47,7 +47,7 @@ Adding a value of 4 again: Value of foocntr is \thefoocntr\ now! Now prevent the wrapping -\addtocounter{foocntr}{10}[wrap=false] % Is it 13? No, it is 11 % 8 = 3 +\addtocounter{foocntr}{10}[wrap=false] % Is it 13? Yes, it is, since wrapping is prevented. Value of foocntr is \thefoocntr\ now! @@ -56,7 +56,6 @@ Value of foocntr is \thefoocntr\ now! \section{My nice section \x} } - \clearpage \ChangePeriodicCounterCondition[reset=false]{section}{5}% 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 8555d6a643b..e0d3652b1c3 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 ff23de95e9c..88302857204 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Example file for reset list features file for xassoccnt.sty %% %% @@ -22,16 +22,27 @@ \documentclass{book} \usepackage{chngcntr} - +\usepackage{alphalph} \usepackage{xassoccnt} \DeclareDocumentCounter{dummyctra}[chapter] +\DeclareDocumentCounter{dummyctrb} + + + \newcommand{\showfullresetlist}[1]{% \item Counter name: #1 \hfill \csname the#1\endcsname%\leavevmode% } +\usepackage{hyperref} + + + \begin{document} + +\CounterFormat{dummyctrb!o} + \tableofcontents \chapter{First} @@ -45,6 +56,7 @@ \caption{A dummy figure} \end{figure} +Removing the section counter from the chapter reset list! \RemoveFromFullReset{section}{chapter} @@ -63,10 +75,18 @@ \AddToReset{section}{chapter} +\CounterWithin{dummyctrb}{chapter} + + +\CounterWithout*{section}{chapter} + \chapter{Third Chapter} \section{First section in 3rd chapter} + +\setcounter{dummyctrb}{4} + \begin{itemize} \LoopFullCounterResetList{chapter}{\showfullresetlist} \end{itemize} diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetloop_example.pdf b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetloop_example.pdf Binary files differnew file mode 100644 index 00000000000..acaea22a326 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetloop_example.pdf diff --git a/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetloop_example.tex b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetloop_example.tex new file mode 100644 index 00000000000..34bca0a94c5 --- /dev/null +++ b/Master/texmf-dist/doc/latex/xassoccnt/xassoccnt_resetloop_example.tex @@ -0,0 +1,80 @@ +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) +%% Example file for looping through the reset list 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` +%% +%% + +\documentclass{book} + +\usepackage{xassoccnt} + +\usepackage{chngcntr} + + +\makeatletter + +\AtBeginDocument{% + \let\latex@@chapter\chapter + \RenewDocumentCommand{\chapter}{sO{#3}m}{% + \IfBooleanTF{#1}{% + \latex@@chapter*{#3}% + }{% + \ifnogobblechapter + \latex@@chapter[#2]{#3} + \fi + }% + } + } +\makeatother + +\newcommand{\counterwithoutwrapper}[2]{% + \counterwithout{#2}{#1}% +} + +\newif\ifnogobblechapter +\nogobblechapterfalse + +\usepackage{hyperref} + +\begin{document} + +\ifnogobblechapter +\else +\ClearCounterResetList*{chapter} +%\LoopCounterResetList{chapter}{\counterwithoutwrapper} +\fi + +\tableofcontents + +\chapter[Foo entry to ToC]{Foo Chapter} + +\section{A subsection of a gobbled chapter} + +\begin{figure} + \caption{A figure caption} +\end{figure} + +\chapter{Another chapter} + +\begin{figure} + \caption{Another figure caption} +\end{figure} + +Some other content + +\end{document} 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 044026ab36b..56ca09de35d 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 be3ebae7ed7..2c768e46a04 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% 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 08576d9c494..06c564eec58 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 e3a3f2cb29f..6e736b3f077 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.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Example file for total counters file for xassoccnt.sty %% %% diff --git a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty index 628d992ce3f..932f421190f 100644 --- a/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty +++ b/Master/texmf-dist/tex/latex/xassoccnt/xassoccnt.sty @@ -1,4 +1,4 @@ -%% LaTeX package xassoccnt - version 1.3 (2017/03/05 -- 18:08:47) +%% LaTeX package xassoccnt - version 1.4 (2017/04/30 -- 00:47:05) %% Source file for xassoccnt.sty %% %% @@ -19,10 +19,10 @@ %% %% -\def\xassoccntpackageversion{1.3} +\def\xassoccntpackageversion{1.4} \NeedsTeXFormat{LaTeX2e}[1995/12/01] -\ProvidesPackage{xassoccnt}[2017/03/05 - v\xassoccntpackageversion] +\ProvidesPackage{xassoccnt}[2017/04/30 - v\xassoccntpackageversion] \RequirePackage{etoolbox} \RequirePackage{letltxmacro} \RequirePackage{xcolor} @@ -33,27 +33,51 @@ \ExplSyntaxOn \newif\ifexplversionnew -\explversionnewfalse +\explversionnewtrue % Some variants of standard expl3 contributions \cs_generate_variant:Nn \seq_set_from_clist:Nn { Nx, cx } \cs_generate_variant:Nn \seq_gset_from_clist:Nn { Nx, cx } +\cs_generate_variant:Nn \seq_set_split:Nnn {Nxn,cxn,Nxx,cxx,cox,Nox,Non,con} \cs_generate_variant:Nn \seq_remove_all:Nn { cV, NV } \cs_generate_variant:Nn \seq_gremove_all:Nn { cV, NV } \cs_generate_variant:Nn \seq_gput_right:cn {cx} -\cs_generate_variant:Nn \prop_put:Nnn {cxx} +\cs_generate_variant:Nn \prop_put:Nnn {cxx,nxx,nxn,cxn,Nxx,Nxn} +\cs_generate_variant:Nn \prop_gput:Nnn {cxx,nxx,nxn,cxn,Nxx,Nxn,NVx,Nvn,cVn,cVx} \cs_generate_variant:Nn \prop_remove:Nn {cx,Nx} -\cs_generate_variant:Nn \prop_item:Nn {NV,cV,cx,No,co} -\cs_generate_variant:Nn \int_set:Nn {NV,Nx} +\cs_generate_variant:Nn \prop_gremove:Nn {Nx,cx,No,co,NV,cV} +\cs_generate_variant:Nn \prop_item:Nn {NV,cV,cx,No,co,Nx,nx} +\cs_generate_variant:Nn \int_set:Nn {NV,Nx,Nx,cx} +\cs_generate_variant:Nn \cs_gset:Npn {NpV,Npv,cpV,cpv,cpo,Npo} +\cs_generate_variant:Nn \tl_set:Nn {No,Nx,NV} % First some local or global values +% global/local scratch variables +\seq_new:N \l__xassoccnt_tmpa_seq + +\tl_new:N \l__xassoccnt_tmpa_tl +\tl_new:N \l__xassoccnt_tmpb_tl + +\tl_new:N \g__xassoccnt_tmpa_tl +\tl_new:N \g__xassoccnt_tmpb_tl + +\prop_new:N \l__xassoccnt_tmpa_prop +\prop_new:N \g__xassoccnt_tmpa_prop + +\int_new:N \g__xassoccnt_tmpa_int +\int_new:N \l__xassoccnt_tmpa_int + + +\bool_new:N \l__xassoccnt_alphalphpackage_loaded_bool \bool_new:N \l__xassoccnt_hyperrefpackage_loaded_bool \bool_new:N \l__xassoccnt_cleverefpackage_loaded_bool +\prop_new:N \g__xassoccnt_loadedpackages_prop + \ifexplversionnew \str_const:Nn \c__xassoccnt_modulename_str {xassoccnt} \else @@ -62,6 +86,9 @@ \bool_new:N \l__xassoccnt_calcpackage_loaded +\int_const:Nn \c_xassoccnt_false_int {0} +\int_const:Nn \c_xassoccnt_true_int {1} + \int_new:N \l__xassoccnt_initialcountervalue_int \int_new:N \g__xassoccnt_lastcountervalue_int @@ -90,13 +117,21 @@ % Reset of counters related 'variables' + +\seq_new:N \g_xassoccnt_reset_seq \seq_new:N \l__xassoccnt_counterreset_seq +% All counters \seq_new:N \g_xassoccnt_all_latex_counters_seq \prop_new:N \g_xassoccnt_latex_parentcounters_prop +% Counter formats + +\prop_new:N \l_xassoccnt_counter_format_prop +\prop_new:N \g_xassoccnt_counter_formatdata_prop + %%% \int_new:N \g__xassoccnt_backupcalls_int \int_new:N \l__xassoccnt_backuptmpa_int @@ -104,7 +139,6 @@ \seq_new:N \l__xassoccnt_countervaluesbackup_seq \seq_new:N \l__xassoccnt_backupresetlist_seq \bool_new:N \l__xassoccnt_counternamestarred_bool % Not needed actually - \seq_new:N \g__xassoccnt_counternamesbackuplist_seq @@ -137,6 +171,7 @@ \prop_gput:Nnn \g_xassoccnt_module_data_prop {scratchname} {scratch} \prop_gput:Nnn \g_xassoccnt_module_data_prop {backupfeaturename} {backupcounters} +\prop_gput:NnV \g_xassoccnt_module_data_prop {standardcounterformats} {\c_xassoccnt_true_int} \prop_gput:Nnn \g_xassoccnt_module_data_prop {prefix-sep} {::} @@ -145,6 +180,12 @@ } +\cs_new:Npn \xasdata #1{% + \xassoccnt_extract_moduledata:n {#1}% +} + + + \keys_define:nn {xassoccnt} { initial .code:n={ \int_set:Nn \l__xassoccnt_initialcountervalue_int {#1}}, @@ -208,9 +249,13 @@ supertotal .bool_set:N={\l__xassoccnt_is_supertotalcounter_bool }, - resetbackup .bool_set:N={\l__xassoccnt_resetbackupcounters_bool }, - redefinelabel .bool_set:N= { \g__xassoccnt_redefinelabel_bool } - + resetbackup .bool_set:N=\l__xassoccnt_resetbackupcounters_bool , + standardcounterformats .choice:, + standardcounterformats /on .code:n={\prop_gput:NnV \g_xassoccnt_module_data_prop {standardcounterformats} {\c_xassoccnt_true_int}}, + standardcounterformats /off .code:n={\prop_gput:NnV \g_xassoccnt_module_data_prop {standardcounterformats} {\c_xassoccnt_false_int}}, + redefinelabel .bool_set:N= { \g__xassoccnt_redefinelabel_bool }, + map-name .code:n= { \prop_put:Nnn \g_xassoccnt_module_data_prop {map-name} {#1}}, + counter-name .code:n= { \prop_put:Nnn \g_xassoccnt_module_data_prop {counter-name} {#1}} } \keys_define:nn {xassoccnt_periodiccounter} {% @@ -229,7 +274,7 @@ } -\keys_set:nn{xassoccnt}{nonumberofruns, redefinelabel=true} +\keys_set:nn{xassoccnt}{nonumberofruns, redefinelabel=true,standardcounterformats=on} \ProcessKeysOptions{xassoccnt} @@ -242,6 +287,9 @@ Error:~Entity~#1~does~not~name~a~counter\\ } +%Messages related to Counter formats +\msg_new:nnn {xassoccnt} {counterformatnotdefined} {The~counter~format~"#1"~is~not~defined~for~counter~"#2"} +\msg_new:nnn {xassoccnt} {counterformatwrongortooshort} {The~counter~format~for~"#1"~is~wrong~or~the~separator~is~missing} \msg_new:nnn{xassoccnt}{crossassociation}{% @@ -339,12 +387,100 @@ This~is~an~error! } +\msg_new:nnn{xassoccnt}{packagenotloadedfatal}{% + Error:~Package~"#1"~is~not~loaded~but~required~\\ + This~is~an~error! +} + + \msg_new:nnn{xassoccnt}{containeralreadyexists}{% Error:~Container~named~#1~already~exists\\ } +\msg_new:nnn{xassoccnt}{languagemappingalreadyexists}{% + Warning:~Language~mapping~#1~already~exists!\\ +} + + +\msg_new:nnn{xassoccnt}{undefinedlanguagemapping}{% + Error:~Language~mapping~#1~is~undefined!\\ +} + + + +%%%%%%%%%%%%%%%%%%% + +\cs_new:Nn \xassoccnt_trackloadedpackages:n {% + \seq_set_from_clist:Nn \l_tmpa_seq {#1} + \seq_map_inline:Nn \l_tmpa_seq {% + \@ifpackageloaded{##1}{% + \prop_gput:Nnn \g__xassoccnt_loadedpackages_prop {##1} {\c_one} + }{% + \prop_gput:Nnn \g__xassoccnt_loadedpackages_prop {##1} {\c_zero} + } + } +} + +\prg_new_conditional:Nnn \xassoccnt_package_loaded:n {T,F,TF}{% + \prop_if_in:NnTF \g__xassoccnt_loadedpackages_prop {#1} {% + \int_compare:nNnTF {\prop_item:Nn \g__xassoccnt_loadedpackages_prop {#1}} = {\c_zero } {\prg_return_false:} {\prg_return_true:}% + }{% + \prg_return_false: + } +} + +\prg_new_conditional:Nnn \xassoccnt_package_notloaded:n {T,F,TF}{% + \prop_if_in:NnTF \g__xassoccnt_loadedpackages_prop {#1} {% + \int_compare:nNnTF {\prop_item:Nn \g__xassoccnt_loadedpackages_prop {#1}} = {\c_zero } {\prg_return_true:} {\prg_return_false:}% + }{% + \prg_return_true: + } +} + +\prg_new_conditional:Nnn \__xassoccnt_package_notloaded_fatal:n {T,F,TF}{% + \xassoccnt_package_notloaded:nTF{#1}{% + \msg_error:nnn{xassoccnt}{packagenotloadedfatal}{#1} + }{% + \prg_return_true: + } +} + +\cs_new:Nn \xassoccnt_package_notloaded_fatal:nn {% + \__xassoccnt_package_notloaded_fatal:nF {#1} {#2} +} + + +\NewDocumentCommand{\IfPackageLoadedT}{m+m}{% + \xassoccnt_package_loaded:nT {#1}{#2} +} + +\NewDocumentCommand{\IfPackageLoadedF}{m+m}{% + \xassoccnt_package_loaded:nF {#1}{#2} +} + +\NewDocumentCommand{\IfPackageLoadedTF}{m+m+m}{% + \xassoccnt_package_loaded:nTF {#1}{#2}{#3} +} + + +\NewDocumentCommand{\IfNotPackageLoadedTF}{m+m+m}{% + \xassoccnt_package_notloaded:nTF {#1}{#2}{#3} +} + +\NewDocumentCommand{\IfNotPackageLoadedT}{m+m}{% + \xassoccnt_package_notloaded:nT {#1}{#2} +} + +\NewDocumentCommand{\IfNotPackageLoadedF}{m+m}{% + \xassoccnt_package_notloaded:nF {#1}{#2} +} + + + +%%%%%%%%%%%%%%%%%%%%%%%% + \cs_new:Nn \__xassoccnt_intinc:n {\int_gincr:N \l_xassoccnt_resetlist_counter}% @@ -366,17 +502,17 @@ \cs_new:Nn \xassoccnt_bootstrap_fullreset_list:n {% - \begingroup + \group_begin: \def\@elt##1{\seq_gput_right:cn {#1_fullresetlist_seq} {##1}} \use:c{cl@#1} - \endgroup + \group_end: } \cs_new:Nn \xassoccnt_local_list:nn {% - \begingroup + \group_begin: \def\@elt##1{\seq_gput_right:cn {#1} {##1}} \use:c{cl@#2} - \endgroup + \group_end: } @@ -413,8 +549,27 @@ } +\NewDocumentCommand{\ClearCounterResetList}{sm}{% + \cs_if_exist:cT {cl@#2} {% + \seq_clear:N \l__xassoccnt_tmpa_seq + \xassoccnt_local_list:nn {l__xassoccnt_tmpa_seq} {#2} + \seq_map_inline:Nn \l__xassoccnt_tmpa_seq { + \IfBooleanTF{#1}{% + \CounterWithout*{##1}{#2}% + }{% + \CounterWithout{##1}{#2}% + }% + } + \IfBooleanF{#1}{% + \xassoccnt_default_counterformat:n{#2} + }% + \cs_gset_eq:cc {cl@#2} {relax}% + } +} + \NewDocumentCommand{\RemoveFromReset}{mm}{% + \seq_clear:N \l_tmpa_seq \xassoccnt_local_list:nn {l_tmpa_seq} {#2} \seq_set_from_clist:Nn \l_tmpb_seq {#1} \seq_map_inline:Nn \l_tmpb_seq {% @@ -446,13 +601,63 @@ \__xassoccnt_latexcounter_exists:nTF {#2} { \seq_set_from_clist:Nn \l_tmpa_seq {#1} \seq_map_inline:Nn \l_tmpa_seq {% - \@addtoreset{##1}{#2}% - } + \__xassoccnt_ifinresetlist:nnF{##1}{#2}{% + % Do not add the master counter to its own reset list! + \tl_if_eq:nnF { ##1 } {#2} {% + \@addtoreset{##1}{#2}% + }% + } + }% End of \seq_map_inline }{% \msg_fatal:nnn{xassoccnt}{nameisnocounter}{#1}% }% } + + + +%%%% CounterWithin - Features + + +\NewDocumentCommand{\CounterWithin}{smm}{% + \__xassoccnt_latexcounter_exists:nTF {#3} {% + \seq_set_from_clist:Nn \l_tmpa_seq {#2} % + \seq_map_inline:Nn \l_tmpa_seq {% + \__xassoccnt_ifinresetlist:nnF{##1}{#3}{% + % Do not add the master counter to its own reset list! + \tl_if_eq:nnF { ##1 } {#3} {% + \@addtoreset{##1}{#3}% + }% + \IfBooleanF{#1}{% + % Needs overhaul! + \cs_set:cpn {the##1} {\csname the#3\endcsname.\arabic{##1}} + } + } + }% End of \seq_map_inline + }{% + \msg_fatal:nnn{xassoccnt}{nameisnocounter}{#2}% + }% +} + + +\NewDocumentCommand{\CounterWithout}{smm}{% + \seq_clear:N \l_tmpa_seq + \xassoccnt_local_list:nn {l_tmpa_seq} {#3} + \seq_set_from_clist:Nn \l_tmpb_seq {#2} + \seq_map_inline:Nn \l_tmpb_seq {% + \IfBooleanF{#1}{% + \cs_set:cpn {the##1} {\arabic{##1}}% + } + \seq_remove_all:Nn \l_tmpa_seq {##1}% + }% + \cs_set:cpx {cl@#3}{\empty} + \seq_map_inline:Nn \l_tmpa_seq {% + \@addtoreset{##1}{#3}% + } +} + + + %%%% The original counter related routines! @@ -465,14 +670,24 @@ % Needed for Backup/Restore features -%\AtBeginDocument{% + \AtEndPreamble{ + \@ifpackageloaded{alphalph}{% + \bool_gset_true:N \l__xassoccnt_alphalphpackage_loaded_bool% + }{}% \@ifpackageloaded{hyperref}{% \bool_gset_true:N \l__xassoccnt_hyperrefpackage_loaded_bool% }{}% \@ifpackageloaded{cleveref}{% \bool_gset_true:N \l__xassoccnt_cleverefpackage_loaded_bool% }{} + \xassoccnt_trackloadedpackages:n{alphalph,calc,cleveref,hyperref} +} + +\AtEndOfPackage{% + \@ifpackageloaded{alphalph}{% + \bool_gset_true:N \l__xassoccnt_alphalphpackage_loaded_bool% + }{}% } @@ -485,7 +700,8 @@ }{} \AtEndOfPackage{ - \PackageInfo{xassoccnt}{2017/03/05 - v\xassoccntpackageversion -- stepping counters simultaneously and other features} + \PackageInfo{xassoccnt}{2017/04/30 - v\xassoccntpackageversion -- stepping counters simultaneously and other features} + \xassoccnt_trackloadedpackages:n{alphalph,calc,cleveref,hyperref} \@ifpackageloaded{calc}{% \msg_warning:nnn{xassoccnt}{incompatiblepackagenonfatal}{calc}% Warning \bool_set_true:N \l__xassoccnt_calcpackage_loaded @@ -609,7 +825,7 @@ } \cs_new:Nn \__xassoccnt_autodefine_associatedcounters:nn {% - \bool_if:nTF{ \g__xassoccnt_autodefine_counters }{% + \bool_if:NTF \g__xassoccnt_autodefine_counters {% \seq_map_inline:Nn #2 { \__xassoccnt_newcounter_ltx:nnn {sloppy}{##1}{} } }{% \keys_set:nn{xassoccnt}{#1} @@ -694,7 +910,9 @@ \cs_new:Nn \__xassoccnt_newcounter_ltx:nn{% + \group_begin: \keys_set:nn {xassoccnt}{sloppy=false,initial=\c_zero,#1} +% \__xassoccnt_declare_language_map:nn {\prop_item:Nn \g_xassoccnt_module_data_prop {map-name} }{#2;;\prop_item:Nn \g_xassoccnt_module_data_prop {counter-name}} \cs_if_exist:cTF{c@#2}{% \bool_if:nF {\l__xassoccnt_sloppy_newcounter }{ \msg_error:nnn{xassoccnt}{counteralreadyexists}{#2}% Warning @@ -703,12 +921,14 @@ \newcounter{#2}% \xassoccnt_standardsetcounter{#2}{\l__xassoccnt_initialcountervalue_int} }% + \group_end: } \ifexplversionnew \cs_new:Nn \__xassoccnt_newcounter_ltx:nnn{% - \keys_set:nn {xassoccnt}{sloppy=false,initial=\c_zero,#1} + \group_begin: + \keys_set:nn {xassoccnt}{map-name=default,counter-name=#2,sloppy=false,initial=\c_zero,#1} \str_set:Nx \l_tmpa_str {#3}% \__xassoccnt_latexcounter_exists:nTF{#2}{% \bool_if:nF {\l__xassoccnt_sloppy_newcounter }{% @@ -722,6 +942,7 @@ }% \xassoccnt_standardsetcounter{#2}{\l__xassoccnt_initialcountervalue_int}% } + \group_end: } \else \cs_new:Nn \__xassoccnt_newcounter_ltx:nnn{% @@ -745,27 +966,6 @@ -\cs_new:Nn \xassoccnt_declareassociatedcounters_old:nnn {% - \__xassoccnt_container_if_in:cnTF{\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_mastername_str}:}{#2}{% - % Not contained in the driver counter list - \__xassoccnt_addassociatedcounters:nnn{#1}{#2}{#3}% - }{% - % Check first if there is a potential cross association - \__xassoccnt_adddrivercounter:nn{#1}{#2}% - \xassoccnt_is_associatedtocounter:nnTF{#3}{#2}{% - \msg_fatal:nnnn{xassoccnt}{crossassociation}{#2}{#3}% Fatal message - % Not necessary unless the fatal message above is removed - \__xassoccnt_container_removecounter:cn{\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_mastername_str}:}{#2} - }{% No, we don't try to cross-associate two counters - \__xassoccnt_addassociatedcounters:nnn{#1}{#2}{#3}% - }% - }% - \__xassoccnt_container_removeduplicates:n{\__xassoccnt_drivercontainer:n{#2}} - \__xassoccnt_autodefine_drivercounter:nn { }{#2} -} - - - \cs_new:Nn \xassoccnt_declareassociatedcounters:nnn {% \__xassoccnt_container_if_in:cnTF{\__xassoccnt_generate_countercontainername:n{\c_xassoccnt_mastername_str}:}{#2}{% % Not contained in the driver counter list @@ -1855,7 +2055,7 @@ \NewDocumentCommand{\ClearBackupState}{O{}m}{% \keys_set:nn {xassoccnt_container} {backup-id={},#1} \xassoccnt_backup_clear_backupstate:nn { \__xassoccnt_backup_id_tl } {#2} - \prop_map_inline:cn {\xassoccnt_backup_subproplist:n{#2}} {##1->##2\par}% + %\prop_map_inline:cn {\xassoccnt_backup_subproplist:n{#2}} {##1->##2\par}% } @@ -2135,7 +2335,6 @@ \NewDocumentCommand{\RemoveAllPeriodicCounters}{O{}}{% \seq_map_inline:Nn \g_xassoccnt_periodiccounter_container_seq {\xassoccnt_remove_periodiccounter:nn {#1} {##1}} -% \cs_new:Nn \xassoccnt_remove_periodiccounter:nn {% \seq_gclear:N \g_xassoccnt_periodiccounter_container_seq \prop_gclear:N \g_xassoccnt_periodiccounter_prop } @@ -2165,9 +2364,9 @@ %%%% Redefinition of standard counter macros +\cs_set:Npn \stepcounter #1{% - -\RenewDocumentCommand{\stepcounter}{m}{% +%\def\stepcounter#1{% \__xassoccnt_translate_countername:cn {l_tmpa_tl} {#1}% \xassoccnt_is_suspendedcounter:nF{#1}{% \xassoccnt_stepcounter_periodiccounter:n {#1}% @@ -2203,6 +2402,7 @@ } } + \RenewDocumentCommand{\addtocounter}{mmO{}}{% \xassoccnt_is_periodiccounter:nTF {#1}{% \xassoccnt_addtocounter_periodiccounter:nnn {#1} {#2} {#3}% @@ -2212,12 +2412,7 @@ } - - - - - -\NewDocumentCommand{\xassoccnt_addtocounter}{mmO{}}{% +\NewDocumentCommand{\xassoccnt_addtocounterfoo}{mmO{}}{% % Only add to a counter if this counter isn't on the suspended counters list! \xassoccnt_is_suspendedcounter:nF{#1}{% \__xassoccnt_translate_countername:cn {l_tmpb_tl} {#1}% @@ -2231,12 +2426,11 @@ } -\RenewDocumentCommand{\xassoccnt_addtocounter}{mmO{}}{% +\NewDocumentCommand{\xassoccnt_addtocounter}{mmO{}}{% % Only add to a counter if this counter isn't on the suspended counters list! \xassoccnt_is_suspendedcounter:nF{#1}{% \__xassoccnt_translate_countername:cn {l_tmpb_tl} {#1}% \xassoccnt_standardaddtocounter{\l_tmpb_tl}{#2}% -% \cs_gset_nopar:Nn \__xassoccnt_lastaddtocounter: {\l_tmpb_tl}% Remove this \cs_gset_nopar:Npx \LastAddedToCounter {\tl_use:N \l_tmpb_tl}% }% % Now check if #1 is a total counter and set the property correspondingly @@ -2334,6 +2528,7 @@ } + \RenewDocumentCommand{\setcounter}{mm}{% \__xassoccnt_translate_countername:cn {l_tmpb_tl}{#1}% % \cs_gset_nopar:Nn \__xassoccnt_lastsetcounter: {#1} @@ -2346,8 +2541,7 @@ } - -\RenewDocumentCommand{\refstepcounter}{m}{% +\cs_set:Npn \refstepcounter #1 {% \seq_if_in:NxF \g_xassoccnt_suspendedcnt_seq {#1} {% \cs_gset_nopar:Npx \LastRefSteppedCounter {#1} \xassoccnt_standardrefstepcounter{#1}% @@ -2356,7 +2550,6 @@ } - \newcommand{\LastCounterValue}{% \int_use:N \g__xassoccnt_lastcountervalue_int } @@ -2365,6 +2558,7 @@ %%%%% Wrappers for \newcounter etc. \NewDocumentCommand{\NewDocumentCounter}{O{initial=\c_zero}mo}{% + \group_begin: \seq_set_from_clist:Nx \l_tmpa_seq {#2} \seq_map_inline:Nn \l_tmpa_seq {% \IfValueTF{#3}{% @@ -2373,6 +2567,7 @@ \__xassoccnt_newcounter_ltx:nnn{#1}{##1}{} } } + \group_end: } \NewDocumentCommand{\CopyDocumentCounters}{O{}mm}{% @@ -2429,13 +2624,10 @@ \__xassoccnt_ifinresetlist:nnF{#2}{#3}{#4}% } - - \cs_new_nopar:Npn \GetAllResetLists {% \group_begin: \def\@elt##1{% \seq_gput_right:Nn \g_xassoccnt_all_latex_counters_seq {##1}% -% \seq_set:c { g_latex_cntr_##1_seq } } \cl@@ckpt% \seq_map_inline:Nn \g_xassoccnt_all_latex_counters_seq {% @@ -2448,13 +2640,74 @@ \prop_gput:Nnn \g_xassoccnt_latex_parentcounters_prop {####1} {##1} } } + % \prop_show:N \g_xassoccnt_latex_parentcounters_prop %\g_latex_cntr_subsubsection_seq \group_end: } +\cs_new:Nn \xassoccnt_full_reset_list_recursive_other:nn { + \seq_clear:N \l_tmpa_seq + \xassoccnt_local_list:nn {l_tmpa_seq} {#2} + \seq_map_inline:Nn \l_tmpa_seq {% + \seq_gput_right:cn {#1_fullresetlist_seq} {##1}% + \seq_remove_duplicates:c {#1_fullresetlist_seq } % Remove the duplicates + \xassoccnt_full_reset_list_recursive:nn {#1} {##1}% Recursive call + } +} + + % Gives the parent counter of a specific counter (or nothing) \cs_new:Npn \GetParentCounter #1{% - \prop_item:No \g_xassoccnt_latex_parentcounters_prop {#1} + \prop_if_in:NoT \g_xassoccnt_latex_parentcounters_prop {#1} {% + \prop_item:No \g_xassoccnt_latex_parentcounters_prop {#1} + } +} + + + + +\cs_new:Nn \__xassoccnt_parent_counter_chain:n {% + \int_gincr:N \g__xassoccnt_tmpa_int + \tl_set:Nx \l_tmpa_tl {#1} + \tl_set:Nx \l_tmpb_tl {\GetParentCounter{#1}} +% \seq_show:N \l__xassoccnt_tmpa_seq + \seq_gput_right:Nx \l__xassoccnt_tmpa_seq {\GetParentCounter{#1}} + \seq_remove_duplicates:N \l__xassoccnt_tmpa_seq + \tl_set:Nx \l_tmpb_tl {\GetParentCounter{\l_tmpa_tl}} + \int_compare:nNnF{\tl_count:N \l_tmpb_tl } = {0} { + \__xassoccnt_parent_counter_chain:V{\l_tmpb_tl} + } +} + + +\cs_new:Nn \xassoccnt_parent_counter_chain:n {% + \prop_if_exist:cTF {g_xassoccnt_#1_counter_chain_prop}{ + \prop_gclear:c {g_xassoccnt_#1_counter_chain_prop} + }{ + \prop_new:c {g_xassoccnt_#1_counter_chain_prop} + } + \seq_if_exist:cTF {g_xassoccnt_#1_counter_chain_seq} { + \seq_gclear:c {g_xassoccnt_#1_counter_chain_seq} + }{ + \seq_new:c {g_xassoccnt_#1_counter_chain_seq} + } + \prop_clear:N \g__xassoccnt_tmpa_prop + \seq_clear:N \l__xassoccnt_tmpa_seq + + \int_gzero:N \g__xassoccnt_tmpa_int + \prop_gput:NVx \g__xassoccnt_tmpa_prop {\g__xassoccnt_tmpa_int} {#1} + \seq_gput_right:Nx \l__xassoccnt_tmpa_seq {#1}% + \__xassoccnt_parent_counter_chain:x{#1} + \seq_gset_eq:cN {g_xassoccnt_#1_counter_chain_seq} \l__xassoccnt_tmpa_seq + \seq_pop_right:cN {g_xassoccnt_#1_counter_chain_seq} \l_tmpa_tl + \prop_gset_eq:cN {g_xassoccnt_#1_counter_chain_prop} \l__xassoccnt_tmpa_prop +} + +\cs_generate_variant:Nn \xassoccnt_parent_counter_chain:n {x,V} +\cs_generate_variant:Nn \__xassoccnt_parent_counter_chain:n {x,V} + +\NewDocumentCommand{\GetParentCounterChain}{m}{% + \xassoccnt_parent_counter_chain:n{#1} } @@ -2515,11 +2768,25 @@ } +\NewDocumentCommand{\DeclareTotalDocumentCounter}{O{}m}{% + \keys_set:nn {xassoccnt} {supertotal=false,#1} + \seq_set_from_clist:Nn \l_tmpa_seq {#2} + \seq_map_inline:Nn \l_tmpa_seq { + \__xassoccnt_ifis_latexcounter:nF {##1} {% Define the counter + \xassoccnt_declaredocumentcounter:nn{sloppy=false}{##1}% + }% + \__xassoccnt_registertotaldocumentcounter:nn{#1}{##1} + } +} + + + \cs_new:Nn \__xassoccnt_store_totalcounter_value:n {% - \prop_put:Nnn \g_xassoccnt_totalcounter_prop {#1} {\number\value{\__xassoccnt_expand_totalcountername:n{#1}}} - \prop_put:Nnn \g_xassoccnt_totalcounter_prop {#1name} {\__xassoccnt_expand_totalcountername:n{#1}} + \prop_gput:Nnn \g_xassoccnt_totalcounter_prop {#1} {\number\value{\__xassoccnt_expand_totalcountername:n{#1}}} + \prop_gput:Nnn \g_xassoccnt_totalcounter_prop {#1name} {\__xassoccnt_expand_totalcountername:n{#1}} + \prop_gput:Nxx \g_xassoccnt_totalcounter_prop {\__xassoccnt_expand_totalcountername:n{#1}} {#1}% back reference } \cs_new:Nn \__xassoccnt_registertotaldocumentcounter:nn {% @@ -2536,23 +2803,27 @@ \bool_if:NT \l__xassoccnt_is_supertotalcounter_bool {% \__xassoccnt_add_supertotalcounter:n {#2} } - \AtEndDocument{% - \__xassoccnt_writetotalcounters:nn {#2}{#2} - }% +% Removed on 2017/03/12 +% \AtEndDocument{% +% \__xassoccnt_writetotalcounters:nn {#2}{#2} +% }% }% } +\cs_generate_variant:Nn \__xassoccnt_registertotaldocumentcounter:nn {nx} + \NewDocumentCommand{\RegisterTotalDocumentCounter}{O{}m}{% \__xassoccnt_registertotaldocumentcounter:nn{#1}{#2}% } % Expandable version -\newcommand{\TotalValue}[1]{% +\cs_new:Npn \TotalValue #1{% \prop_item:Nn \g_xassoccnt_totalcounter_prop {#1}% } -\cs_new:Nn \__xassoccnt_writetotalcounters:nn {% + +\cs_new:Nn \__xassoccnt_writetotalcounters_old:nn {% \immediate\write\@mainaux {% \string\IfIsDocumentCounterF\expandafter{\__xassoccnt_expand_totalcountername:n{#1}}{\string\DeclareDocumentCounter\expandafter{\__xassoccnt_expand_totalcountername:n{#1}}} } @@ -2567,6 +2838,33 @@ } } +\cs_generate_variant:Nn \__xassoccnt_writetotalcounters_old:nn {nx,xx} + + +\cs_new_nopar:Nn \__xassoccnt_writetotalcounters_atend: {% + \seq_map_inline:Nn \g__xassoccnt_totalcounter_container { + \immediate\write\@mainaux{% + \string\IfIsDocumentCounterF{##1}{\string\DeclareDocumentCounter{##1}}^^J + } + \seq_if_in:NnTF \g__xassoccnt_supertotalcounter_container {##1} {% + \immediate\write\@mainaux{% + \string\setcounter{\__xassoccnt_expand_totalcountername:n{##1}}{\number\value{\__xassoccnt_expand_totalcountername:n{##1}}}% + } + }{% + \immediate\write\@mainaux{% + \string\setcounter{##1}{\number\value{\prop_item:Nn \g_xassoccnt_totalcounter_prop {##1}}} + } + } + } +} + +\NewDocumentCommand{\WriteCountersAtEnd}{}{% + \__xassoccnt_writetotalcounters_atend:% +} + + + + \NewDocumentCommand{\TotalCounterInternalNameExp}{m}{% \prop_item:Nn \g_xassoccnt_totalcounter_prop {#1name}% } @@ -2875,6 +3173,24 @@ } +\NewDocumentCommand{\LoopCounterResetList}{mm}{% + \seq_gclear:N \g_xassoccnt_reset_seq + \group_begin: + \cs_if_exist:cT {cl@#1} {% + \def\@elt##1{% + \seq_gput_right:Nn \g_xassoccnt_reset_seq {##1} + } + \use:c{cl@#1}% Fill the list + } + \group_end: + \seq_map_inline:Nn \g_xassoccnt_reset_seq {% + \use:c{\cs_to_str:N #2}{#1}{##1} + } +} + + + + %%%% %% Counter-Values-Mapping-To-Something-Different - Macros @@ -2913,6 +3229,211 @@ } +\cs_generate_variant:Nn \xassoccnt_declaredocumentcounter:nn {nx} + + +%%% Counter Output + + +\cs_new:Npn \BinaryValue#1{% + \int_to_bin:n{\number\value{#1}}% +} + +\cs_new:Npn \hexValue#1{% + \int_to_hex:n{\number\value{#1}}% +} + +\cs_new:Npn \HexValue#1{% + \int_to_Hex:n{\number\value{#1}}% +} + +\cs_new:Npn \OctalValue#1{% + \int_to_oct:n{\number\value{#1}}% +} + + +\cs_new:Npn \xalphalph #1 {% + \int_to_alph:n{\number\value{#1}} +} + +\cs_new:Npn \xAlphAlph #1 {% + \int_to_Alph:n{\number\value{#1}} +} + + +\cs_new:Nn \xassoccnt_default_counterformat:n{% + \arabic{#1}% +} + +\cs_new:Nn \xassoccnt_alphalph_wrapper:n{% + \xassoccnt_package_notloaded:nTF {alphalph}{% + \cs_set:cpn {the#1}{\int_to_alph:n{\number\value{#1}}} + }{% + \cs_set:cpn {the#1}{\alphalph{\value{#1}}} + } +} + +\cs_new:Nn \xassoccnt_AlphAlph_wrapper:n{% + \xassoccnt_package_notloaded:nTF {alphalph}{% + \cs_set:cpn {the#1}{\int_to_Alph:n{\number\value{#1}}} + }{% + \cs_set:cpn {the#1}{\AlphAlph{\value{#1}}} + } +} + + +\NewDocumentCommand{\alphalphinternal}{m}{% + \xassoccnt_alphalph_wrapper:n{#1} +} + +\NewDocumentCommand{\AlphAlphinternal}{m}{% + \xassoccnt_AlphAlph_wrapper:n{#1} +} + + + + +\keys_define:nn {xassoccnt(COUNTERFORMAT)} { + separator .initial:n={!}, + separator .code:n={\prop_put:Nnn \l__xassoccnt_tmpa_prop {counterformatseparator} {#1}}, + recursive .bool_set:N=\l_tmpa_bool +} + + +\cs_new:Nn \__xassoccnt_add_counter_formats:nn {% + \group_begin: + \seq_set_from_clist:Nn \l_tmpa_seq {#2} + \seq_map_inline:Nn \l_tmpa_seq {% + \seq_set_split:Nxn \l_tmpb_seq {#1} {##1} + \int_compare:nNnTF {\seq_count:N \l_tmpb_seq } > {1} { + \prop_gput:Nxx \g_xassoccnt_counter_formatdata_prop {\seq_item:Nn \l_tmpb_seq {1}} { \seq_item:Nn \l_tmpb_seq {2} } + }{ + \msg_fatal:nnx {xassoccnt}{counterformatwrongortooshort}{\seq_item:Nn \l_tmpb_seq {1}} + } + } + \group_end: +} + +\cs_new:Nn \__xassoccnt_remove_counter_formats:nn {% + \seq_set_from_clist:Nn \l_tmpa_seq {#2} + \seq_map_inline:Nn \l_tmpa_seq { + \prop_gremove:Nx \g_xassoccnt_counter_formatdata_prop {##1} + } +} + + + +\NewDocumentCommand{\StoreCounterFormats}{O{}m}{% + \group_begin: + \keys_set:nn {xassoccnt(COUNTERFORMAT)}{separator=!,#1} + \__xassoccnt_add_counter_formats:nn {\prop_item:Nn \l__xassoccnt_tmpa_prop {counterformatseparator}}{#2} + \group_end: +} + +\NewDocumentCommand{\AddCounterFormats}{O{}m}{% + \group_begin: + \keys_set:nn {xassoccnt(COUNTERFORMAT)}{separator={!},#1} + \__xassoccnt_add_counter_formats:nn {\prop_item:Nn \l__xassoccnt_tmpa_prop {counterformatseparator}}{#2} + \group_end: +} + +\NewDocumentCommand{\RemoveCounterFormats}{O{}m}{% + % First optional arg is reserved for later purposes + \__xassoccnt_remove_counter_formats:nn {}{#2} +} + +\NewDocumentCommand{\ClearCounterFormats}{}{% + \prop_gclear:N \g_xassoccnt_counter_formatdata_prop +} + +\NewDocumentCommand{\ShowCounterFormats}{}{% + \prop_map_inline:Nn \g_xassoccnt_counter_formatdata_prop {##1~uses~\cs_to_str:N ##2\par} +} + + + + +% \seq_item 1 / seq_item 2 +\cs_new:Nn \__xassoccnt_set_counterformat:nnn{% + \group_begin: + \tl_clear:N \l_tmpb_tl + \int_compare:nNnTF {#1} > {1} {% + \tl_set:Nx \l_tmpb_tl {#3} + }{% Only one or less arguments -> use \arabic as counter format} + \tl_set:Nn \l_tmpb_tl {n} % Arabic counter format (ar) + } + \prop_if_in:NVTF \g_xassoccnt_counter_formatdata_prop {\l_tmpb_tl} {% + \tl_clear:N \l_tmpa_tl + \tl_put_right:Nx \l_tmpa_tl { \prop_item:NV \g_xassoccnt_counter_formatdata_prop {\l_tmpb_tl}{#2}} + \cs_gset:cpV {the #2} {\l_tmpa_tl} + }{% + \msg_fatal:nnxx {xassoccnt}{counterformatnotdefined}{\tl_use:N \l_tmpb_tl}{#2} + } + \group_end: +} + + +\cs_new:Nn \xassoccnt_set_counterformat:n {% + \seq_set_split:Nxn \l_tmpb_seq {\prop_item:Nn \l__xassoccnt_tmpa_prop {counterformatseparator}} {#1} + + \__xassoccnt_set_counterformat:nnn { \seq_count:N \l_tmpb_seq }{ \seq_item:Nn \l_tmpb_seq {1}} { \seq_item:Nn \l_tmpb_seq {2} } +} + + + + + +\NewDocumentCommand{\CounterFormat}{O{}m}{% + \group_begin: + \keys_set:nn {xassoccnt(COUNTERFORMAT)}{recursive=false,separator={!},#1} + \bool_if:NTF \l_tmpa_bool {% + \xassoccnt_recursive_counter_format:n{#2} + }{% + \seq_set_from_clist:Nx \l_tmpa_seq {#2} + \seq_map_inline:Nn \l_tmpa_seq {% + \xassoccnt_set_counterformat:n {##1} + } + } + \group_end: +} + +\cs_new:Nn \__xassoccnt_recursive_counter_format:nn {% + \tl_set:Nx \l__xassoccnt_tmpb_tl {#2}% + \xassoccnt_parent_counter_chain:n {#1} + \seq_if_exist:cT {g_xassoccnt_#1_counter_chain_seq}{ + \seq_map_inline:cn {g_xassoccnt_#1_counter_chain_seq } {% + \int_incr:N \l__xassoccnt_tmpa_int + \int_compare:nNnTF{ \l__xassoccnt_tmpa_int} < {\seq_count:c {g_xassoccnt_#1_counter_chain_seq}} {% + \int_set:NV \l_tmpa_int { \l__xassoccnt_tmpa_int } + \int_incr:N \l_tmpa_int + \tl_set:Nn \l_tmpa_tl {\csname} + \tl_put_right:Nx \l_tmpa_tl {the\seq_item:cn {g_xassoccnt_#1_counter_chain_seq} {\l_tmpa_int}} + \tl_put_right:Nn \l_tmpa_tl {\endcsname.} + \tl_put_right:NV \l_tmpa_tl {\l__xassoccnt_tmpb_tl{##1}} + }{% + % Last element of the list, must only have its own representation usually, say \arabic{ + \tl_clear:N \l_tmpa_tl + \tl_put_right:NV \l_tmpa_tl {\l__xassoccnt_tmpb_tl{##1}} + } + \cs_gset:cpV {the##1} {\l_tmpa_tl} + } + }% End of \seq_if_exist:cT +} + +\cs_new:Nn \xassoccnt_recursive_counter_format:n {% + \group_begin: + \seq_set_split:Nxn \l_tmpb_seq {\prop_item:Nn \l__xassoccnt_tmpa_prop {counterformatseparator}} {#1} + % Get format + \tl_clear:N \l_tmpb_tl + \int_compare:nNnTF {\seq_count:N \l_tmpb_seq} > {1} {% + \tl_set:Nx \l_tmpb_tl {\seq_item:Nn \l_tmpb_seq {2}} + }{% Only one or less arguments -> use \arabic as counter format} + \tl_set:Nn \l_tmpb_tl {n} % Arabic counter format (n) + } + \__xassoccnt_recursive_counter_format:nn {\seq_item:Nn \l_tmpb_seq {1}}{\prop_item:NV \g_xassoccnt_counter_formatdata_prop {\l_tmpb_tl}} + \group_end: +} + %%%%%%%%%%%%%%%%%%%% @@ -3084,6 +3605,212 @@ } +%%%%%%%%%%%%%%%%%%%% + +%%% Counter names to human language maps + +\seq_new:N \g_xassoccnt_language_map_seq + + +\cs_new:Nn \__xassoccnt_declare_language_map:n {% + \seq_set_from_clist:Nx \l_tmpa_seq {#1} + \seq_map_inline:Nn \l_tmpa_seq { + \seq_gput_right:Nn \g_xassoccnt_language_map_seq {##1} + \prop_if_exist:cF {g_xassoccnt_language_map_##1_prop } { + \prop_new:c { g_xassoccnt_language_map_##1_prop } + } + } +} + +\cs_new:Nn \__xassoccnt_new_language_mapping:n { + \seq_if_in:NnTF \g_xassoccnt_language_map_seq {#1} { + \msg_warning:nnn{xassoccnt}{languagemappingalreadyexists} {#1} + }{ + \__xassoccnt_declare_language_map:n {#1} + } +} + + +\cs_new:Nn \__xassoccnt_declare_language_map:nn { + \__xassoccnt_new_language_mapping:n {#1 } + \__xassoccnt_add_language_mappings:nn {#1} {#2} +% \seq_set_from_clist:Nx \l_tmpa_seq {#2} +% \seq_new:c { g_xassoccnt_language_map_#1_seq } +% \seq_map_inline:Nn \l_tmpa_seq { +% \__xassoccnt_split_mapping_sequence:nn {#1} {##1} +% } +% \prop_log:c {g_xassoccnt_language_map_#1_prop } + +} + +\cs_new:Nn \__xassoccnt_add_language_mappings:nn {% + \group_begin: + \seq_set_from_clist:Nx \l_tmpa_seq {#2} + \seq_if_exist:cF { g_xassoccnt_language_map_#1_seq } { + \seq_new:c { g_xassoccnt_language_map_#1_seq } + } + \seq_map_inline:Nn \l_tmpa_seq { + \__xassoccnt_split_mapping_sequence:nn {#1} {##1} + } + \group_end: +} + + +\cs_new:Nn \__xassoccnt_use_if_empty:nn {% + \int_compare:nNnTF {\tl_count:n {#2} } = {0} { + #1 + }{% + #2 + } +} + +\cs_generate_variant:Nn \__xassoccnt_use_if_empty:nn {nx,no,xx,xn} + + +\cs_new:Nn \prop_put_uppercase_first:Nnn { + \prop_put:Nnn #1 {#2} {\__xassoccnt_uppercase_first:n {#3}} +} + +\cs_new:Nn \prop_gput_uppercase_first:Nnn {% + \typeout{Content~is~#3} + \tl_set:Nn \l_tmpa_tl {#3} + %\__xassoccnt_uppercase_first:n { + \typeout{Content is \tl_use:N \l_tmpa_tl} + \prop_gput:NnV #1 {#2} {\l_tmpa_tl } +} + + +\cs_new:Nn \prop_gput_uppercase_first:Nnnn {% + \tl_if_empty:nTF {#4} { + \prop_gput:Nnx #1 {#2} {\__xassoccnt_uppercase_first:n {#3}} + }{ + \prop_gput:NnV #1 {#2} {\__xassoccnt_uppercase_first:n {#4}} + } +% \tl_set:Nn \l_tmpa_tl {#3} +% %\__xassoccnt_uppercase_first:n { +% \typeout{Content is \tl_use:N \l_tmpa_tl} +% \prop_gput:NnV #1 {#2} {\l_tmpa_tl } +} + + +\cs_new:Nn \__xassoccnt_uppercase_first:n {% + \tl_upper_case:n {\tl_head:n{#1}}\tl_tail:n{#1} +% \typeout{ \tl_upper_case:n {\tl_head:n{#1}}\tl_tail:n{#1}}% +% \typeout{ \tl_upper_case:n {\tl_head:n{#1}}\tl_tail:n{#1}} +} + +\cs_generate_variant:Nn \__xassoccnt_uppercase_first:n {x,o,c,V} + +\cs_generate_variant:Nn \prop_put_uppercase_first:Nnn {Nxx,Nnx,Nno,Nxn, cxn, cno,cxx,cnn} +\cs_generate_variant:Nn \prop_gput_uppercase_first:Nnn {Nxx,Nnx,Nno,Nxn, cxn, cno,cxx,cnn} + +\cs_generate_variant:Nn \prop_gput_uppercase_first:Nnnn {Nxxx,Nnxx,cxxx,cnnn} + + + + +\cs_new:Nn \__xassoccnt_split_mapping_sequence:nn {% + \group_begin: + \seq_set_split:Nnn \l_tmpb_seq {;;} {#2} + \seq_gput_right:cx {g_xassoccnt_language_map_#1_seq } { \seq_item:Nn \l_tmpb_seq {1}} + \int_compare:nNnT { \seq_count:N \l_tmpb_seq } = { \c_one } + { + % Append the first element to be the reference entry + \seq_put_right:Nx \l_tmpb_seq { \seq_item:Nn \l_tmpb_seq {1} } + } +% \seq_map_inline:Nn \l_tmpb_seq {\typeout{##1~}} + \typeout{Checking arg 2} + \prop_gput:cxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}-singular} {\__xassoccnt_use_if_empty:xn{\seq_item:Nn \l_tmpb_seq {2}}{\seq_item:Nn \l_tmpb_seq {2}}} + \typeout{Checking arg 3} + \prop_gput:cxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}-plural} {\__xassoccnt_use_if_empty:xn{\seq_item:Nn \l_tmpb_seq {2}}{\seq_item:Nn \l_tmpb_seq {3}}} + \typeout{Checking arg 4} +% \prop_gput_uppercase_first:cxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}-uppercase-singular} {\__xassoccnt_use_if_empty:xn{\seq_item:Nn \l_tmpb_seq {2}}{\seq_item:Nn \l_tmpb_seq {4}}} + + \prop_gput_uppercase_first:cxxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}-uppercase-singular} {\seq_item:Nn \l_tmpb_seq {2}}{\seq_item:Nn \l_tmpb_seq {4}} + + \prop_gput_uppercase_first:cxxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}-uppercase-plural} {\seq_item:Nn \l_tmpb_seq {2}}{\seq_item:Nn \l_tmpb_seq {5}} + + +% \prop_gput:cxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}-uppercase-singular} {\__xassoccnt_uppercase_first:x{\__xassoccnt_use_if_empty:nn{\seq_item:Nn \l_tmpb_seq {2}}{\seq_item:Nn \l_tmpb_seq {4}}}} +% \prop_gput:cxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}-uppercase-plural} {\__xassoccnt_uppercase_first:x{\__xassoccnt_use_if_empty:nn{\seq_item:Nn \l_tmpb_seq {2}s}{\seq_item:Nn \l_tmpb_seq {5}}}} +% \prop_show:c { g_xassoccnt_language_map_#1_prop } + \group_end: +} + + + +% \seq_show:N \l_tmpb_seq +% \prop_gput:cxx { g_xassoccnt_language_map_#1_prop } {\seq_item:Nn \l_tmpb_seq {1}} {\__xassoccnt_use_if_empty:xn{\seq_item:Nn \l_tmpb_seq {2}}{\seq_item:Nn \l_tmpb_seq {1}}} + + +\cs_generate_variant:Nn \__xassoccnt_declare_language_map:nn {nx,xx} +\cs_generate_variant:Nn \__xassoccnt_declare_language_map:n {x} + + +\NewDocumentCommand{\DeclareLanguageMap}{m}{% + \__xassoccnt_declare_language_map:n {#1} +} + +\NewDocumentCommand{\DeclareLanguageMappings}{m+m}{% + \__xassoccnt_declare_language_map:nn {#1}{#2} +} + +\NewDocumentCommand{\AddLanguageMappings}{m+m}{% + \__xassoccnt_add_language_mappings:nn{#1}{#2}% +} + + + +\cs_generate_variant:Nn \prop_map_inline:Nn {Nx,cx} + +\NewDocumentCommand{\ShowLanguageMappings}{m}{% + \seq_map_inline:cn {g_xassoccnt_language_map_#1_seq }{% + ##1 ~ \prop_item:cx { g_xassoccnt_language_map_#1_prop } { ##1-singular } ~ \prop_item:cx { g_xassoccnt_language_map_#1_prop } { ##1-plural } ~ \prop_item:cx { g_xassoccnt_language_map_#1_prop } { ##1-uppercase-singular } ~ \prop_item:cx { g_xassoccnt_language_map_#1_prop } { ##1-uppercase-plural } \par + } + %\prop_map_inline:cn {g_xassoccnt_language_map_#1_prop }{#1 ~ ##1 ~ ##2 \par} +} + + +\cs_new:Npn \RetrieveCounterSingularName #1#2{% + \prop_item:cn {g_xassoccnt_language_map_#1_prop }{#2-singular} +} + +\cs_new:Npn \SetLanguageMapping #1 {% + \seq_if_in:NnTF \g_xassoccnt_language_map_seq {#1} { + \prop_gput:Nnn \g_xassoccnt_module_data_prop {currentlanguage} {#1} + }{% Begin of False + \msg_error:nnn{xassoccnt}{undefinedlanguagemapping}{#1} + }% End of False +} + +\cs_new:Npn \GetLanguageMapping {% + \prop_item:Nn \g_xassoccnt_module_data_prop {currentlanguage} +} + + + +\cs_new:Npn \xassingularname #1#2 {% + \prop_item:cn {g_xassoccnt_language_map_#1_prop }{#2-singular} +} + +\cs_new:Npn \xaspluralname #1#2 {% + \prop_item:cn {g_xassoccnt_language_map_#1_prop }{#2-plural} +} + + +%%%%%%%%%%%%%%%%%%% + +% This is ad-hoc code for a yet - to be defined bool <-> prop list matching code + +\cs_new:Npn \PropertyHasValueTF #1#2#3#4 {% + \int_compare:nNnTF {\prop_item:Nn \g_xassoccnt_module_data_prop {#1}} = {#2} { + #3 + }{% + #4 + } +} + + \ExplSyntaxOff \EnableNumberofrunsTF{% @@ -3103,7 +3830,7 @@ -\@onlypreamble{\NewTotalDocumentCounter} +\@onlypreamble{\DeclareTotalDocumentCounter} \@onlypreamble{\RegisterTotalDocumentCounter} \@onlypreamble{\DeclareAssociatedCounters} \@onlypreamble{\DeclareTotalAssociatedCounters} @@ -3119,9 +3846,15 @@ } \AtBeginDocument{% + \PropertyHasValueTF{standardcounterformats} {1} {% + \StoreCounterFormats{n!\arabic, b!\BinaryValue,h!\hexValue,H!\HexValue,r!\roman,R!\Roman,A!\Alph,a!\alph,aa!\xalphalph,o!\OctalValue,AA!\xAlphAlph}% + }{} \DeclareBackupCountersGroupName{scratch}% } +\AtEndDocument{% + \WriteCountersAtEnd% +} %%% Colour output routines @@ -3131,7 +3864,6 @@ \newcommand{\TotalCounterInfoColor}{violet} - \AddFeature[sublists=true,publicname={Coupled Counters Feature}]{coupledcounters} \AddFeature[sublists=true,publicname={Backup Counters Feature}]{backupcounters} % New style, not fully implemented so far |