summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/xassoccnt/xassoccnt_coupledcounters_example.tex
blob: b5338ac8e339c8e5ceb70043233130803b65afb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
%% LaTeX package xassoccnt - version 1.8 (2020/07/19 -- 12:38:30)
%% Example file for coupled counters file for xassoccnt.sty
%%
%%
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2016 -- 2020 by Dr. Christian Hupfer <dr dot christian dot hupfer 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}

\usepackage{caption}
\usepackage{xassoccnt}
\usepackage{blindtext}


\usepackage{hyperref}

\DeclareCoupledCountersGroup{figuretablebundle}

\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table}

\DeclareCoupledCounters[name=figuretablebundle,multiple=false]{figure,table,figure}

\DeclareCoupledCounters[name=sectionequationbundle]{section,equation}

\begin{document}

\AddCoupledCounters[name=figuretablefoo]{figure,table,figure}

\listoffigures
\listoftables

\section{First}


\blindtext[10]

\begin{figure}[!ht]

\caption{A figure}
\end{figure}

A footnote here\footnote{Myfootnote}

\blindtext[10]


\begin{table}[!ht]
\caption{A table}
\end{table}

\begin{equation}
  E=mc^2
\end{equation}

\section{Second}

\blindtext[10]

\begin{figure}[!ht]

\caption{A foo figure}
\end{figure}

\blindtext[10]


\begin{table}[!ht]
\caption{A foo table}
\end{table}



\begin{table}[!ht]
\caption{A foobar table}
\end{table}



\begin{figure}[!ht]

\caption{A foobar figure}
\end{figure}

\blindtext[10]

\begin{table}[!ht]
\caption{Yet another foo table}
\end{table}



\begin{figure}[!ht]

\caption{Yet another foo figure}
\end{figure}

\RemoveCoupledCounters[name=figuretablebundle]{figure}
\addcontentsline{lof}{section}{After using RemoveCoupledCounters for figure}

\blindtext[10]

\begin{figure}[!ht]

\caption{An intermediate figure that is not coupled}
\end{figure}


\begin{table}[!ht]
\caption{Yet another foobar table}
\end{table}

\begin{table}[!ht]
\caption{Even more foobar table}
\end{table}

\begin{table}[!ht]
\caption{Even most foobar table}
\end{table}



\begin{figure}[!ht]

\caption{Even more foobar figure}
\end{figure}

\clearpage

\begin{figure}[!ht]

\caption{Another intermediate figure that is not coupled}
\end{figure}


\AddCoupledCounters[name=figuretablebundle]{figure}

\addcontentsline{lof}{section}{After using AddCoupledCounters for figure again}

\begin{figure}[!ht]
\caption{Even most foobar figure}
\end{figure}

\begin{table}[!ht]
\caption{Another coupled table}
\end{table}

\begin{figure}[!ht]
\caption{Another coupled figure}
\end{figure}


\ClearAllCoupledCounters
\clearpage

\addcontentsline{lof}{section}{After using ClearAllCoupledCounters}
\addcontentsline{lot}{section}{After using ClearAllCoupledCounters}

\begin{figure}[!ht]
\caption{Almost next to last figure}
\end{figure}


\begin{table}[!ht]
\caption{Almost next to last table}
\end{table}

\begin{figure}[!ht]
  \caption{Next to last figure}
\end{figure}

\begin{table}[!ht]
  \caption{Next to last table}
\end{table}



\AddCoupledCounters[name=figuretablebundle]{figure,table}
\addcontentsline{lof}{section}{After using AddCoupledCounters}
\addcontentsline{lot}{section}{After using AddCoupledCounters}


\begin{figure}[!ht]
\caption{The last figure}
\end{figure}

\begin{table}[!ht]
\caption{The last table}
\end{table}



\end{document}