| 1 |
%% LaTeX package xassoccnt - version 2.0 (2021/11/21 -- 12:14:58) |
| 2 |
%% Example file for reset list features file for xassoccnt.sty |
| 3 |
%% |
| 4 |
%% |
| 5 |
%% ------------------------------------------------------------------------------------------- |
| 6 |
%% Copyright (c) 2016 -- 2021 by Dr. Christian Hupfer <> |
| 7 |
%% ------------------------------------------------------------------------------------------- |
| 8 |
%% |
| 9 |
%% This work may be distributed and/or modified under the |
| 10 |
%% conditions of the LaTeX Project Public License, either version 1.3 |
| 11 |
%% of this license or (at your option) any later version. |
| 12 |
%% The latest version of this license is in |
| 13 |
%% http://www.latex-project.org/lppl.txt |
| 14 |
%% and version 1.3 or later is part of all distributions of LaTeX |
| 15 |
%% version 2005/12/01 or later. |
| 16 |
%% |
| 17 |
%% |
| 18 |
%% This work has the LPPL maintenance status `unmaintained` |
| 19 |
%% |
| 20 |
%% |
| 21 |
|
| 22 |
\documentclass{book} |
| 23 |
|
| 24 |
\usepackage{chngcntr} |
| 25 |
\usepackage{alphalph} |
| 26 |
\usepackage{xassoccnt} |
| 27 |
|
| 28 |
\DeclareDocumentCounter{dummyctra}[chapter] |
| 29 |
|
| 30 |
\DeclareDocumentCounter{dummyctrb} |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
\newcommand{\showfullresetlist}[1]{% |
| 35 |
\item Counter name: #1 \hfill \csname the#1\endcsname%\leavevmode% |
| 36 |
} |
| 37 |
|
| 38 |
\usepackage{hyperref} |
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
\begin{document} |
| 43 |
|
| 44 |
\CounterFormat{dummyctrb!o} |
| 45 |
|
| 46 |
\tableofcontents |
| 47 |
|
| 48 |
\chapter{First} |
| 49 |
|
| 50 |
\section{First section} |
| 51 |
\begin{itemize} |
| 52 |
\LoopFullCounterResetList{chapter}{\showfullresetlist} |
| 53 |
\end{itemize} |
| 54 |
|
| 55 |
\begin{figure} |
| 56 |
\caption{A dummy figure} |
| 57 |
\end{figure} |
| 58 |
|
| 59 |
Removing the section counter from the chapter reset list! |
| 60 |
\RemoveFromFullReset{section}{chapter} |
| 61 |
|
| 62 |
|
| 63 |
\chapter{Second Chapter} |
| 64 |
|
| 65 |
\section{First section in 2nd chapter} |
| 66 |
\begin{itemize} |
| 67 |
\LoopFullCounterResetList{chapter}{\showfullresetlist} |
| 68 |
\end{itemize} |
| 69 |
|
| 70 |
\begin{figure} |
| 71 |
\caption{Another dummy figure} |
| 72 |
\end{figure} |
| 73 |
|
| 74 |
|
| 75 |
\AddToReset{section}{chapter} |
| 76 |
|
| 77 |
|
| 78 |
\CounterWithin{dummyctrb}{chapter} |
| 79 |
|
| 80 |
|
| 81 |
\CounterWithout*{section}{chapter} |
| 82 |
|
| 83 |
|
| 84 |
\chapter{Third Chapter} |
| 85 |
|
| 86 |
\section{First section in 3rd chapter} |
| 87 |
|
| 88 |
\setcounter{dummyctrb}{4} |
| 89 |
|
| 90 |
\begin{itemize} |
| 91 |
\LoopFullCounterResetList{chapter}{\showfullresetlist} |
| 92 |
\end{itemize} |
| 93 |
|
| 94 |
\begin{figure} |
| 95 |
\caption{Another dummy figure} |
| 96 |
\end{figure} |
| 97 |
|
| 98 |
\GetAllResetLists |
| 99 |
|
| 100 |
\chapter[Parent counter of another counter]{Determing the parent counter of a counter} |
| 101 |
|
| 102 |
\section{Some dummy section} |
| 103 |
|
| 104 |
The last ref stepped counter is \LastRefSteppedCounter |
| 105 |
|
| 106 |
\fbox{\GetParentCounter{\LastRefSteppedCounter}} |
| 107 |
|
| 108 |
\AddToReset{dummyctra}{section} |
| 109 |
|
| 110 |
\GetAllResetLists |
| 111 |
\noindent\GetParentCounter{dummyctra} |
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
\end{document} |