Debian Codegraph @

texmf-dist/doc/latex/xassoccnt/xassoccnt_resetloop_example.tex

raw
1 %% LaTeX package xassoccnt - version 2.0 (2021/11/21 -- 12:14:58)
2 %% Example file for looping through the reset list file for xassoccnt.sty
3 %%
4 %%
5 %% -------------------------------------------------------------------------------------------
6 %% Copyright (c) 2017 -- 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{xassoccnt}
25
26 \usepackage{chngcntr}
27
28
29 \makeatletter
30
31 \AtBeginDocument{%
32 \let\latex@@chapter\chapter
33 \RenewDocumentCommand{\chapter}{sO{#3}m}{%
34 \IfBooleanTF{#1}{%
35 \latex@@chapter*{#3}%
36 }{%
37 \ifnogobblechapter
38 \latex@@chapter[#2]{#3}
39 \fi
40 }%
41 }
42 }
43 \makeatother
44
45 \newcommand{\counterwithoutwrapper}[2]{%
46 \counterwithout{#2}{#1}%
47 }
48
49 \newif\ifnogobblechapter
50 \nogobblechapterfalse
51
52 \usepackage{hyperref}
53
54 \begin{document}
55
56 \ifnogobblechapter
57 \else
58 \ClearCounterResetList*{chapter}
59 %\LoopCounterResetList{chapter}{\counterwithoutwrapper}
60 \fi
61
62 \tableofcontents
63
64 \chapter[Foo entry to ToC]{Foo Chapter}
65
66 \section{A subsection of a gobbled chapter}
67
68 \begin{figure}
69 \caption{A figure caption}
70 \end{figure}
71
72 \chapter{Another chapter}
73
74 \begin{figure}
75 \caption{Another figure caption}
76 \end{figure}
77
78 Some other content
79
80 \end{document}