Debian Codegraph @

texmf-dist/source/latex/tableof/tableof.dtx

raw
1 % -*- coding: utf-8; -*-
2 %<*none>
3 {\def\doctimestamp {Time-stamp: <17-09-2024 10:15:25 CEST>}%
4 \def\getdtxtimestamp #1 <#2 #3 #4>{#2 at #3 #4}%
5 \xdef\tofdtxtimestamp {\expandafter\getdtxtimestamp\doctimestamp }}%
6 %</none>
7 %%
8 %% Package: tableof
9 %% Version: 1.4d (2024/09/17)
10 %% License: LPPL 1.3c
11 %% Copyright (C) 2012, 2013, 2015, 2018, 2021, 2024 Jean-Francois Burnol <jfbu at free dot fr>
12 %%
13 % See README.md for installation instructions
14 %
15 % This Work may be distributed and/or modified under the
16 % conditions of the version 1.3c of the LaTeX Project Public License.
17 % This version of this license is in
18 % http://www.latex-project.org/lppl/lppl-1-3c.txt
19 % and version 1.3 or later is part of all distributions of
20 % LaTeX version 2005/12/01 or later.
21 %
22 % The Author of this Work is: Jean-Francois Burnol <jfbu at free dot fr>
23 %<*none>
24 \def\pkgname {tableof}
25 \def\pkgdate {2024/09/17}
26 \def\pkgversion {v1.4d}
27 \def\pkgdescription {Tables of tagged contents (JFB)}
28 \begingroup
29 \input docstrip.tex
30 \askforoverwritefalse
31 \def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J%
32 \string\ProvidesPackage{\pkgname}^^J%
33 \space[\pkgdate\space\pkgversion\space\pkgdescription]}
34 \generate{\usepreamble\defaultpreamble
35 \file{\pkgname test.tex}{\from{\pkgname.dtx}{test}}
36 \usepreamble\pkgpreamble
37 \file{\pkgname.sty}{\from{\pkgname.dtx}{package}}}
38 \endgroup
39 \ifdefined\documentclass\else
40 \newlinechar13 \catcode13 12 \immediate\write128{%
41 ********************************************************************
42 *
43 * To finish the installation you have to move the following
44 * file into a repertory searched by TeX:
45 *
46 * \space\space\space\space tableof.sty
47 *
48 * To produce the tableof.pdf documentation, run "latexmk"
49 * on tableof.dtx then "dvipdfmx" on tableof.dvi
50 * (or latex thrice then dvipdfmx)
51 *
52 * Notice that this will again extract tableof.sty in the current
53 * repertory.
54 *
55 * Happy TeXing!
56 *
57 ********************************************************************}%
58 \endinput\expandafter\end\fi%
59 \ProvidesFile{\pkgname.dtx}%
60 [\pkgname source and documentation (\tofdtxtimestamp)]
61 \iffalse
62 %</none>
63 %<*test>
64 %-------------------------------------------------------------------------------
65 %% This file `tableoftest.tex' serves to demontrate the use of the
66 %% commands from the package `tableof'.
67 %%
68 %% (run on it `latex' or `pdflatex' twice.)
69 %%
70 \documentclass{article}
71 \usepackage[T1]{fontenc}
72 \usepackage[colorlinks,linkcolor=blue]{hyperref}
73 \usepackage{tableof}
74 %%\usepackage{etoc} % for testing
75 \DeclareRobustCommand\lowast{\raisebox{-.25\height}{*}}
76 \begin{document}
77 %% \etoctoclines % (if using package etoc)
78 %%
79 %% we don't need here \tofOpenTocFileForWrite
80 %% as the document has \tableofcontents a few lines down.
81 %%
82 \section*{\string\tableof\{\}}
83 \tableof{}
84 \section*{\string\tableof\lowast\{A,B,C,D,E,F\}}
85 % vérifions que c'est bon avec les espaces: (1.3 de 2015/02/11)
86 \tableof*{ A, B,C , D , E, F }
87 \section*{\string\tableof\{A\}}
88 \tableof{A}
89 \section*{\string\tableof\lowast\{A\}}
90 \tableof*{A}
91 \section*{\string\tableof\{A,C\}}
92 \tableof{ A ,C }
93 \section*{\string\tableof\lowast\{A,C\}}
94 \tableof*{A, C }
95 \section*{\string\tableoftaggedcontents\lowast\{A,D\}\{B,F\}}
96 \tableoftaggedcontents*{ A,D}{B, F}
97 \renewcommand\contentsname{\string\nexttocwithtags\lowast\{A,D\}\lowast\{B,F\}\string\tableofcontents}
98 \nexttocwithtags*{ A , D}*{B ,F}
99 \tableofcontents
100 %% requires package etoc
101 %% \etoctocstyle{1}{with A and D and without B and without F}
102 %% \nexttocwithtags{A,D}{B,F}\tableofcontents
103 %% \etoctocstyle{1}{with (A or D) and without B and without F}
104 %% \nexttocwithtags*{A,D}{B,F}\tableofcontents
105 %% \etoctocstyle{1}{with A and D and (without B or without F)}
106 %% \nexttocwithtags{A,D}*{B,F}\tableofcontents
107 \section*{with B or with C (using \string\tableoftaggedcontents)}
108 \tableoftaggedcontents*{B, C}{}
109 \section*{with B or with C (using \string\tableof\lowast)}
110 \tableof*{B, C}
111 \section*{with A and with B and with C}
112 \tableof{A, B, C}
113 \section*{with A or with B or with C}
114 \tableof*{ A,B ,C }
115 \section*{without B (and) (using \string\tableoftaggedcontents)}
116 \tableoftaggedcontents{}{B}
117 \section*{without A and without B (using \string\tableoftaggedcontents)}
118 \tableoftaggedcontents{}{A , B}
119 \section*{without A or without C}
120 \tablenotof*{ A, C}
121 \section*{without A and without B and without C}
122 \tablenotof{ A , B , C}
123 \section*{without A or without B or without C}
124 \tablenotof*{A, B,C }
125 \section*{with D and with E}
126 \tableof{D,E}
127 \section*{with E}
128 \tableof{E}
129 \section*{without D}
130 \tablenotof{D}
131 \section*{ecology and rabbits}
132 \tableof{ ecology , rabbits }
133 \section*{rabbits and not ecology}
134 \tableoftaggedcontents{ rabbits }{ ecology }
135 \section*{kitchenware and not rabbits}
136 \tableoftaggedcontents{ kitchenware }{ rabbits}
137 \clearpage
138 \section{no tag}
139 nothing
140 \begin{verbatim}
141 \toftagstart{D,E,F}
142 \toftagthis{A}
143 \end{verbatim}
144 \toftagstart{ D, E, F }
145 \toftagthis{A}
146 \section{A,D,E,F}
147 A,D,E,F
148 \begin{verbatim}
149 \toftagthis{B}
150 \end{verbatim}
151 \toftagthis{B}
152 \section{B,D,E,F}
153 B,D,E,F
154 \begin{verbatim}
155 \toftagthis{C}
156 \end{verbatim}
157 \toftagthis{ C }
158 \section{C,D,E,F}
159 C,D,E,F
160 \begin{verbatim}
161 \toftagstop{F}
162 \toftagthis{A,B}
163 \end{verbatim}
164 \toftagstop{F}
165 \toftagthis{ A,B}
166 \section{A,B,D,E}
167 A,B,D,E
168 \begin{verbatim}
169 \toftagthis{B,C}
170 \end{verbatim}
171 \toftagthis{B, C}
172 \section{B,C,D,E}
173 B,C,D
174 \begin{verbatim}
175 \toftagthis{A,C}
176 \toftagstop{E}
177 \end{verbatim}
178 \toftagthis{ A, C}
179 \toftagstop{ E}
180 \section{A,C,D}
181 A,C,D
182 \begin{verbatim}
183 \toftagstop{D}
184 \toftagthis{A,B,C}
185 \end{verbatim}
186 \toftagstop{D }
187 \toftagthis{A,B,C }
188 \section{A,B,C}
189 A,B,C
190 \begin{verbatim}
191 \toftagstop{A,B,C,D,E,F}
192 \toftagstart{kitchenware,rabbits}
193 \end{verbatim}
194 \toftagstop{A,B, C,D,E,F}
195 \toftagstart{ kitchenware,rabbits}
196 \section{Knives and rabbits}
197 \begin{verbatim}
198 \tofuntagthis{kitchenware}
199 \end{verbatim}
200 \tofuntagthis{kitchenware}
201 \subsection{Hunting rabbits}
202 \begin{verbatim}
203 \tofuntagthis{rabbits}
204 \end{verbatim}
205 \tofuntagthis{rabbits}
206 \subsection{Best knives for cooking}
207 \subsection{Eating rabbits}
208 \begin{verbatim}
209 \toftagstart{ecology}\tofuntagthis{rabbits}
210 \end{verbatim}
211 \toftagstart{ecology}\tofuntagthis{ rabbits}
212 \section{Knives and global climate}
213 \begin{verbatim}
214 \toftagstop{kitchenware}
215 \end{verbatim}
216 \toftagstop{kitchenware }
217 \section{The rabbit in the wild}
218 \subsection{Impact of the rabbit on global climate}
219 \begin{verbatim}
220 \toftagstop{rabbits}
221 \end{verbatim}
222 \toftagstop{ rabbits}
223 \section{Other species of interest for cooking}
224 \end{document}\endinput
225 %-------------------------------------------------------------------------------
226 %</test>
227 %<*none>
228 \fi
229 \makeatletter
230 \@for\@tempa:=hyperref,bookmark,graphicx,color\do
231 {\PassOptionsToPackage{dvipdfmx}\@tempa}
232 %
233 \PassOptionsToPackage{dvipdfm}{geometry}
234 \PassOptionsToPackage{bookmarks=true}{hyperref}
235 \PassOptionsToPackage{dvipdfmx-outline-open}{hyperref}
236 % obsolete
237 % \PassOptionsToPackage{dvipdfmx-outline-open}{bookmark}
238 %
239 \makeatother
240 \documentclass[a4paper,fontsize=11pt,abstract]{scrartcl}
241 \makeatletter
242 %%% START OF CUSTOM doc.sty LOADING (May 21, 2022 in xint.dtx)
243 %%% (August 26, 2022 in etoc.dtx, comments trimmed)
244 %%% (September 17, 2024 here, some unneeded stuff removed,
245 %%% I do not have time to do the syntax coloring as in etoc.pdf,
246 %%% and in particular there is here no reason to use doc=v2)
247
248
249 % At 1.4d I wanted to use doc v3, but hypdoc is causing too much trouble.
250 % - a warning in the log about hyperref already loaded,
251 % - an overwrite of my hidelinks option,
252 % - an impact on placement of codeline numbers in implementation part.
253 \usepackage{doc}[=v2]
254 % As explained above I was formerly using scrdoc hence ltxdoc indirectly.
255 % Let's emulate here the little I appear to need from ltxdoc.cls and
256 % srcdoc.cls.
257 %
258 \AtBeginDocument{\MakeShortVerb{\|}}
259 \DeclareFontShape{OT1}{cmtt}{bx}{n}{<-> ssub * cmtt/m/n}{}
260 \DeclareFontFamily{OMS}{cmtt}{\skewchar\font 48} % '60
261 \DeclareFontShape{OMS}{cmtt}{m}{n}{<-> ssub * cmsy/m/n}{}
262 \DeclareFontShape{OMS}{cmtt}{bx}{n}{<-> ssub * cmsy/b/n}{}
263 \DeclareFontShape{OT1}{cmss}{m}{it}{<->ssub*cmss/m/sl}{}
264 \CodelineNumbered
265 % \EnableCrossrefs % but this will be hacked
266 % \setcounter{StandardModuleDepth}{1} % we don't use this mechanism currently
267 \def\cmd#1{\cs{\expandafter\cmd@to@cs\string#1}}
268 \def\cmd@to@cs#1#2{\char\number`#2\relax}
269 % Here I am loading doc=v2 but formerly I was using ltxdoc via scrdoc
270 % which I dropped at release 1.4l (2022-05-29) and without much
271 % thinking I had kept this.
272 \DeclareRobustCommand\cs[1]{\texttt{\bslash#1}}
273 % As I may have the * active, or macro names with _ or ^, I should
274 % add \detokenize. But see below for a redefinition anyhow.
275 %
276 % More urgent is that I am also using hyperref and this definition gives wrong
277 % bookmarks if \cs is used in section titles. As I had very very few usags of
278 % \cs in the whole of xint.dtx, it took me a while to realize the problem
279 % here. Turns out that doc=v3 by default loads hypdoc which includes this
280 % configuration for hyperref compatibility:
281 \AtBeginDocument{%
282 \pdfstringdefDisableCommands{\def\cs#1{\textbackslash\detokenize{#1}}}%
283 }%
284 % As I have not loaded hyperref yet I must delay it to AtBeginDocument.
285 \providecommand\marg[1]{%
286 {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
287 \providecommand\oarg[1]{%
288 {\ttfamily[}\meta{#1}{\ttfamily]}}
289 \providecommand\parg[1]{%
290 {\ttfamily(}\meta{#1}{\ttfamily)}}
291 % \@addtoreset{CodelineNo}{part}% No need for this here
292 % \def\partname{File}% \partname is "fixed" somewhere further down anyhow
293 % No need for this, anyhow I don't build the indices
294 % \gdef\codeline@wrindex#1{\if@filesw
295 % \begingroup
296 % \let\protect\noexpand
297 % \immediate\write\@indexfile
298 % {\string\indexentry{#1}%
299 % {\filesep\number\c@CodelineNo}}%
300 % \endgroup\fi}
301 % \let\filesep\@empty
302
303 % There is very little we seem to need from the scrdoc extras: page geometry
304 % is set by geometry package and a4paper option from xint.tex file. So it
305 % seems I only need the hologo loading:
306 \usepackage{hologo}
307 %\DeclareRobustCommand*{\eTeX}{\hologo{eTeX}}%
308 %\DeclareRobustCommand*{\LuaTeX}{\hologo{LuaTeX}}%
309 %
310 \makeatother
311 %%% end of ltxdoc+srcdoc emulation from June 2022 xint.dtx,
312 %%% copied over almost verbatim to etoc.dtx on 2022/08/26,
313 %%% and copied and trimmed for tableof.dtx 2024/09/17.
314
315 \pagestyle{headings}
316 \usepackage[T1]{fontenc}
317 \usepackage[hscale=0.66,vscale=0.76]{geometry}
318 \usepackage{centeredline}
319 \usepackage{txfonts}
320 \DeclareFontFamily{T1}{txtt}{}
321 \DeclareFontShape{T1}{txtt}{m}{n}{ %medium
322 <->s*[.96] t1xtt%
323 }{}
324 \DeclareFontShape{T1}{txtt}{m}{sc}{ %cap & small cap
325 <->s*[.96] t1xttsc%
326 }{}
327 \DeclareFontShape{T1}{txtt}{m}{sl}{ %slanted
328 <->s*[.96] t1xttsl%
329 }{}
330 \DeclareFontShape{T1}{txtt}{m}{it}{ %italic
331 <->ssub * txtt/m/sl%
332 }{}
333 \DeclareFontShape{T1}{txtt}{m}{ui}{ %unslanted italic
334 <->ssub * txtt/m/sl%
335 }{}
336 \DeclareFontShape{T1}{txtt}{bx}{n}{ %bold extended
337 <->t1xbtt%
338 }{}
339 \DeclareFontShape{T1}{txtt}{bx}{sc}{ %bold extended cap & small cap
340 <->t1xbttsc%
341 }{}
342 \DeclareFontShape{T1}{txtt}{bx}{sl}{ %bold extended slanted
343 <->t1xbttsl%
344 }{}
345 \DeclareFontShape{T1}{txtt}{bx}{it}{ %bold extended italic
346 <->ssub * txtt/bx/sl%
347 }{}
348 \DeclareFontShape{T1}{txtt}{bx}{ui}{ %bold extended unslanted italic
349 <->ssub * txtt/bx/sl%
350 }{}
351 \DeclareFontShape{T1}{txtt}{b}{n}{ %bold
352 <->ssub * txtt/bx/n%
353 }{}
354 \DeclareFontShape{T1}{txtt}{b}{sc}{ %bold cap & small cap
355 <->ssub * txtt/bx/sc%
356 }{}
357 \DeclareFontShape{T1}{txtt}{b}{sl}{ %bold slanted
358 <->ssub * txtt/bx/sl%
359 }{}
360 \DeclareFontShape{T1}{txtt}{b}{it}{ %bold italic
361 <->ssub * txtt/bx/it%
362 }{}
363 \DeclareFontShape{T1}{txtt}{b}{ui}{ %bold unslanted italic
364 <->ssub * txtt/bx/ui%
365 }{}
366
367 \usepackage{xspace}
368 \usepackage{color}
369
370 \definecolor{joli}{RGB}{225,95,0}
371 \definecolor{JOLI}{RGB}{225,95,0}
372 \definecolor{BLUE}{RGB}{0,0,255}
373 \definecolor{niceone}{RGB}{38,128,192}
374
375 \usepackage[english]{babel}
376
377 % pdfencoding = unicode maintenant défaut
378 \usepackage{hyperref}
379
380 \hypersetup{%
381 linktoc=all,%
382 breaklinks=true,%
383 hidelinks,%
384 pdfauthor={Jean-François Burnol},%
385 pdftitle={The tableof package},%
386 pdfsubject={LaTeX, table of contents},%
387 pdfkeywords={LaTeX, table of contents},%
388 pdfstartview=FitH,%
389 pdfpagemode=UseOutlines}
390
391
392 % Finally 1.4d uses doc=v2
393 % % Attention que hypdoc fait
394 % % Package hyperref Info: Option `colorlinks' set `true' on input line 75.
395 % % Package hyperref Info: Option `plainpages' set `false' on input line 75.
396 % % Package hyperref Info: Option `bookmarksopen' set `true' on input line 75.
397 % % Package hyperref Info: Option `bookmarksnumbered' set `true' on input line 75.
398 % \AtBeginDocument{\hypersetup{hidelinks}}% fix de l'effet de hypdoc
399
400 \usepackage{bookmark}
401
402 \DeclareRobustCommand\csa[1]{{\ttfamily\char`\\#1}}
403 \DeclareRobustCommand\csb[1]{{\color{blue}\ttfamily\char`\\#1}}
404
405 \newcommand\csahyp[1]{\texorpdfstring{\csa{#1}}{\textbackslash #1}}
406 \newcommand\csbhyp[1]{\texorpdfstring{\csb{#1}}{\textbackslash #1}}
407 \newcommand\lowast{\raisebox{-.25\height}{*}}
408 \newcommand\starit[1]{\csa{#1\lowast}}
409 \newcommand\staritb[1]{\csb{#1\lowast}}
410
411 \makeatletter\let\check@percent\relax\makeatother
412
413 \def\MacroFont{\ttfamily\small\baselineskip12pt\relax\catcode`*\active}
414
415 \begingroup
416 \catcode`*\active
417 \def\x{\endgroup\let*\lowast}\x
418
419 \newcommand\tableof{%
420 \texorpdfstring{{\color{joli}\ttfamily\bfseries tableof}}
421 {tableof}\xspace}
422 \newcommand\etoc{%
423 \texorpdfstring{{\color{niceone}\ttfamily\bfseries etoc}}
424 {etoc}\xspace}
425
426 %\frenchspacing
427
428 \renewcommand\familydefault\sfdefault
429
430 \usepackage{framed}
431 \begin{document}
432 \thispagestyle{empty}
433 \rmfamily
434
435 \begin{center}
436 {\normalfont\Large The \tableof package}\\
437 \bigskip
438 \footnotesize \ttfamily
439 Package version: \pkgversion\ (\pkgdate)\\
440 Documentation generated from tableof.dtx
441 with timestamp \tofdtxtimestamp\\
442 \textcopyright 2012, 2013, 2015, 2018, 2021, 2024 Jean-François Burnol
443 <jfbu (at) free (dot) fr>
444 \end{center}
445
446 \begin{abstract}
447 Provides |\toftagstart{}|, |\toftagstop{}|, |\toftagthis{}|,
448 |\tofuntagthis{}| to tag chapters, sections or any other sectioning units
449 destined to end up in the table(s) of contents. Then each one of
450 \begin{verbatim}
451 \tableof{required tags}
452 or \tablenotof{excluded tags}
453 or \tableoftaggedcontents{required tags}{excluded tags}
454 \end{verbatim}
455 typesets a table of contents (with no heading) obeying the conditions. These
456 macros can each be used multiple times in the document with varying
457 arguments.
458
459 If the document contains no usage of |\tableofcontents|, the preamble should
460 also contain an additional |\AtBeginDocument{\tofOpenTocFileForWrite}|.
461
462 The main |\tableofcontents| can also be influenced by tags like this:
463 \begin{verbatim}
464 \nexttocwithtags{required tags}{excluded tags}
465 \tableofcontents
466 \end{verbatim}
467
468 Depending on the document class and packages, |\tableofcontents| however may
469 be usable only once, contrarily to the |\tableof{}| et al.\@ package macros.
470
471 \end{abstract}
472
473 \tableofcontents
474
475
476 \section{Tagging commands}
477
478 \subsection{\csbhyp{toftagstart \{tag1, tag2, ...\}} and
479 \csbhyp{toftagstop \{tag1, tag2, ...\}}}
480
481 These commands have a mandatory argument which is a comma separated list of
482 tags. The tags need not have been predeclared.
483 \begin{verbatim}
484 \toftagstart{kitchenware, weaponry, gastronomy}
485 \section{Dealing with knives} % tagged with kitchenware+weaponry+gastronomy
486
487 \toftagstop{kitchenware}
488 \section{Hunting rabbits} % tagged with weaponry+gastronomy
489
490 \toftagstart{tag1}
491 \subsection{This is tagged, too} % tagged with weaponry+gastronomy+tag1
492
493 \toftagstop{weaponry}
494 \section{Eating rabbits} % tagged with gastronomy+tag1
495 \end{verbatim}
496
497 \subsection{\csbhyp{toftagthis \{tag1, tag2, ...\}} and
498 \csbhyp{tofuntagthis \{tag1, tag2, ...\}}}
499
500 The \csa{toftagthis} command flags with the comma separated values from its
501 list argument only the \emph{next} sectioning command. The effect is not
502 cumulative: it is the last use of \csa{toftagthis} which counts; use it for
503 all the needed tags at once.
504
505 The \csa{tofuntagthis} command similarly untags only the \emph{next} entry.
506 Similarly, only the tags in the last call of \csa{tofuntagthis} are taken into
507 account.
508 \begin{verbatim}
509 \toftagstart{kitchenware, rabbits}
510 \section{Knives and rabbits} % tagged with kitchenware and rabbits
511
512 \tofuntagthis{kitchenware}
513 \subsection{Hunting rabbits} % tagged only with rabbits
514
515 \subsection{Best knives for cooking} % tagged with kitchenware and rabbits
516
517 \toftagstart{ecology}
518 \toftagthis{climate}
519 \section{Knives and global climate} % tagged with kitchenware+rabbits+ecology+climate
520
521 \toftagstop{kitchenware}
522 \section{The rabbit in the wild} % tagged with rabbits+ecology
523 \end{verbatim}
524
525 \subsection{Spaces}
526
527 Spaces in tags and around commas in tag lists are transparently removed.
528 Tags may be macros, they are completely
529 expanded before use.
530
531 \section{Table of contents commands}
532
533 \subsection{\csbhyp{nexttocwithtags \{required tag1, required tag2,
534 ...\}\{excluded tag1, excluded tag2, ...\}}}
535
536 This command influences the next \csa{tableofcontents} (or equivalent) command:
537 \begin{verbatim}
538 \nexttocwithtags{A, B}{C, D, E}
539 \tableofcontents
540 \end{verbatim}
541 will let \csa{tableofcontents} print only the sectioning units having been
542 flagged with both |A| and |B| and none of |C|, |D|, or |E|.
543
544 \begin{framed}
545 \noindent\textbf{DO NOT FORGET THE SECOND PAIR OF BRACES EVEN IF YOU ONLY
546 WANT TO REQUIRE SOME TAGS:} \csa{nexttocwithtags}|{tag1, tag2}{}|.
547 \end{framed}
548
549 \subsubsection{starred variants}
550
551 There are starred variants:
552 \begin{verbatim}
553 \nexttocwithtags{A, B}{C, D, E} % A and B and neither C nor D nor E
554 \nexttocwithtags*{A, B}{C, D, E} % (A or B) and neither C nor D nor E
555 \nexttocwithtags{A, B}*{C, D, E} % A and B and (not C or not D or not E)
556 \nexttocwithtags*{A, B}*{C, D, E} % (A or B) and (not C or not D or not E)
557 \end{verbatim}
558
559 \subsection{\csbhyp{tableoftaggedcontents \{required tag1, required tag2,
560 ...\}\{excluded tag1, excluded tag2, ... \}}}
561
562 This command is provided in case the document class allows only a single use
563 of \csa{tableofcontents}, indeed \csa{tableoftaggedcontents} can be used
564 arbitrarily many times. \textbf{However it does not typeset a heading}. Example:
565 \begin{verbatim}
566 \section*{A table of tagged contents} % <- needs to be explicitely added
567 \tableoftaggedcontents{weaponry, hunting}{ecology, climate}
568 \end{verbatim}
569 This will limit the printed TOC entries to the ones which have been tagged with
570 |weaponry| and also with |hunting|, but not with |ecology| and neither with
571 |climate|.
572
573 \subsubsection{starred variants}
574
575 There are starred variants:
576 \begin{verbatim}
577 \tableoftaggedcontents{A, B}{C, D, E} % A and B and neither C nor D nor E
578 \tableoftaggedcontents*{A, B}{C, D, E} % (A or B) and neither C nor D nor E
579 \tableoftaggedcontents{A, B}*{C, D, E} % A and B and (not C or not D or not E)
580 \tableoftaggedcontents*{A, B}*{C, D, E} % (A or B) and (not C or not D or not E)
581 \end{verbatim}
582
583 \subsection{\csbhyp{tableof \{required tag1, required tag2, ...\}}}
584
585 This is equivalent to |\tableoftaggedcontents{required tag1, ...}{}|.
586 \begin{verbatim}
587 \tableof{weaponry,hunting} % will print the entries tagged with weaponry
588 AND hunting
589 \end{verbatim}
590 There is a starred variant:
591 \begin{verbatim}
592 \tableof*{weaponry, hunting} % will print the entries tagged with weaponry
593 OR hunting
594 \end{verbatim}
595
596 \subsection{\csbhyp{tablenotof \{excluded tag1, excluded tag2, ...\}}}
597
598 This is equivalent to |\tableoftaggedcontents{}{excluded tag1, ...}|.
599 \begin{verbatim}
600 \tablenotof{weaponry, hunting}
601 % will print the entries NOT tagged with weaponry NEITHER with hunting
602 \end{verbatim}
603 There is a starred variant:
604 \begin{verbatim}
605 \tablenotof*{weaponry, hunting}
606 % will print the entries NOT tagged with weaponry OR NOT tagged with hunting
607 \end{verbatim}
608
609
610 \subsection{\csbhyp{tofOpenTocFileForWrite}}
611
612 The contents of the |.toc| file (if it already exists) are read into memory by
613 \tableof once, at the time of |\begin{document}|.\footnote{New with |1.3|.
614 Earlier versions read the |.toc| file at the time of
615 \csa{usepackage\{tableof\}}. But this could cause a problem if the |.toc|
616 file used characters not yet activated by Babel.}
617 Notice that this reading of the |.toc| file into memory is only of relevance
618 if the document makes use of one of the \csa{tableoftaggedcontents},
619 \csa{tableof} or \csa{tablenotof} commands.
620
621 The creation of the |.toc| file is \emph{not} dealt with by \tableof itself:
622 either this will be done by a standard \csa{tableofcontents} command somewhere
623 in the document, or, one may use the package provided command
624 \csa{tofOpenTocFileForWrite} which does not display anything and just does
625 what its name indicates. This command should \textbf{not} be used in the
626 preamble, however
627 \begin{verbatim}
628 \usepackage{tableof}
629 \AtBeginDocument{\tofOpenTocFileForWrite}
630 \end{verbatim}
631 is possible.
632
633 Please consider: this command should \emph{not} be used when the
634 document makes use of its own \csa{tableofcontents} or equivalent. It is
635 provided \emph{only} for the case where the document uses \emph{exclusively}
636 \csa{tableoftaggedcontents}, \csa{tableof} and \csa{tablenotof}.
637
638 \section{Compatibility with other packages}
639
640 \tableof requires the document |.toc| file to use the |\contentsline| macro
641 (possibly patched by other packages). It is thus incompatible with the
642 |beamer| class. However, if |beamer| is used in an article mode, i.e., with
643 the article class in conjunction with the |beamerarticle| package, then \tableof
644 should work.
645
646 \tableof adds the tag data to the |.toc| file, but this data self-defines
647 itself to do nothing when not activated by \tableof's own commands. Since
648 release |1.3|, these redefinitions are done in \emph{one single} line of the
649 |.toc| file to circumvent interference of |biblatex| which adds
650 commands to the |.toc| line on every other line (thus, potentially right in
651 the middle of multi-line commands \verb+:-(+.)
652
653 No testing has actually been done of compatibility with packages manipulating
654 tables of contents, apart from
655 \etoc.\footnote{\url{http://www.ctan.org/pkg/etoc}} It went fine.
656
657 \section{Version History}
658
659 \begingroup
660 \parindent0pt
661 \makeatletter
662 \settowidth{\dimen@}{\ttfamily 2015/03/10 v1.4a: i.\space}
663 \everypar\expandafter{\expandafter\hangindent\the\dimen@
664 \hangafter1 }
665 \makeatother
666
667 |2024/09/17 v1.4d: |reestablish compatibility with |hyperref|,
668 which got broken at the latter |v7.01c| release. The package now
669 requires \LaTeX{} |2020-10-01|. Thanks to Ekkart Kleinod for report.
670
671 |2021/07/05 v1.4c: |ensure the added scope-limiting group for |\tableof{}|
672 and alike macros encompasses all contents of the |.toc| file even in presence
673 of packages hacking into these contents (in particular |biblatex|).
674 %! https://tex.stackexchange.com/questions/603540/tableof-package-erases-citations/
675
676 |2018/10/02 v1.4b: |fix for situations when a |\clearpage| before
677 the |\end{document}| resulted in the loss of the |\tof@finish| token from |.toc|
678 file, causing the package to misbehave.
679 %! (cf.
680 %! \url{https://tex.stackexchange.com/q/358014/4686}).
681 The package
682 |atveryend| is now required.\footnote{\url{http://www.ctan.org/pkg/atveryend}}
683
684 |2015/03/10 v1.4a: i. |changes in the code to make it more easily patchable by
685 other packages (I have especially the next release of \etoc in mind): changes
686 to the way |\tof@begin|, |\tof@finish| are set up, new |\tof@global| which
687 defaults to nothing but may be set to be |\global| (this is in view of doing
688 TOCs as tabulars of longtables, in the way \etoc |1.08| will permit).
689
690 | ii. |improved sectioning of the documentation.
691
692 |2015/02/20 v1.4: i. |some code efficiency improvements (perhaps...).
693
694 | ii. |improved documentation.
695
696 |2015/02/11 v1.3: i. |comma separated lists of tags now allow spaces.
697
698 | ii. |only one line used for the |.toc| code silently
699 unactivating |tableof| if its |\usepackage{tableof}| has been removed from the
700 document source. (needed due to aggressive |biblatex| interference with |.toc|
701 files.)
702
703 | iii. |reading of .toc file is delayed to |\begin{document}| to
704 account for possible Babel active characters used therein. Not relevant if
705 document uses standard |\tableofcontents| or like commands.
706
707 |2013/03/04 v1.2: i. |added \csa{tableoftaggedcontents} as a wrapper for using
708 \csa{nexttocwithtags} followed with |tableof|'s private copy of the |.toc| data.
709
710 | ii. |added \csa{if@filesw} test to \csa{tofOpenTocFileForWrite}.
711
712 |2012/12/13 v1.1: i. |new command \csa{nexttocwithtags}.
713
714 | ii. ||.toc| may be input in another document not loading \tableof.
715
716 |2012/12/06 v1.0: |initial version.\par
717
718 \endgroup
719
720 \bigskip
721
722 \section{Implementation}
723
724 \makeatletter
725 \StopEventually{\check@checksum\end{document}}
726 \makeatother
727
728 % % Suite à mésaventure le 9 mars 2015 dans etoc.dtx:
729 %
730 % % ATTENTION QU'AVANT DE COMMENCER DES MACROCODE IL FAUT OBLIGATOIREMENT UN
731 % % PARAGRAPHE APRÈS \section (SINON ESPACEMENTS VERTICAUX POST MACROCODE
732 % % SUPPRIMÉS :((((( )
733 %
734 % % ceci faisait donc l'affaire :
735 %
736 % % Writing-up source code comments is hopefully for a future
737 % % release.
738 %
739 % % maintenant je fais:
740 % %
741 % \indent
742 %
743 % Finalement, j'ai fait un bug report en 2021 et trouvé un
744 % workaround
745 % https://github.com/latex3/latex2e/issues/563
746 \makeatletter
747 \AddToHook{env/macrocode/begin}{\partopsep0pt\relax}
748 \AddToHook{env/macrocode/after}{\@nobreakfalse}
749 \makeatother
750
751 \makeatletter
752 \begingroup
753 \topsep\MacrocodeTopsep
754 \trivlist\parskip\z@\item[]
755 \macro@font
756 \leftskip\@totalleftmargin \advance\leftskip\MacroIndent
757 \rightskip\z@ \parindent\z@ \parfillskip\@flushglue
758 \global\@newlistfalse \global\@minipagefalse
759 \ifcodeline@index
760 \everypar{\global\advance\c@CodelineNo\@ne
761 \llap{\theCodelineNo\ \hskip\@totalleftmargin}}%
762 \fi
763 \string\ProvidesPackage\string{\pkgname\string}\par
764 \noindent\space [\pkgdate\space\pkgversion\space\pkgdescription]\par
765 \nointerlineskip
766 \global\@inlabelfalse
767 \endtrivlist
768 \endgroup
769 \makeatother
770 % The catcode hackery next is to avoid to have <*package> to be listed
771 % in the commented source code...
772 % (c) 2012/11/19 jf burnol ;-)
773 \MakePercentIgnore
774 %
775 % \catcode`\<=0 \catcode`\>=11 \catcode`\*=11 \catcode`\/=11
776 % \let</none>\relax
777 % \def<*package>{\catcode`\<=12 \catcode`\>=12 \catcode`\*=12 \catcode`\/=12}
778 %
779 %</none>
780 %<*package>
781 % \begin{macrocode}
782 \NeedsTeXFormat{LaTeX2e}[2020/10/01]
783 \RequirePackage{atveryend}
784 \DeclareOption*{\PackageWarning{tableof}{Option `\CurrentOption' is unknown.}}
785 \ProcessOptions\relax
786 \newtoks\tof@toctoks
787 % \end{macrocode}
788 % |1.3| codes this |\tof@readtoc| slightly better (copied from \etoc.dtx).
789 % \begin{macrocode}
790 \def\tof@readtoc {%
791 \ifeof\tof@tf
792 \else
793 \read\tof@tf to \tof@buffer
794 \tof@toctoks\expandafter\expandafter\expandafter
795 {\expandafter\the\expandafter\tof@toctoks\tof@buffer}%
796 \expandafter\tof@readtoc
797 \fi }
798 % \end{macrocode}
799 % |1.3| of |2015/02/11| moves the reading of the toc file to At Begin
800 % Document. This is needed for Babel activated characters. I also re-use
801 % |\endlinechar-1| which I had commented out since release |1.1|. Notice
802 % though that this is irrelevant if the document uses |tableof| only via its
803 % tagging abilities, and has standard |\tableofcontents| command to print the
804 % TOC.
805 %
806 % |1.4c| injects |\tof@begingroup| and |\tof@endgroup| to wrap the gathered
807 % the contents of the toc file, rather than having them arise from expansion
808 % of |\tof@begin| and respectively |\tof@finish|. This avoids a problem with
809 % |biblatex| additions to the |.toc| file happening before |\tof@begin|. They
810 % need to have their scope limited. The |\tableof{}| macro and variants will
811 % thus achieve this automatically via the |\tof@begingroup/\tof@endgroup| pair
812 % now explicitly added to |\tof@toctoks| contents.
813 %
814 % \etoc (a.t.t.o.w |1.09c 2020/05/15|) has some handling of
815 % |\tof@begingroup/\tof@endgroup| which as far as I understand can
816 % currently remain as it is. But there is something weird in \etoc with
817 % a test of |\tof@finish| which probably is in need of revision (even
818 % independently of changes here).
819 %
820 % These changes however mean for usage of |\nexttocwithtags| that whatever
821 % macro is used to typeset the TOC, it is now the one bearing the
822 % responsability for creating the scope-limiting group.
823 % \begin{macrocode}
824 \AtBeginDocument{%
825 \IfFileExists{\jobname.toc}
826 {{\endlinechar\m@ne
827 \makeatletter
828 \newread\tof@tf
829 \openin\tof@tf\@filef@und
830 \tof@toctoks{\tof@begingroup}%
831 \tof@readtoc
832 \global\tof@toctoks=\expandafter{\the\tof@toctoks\tof@endgroup}%
833 \closein\tof@tf}}
834 {}%
835 }
836 % \end{macrocode}
837 % The trick is that |\@ifundefined| chooses the undefined branch if the
838 % meaning is |\relax|. Thus it is possible for \tableof to define and use
839 % |\tof@begin| and later set it to |\relax|, the entire influence of \tableof
840 % will then be turned off.
841 %
842 % |1.2| of |2013/03/04|: \csa{string\{}->\{, idem with
843 % \}. And added \csa{if@filesw} test.
844 %
845 % |1.3| of |2015/02/11|: to circumvent aggressive biblatex manipulation of the
846 % |.toc| file, I put things to the |.toc| file in one-go; else weird commands
847 % might get inserted right in the middle of arguments to a multi-line macro!
848 % also removed a bunch of |\string|'s: when I first wrote this package I had
849 % still limited understanding of \TeX's macros.
850 %
851 % |1.4a| uses |\@empty| for the default |\tof@finish| rather than |\relax|,
852 % for no special reason. Also the |\let|'s in case |\tof@begin| is undefined
853 % or |\relax| are all made global, because for compatibility with the fancy
854 % things \etoc |1.08| will allow for TOC as table we need a global mode, and
855 % the simplest is here to do the things global by default.
856 %
857 % |1.4c| replaces |{}| (last argument of |\@ifundefined|) by |\relax|. No
858 % strong reason. We and \etoc use |\endlinechar-1| anyhow.
859 % \begin{macrocode}
860 \AtBeginDocument{%
861 \addtocontents{toc}{\string\@ifundefined{tof@begin}%
862 {\global\let\string\tof@begin\relax
863 \global\let\string\tof@finish\string\@empty
864 \global\let\string\tof@starttags\string\@gobble
865 \global\let\string\tof@stoptags\string\@gobble
866 \global\let\string\tof@tagthis\string\@gobble
867 \global\let\string\tof@untagthis\string\@gobble}\relax}%
868 \addtocontents{toc}{\string\tof@begin}%
869 }
870 % \end{macrocode}
871 % \textbf{Now obsolete hyperref-related remark (see next paragraph)}:
872 % {\itshape\LaTeX\ of 2020 or 2021 always has |\contentsline| with four arguments.
873 % So an update should be done here to always gobble four, else in absence
874 % of |hyperref| some |{}| are left. Does not seem to matter a lot except
875 % if all is executed in math mode... thanks to \etoc for example.
876 % No urgency here, only mentioning for the record.}
877 %
878 % |hyperref| stopped defining its |\hyper@last| at its |7.01c| release in fall
879 % of 2023, but \tableof tested for it, if |hyperref| was found to be present,
880 % in case a document previously not using |hyperref| started using it on
881 % second compilation, hence with a wrong |.toc| file format (in earlier
882 % years). As \tableof was doing
883 % \centeredline{|\ifx\hyper@last\@undefined\tof@toctoks{}\fi|} it now
884 % unconditionally emptied |\tof@toctoks| in presence of |hyperref|. This is
885 % the same problem which impacted \etoc and got fixed at its |1.2c| release
886 % but unfortunately \tableof was not updated then. Belatedly fixed at |1.4d|
887 % of |2024/09/17|.
888 %
889 % Formerly this was a short macro, but it doesn't look like a problem
890 % to simply alias it to the long |\@gobblefour|.
891 % \begin{macrocode}
892 \let\tof@gobblethree@orfour\@gobblefour
893 % \end{macrocode}
894 % |1.4b| (belatedly) fixes issue with |\tof@finish| getting lost due
895 % to a final |\clearpage| before |\end{document}|. Indeed, formerly
896 % code did:
897 %
898 % {\centering|\AtEndDocument{\addtocontents{toc}{\string\tof@finish}}|\par}
899 %
900 % But we can't replace this by some |\immediate\write\@auxout| at end
901 % document, because it would act \emph{before} the writes triggered by
902 % the |\clearpage| from inside |\end{document}|, if no such
903 % |\clearpage| ended the document body. Thus |\AfterLastShipout| comes
904 % to the rescue, from package |atveryend|.
905 % \begin{macrocode}
906 \AfterLastShipout
907 {\immediate\write\@auxout{\string\@writefile{toc}{\string\tof@finish}}}
908 % \end{macrocode}
909 % |1.4a| makes the things more easily patchable by other packages, especially
910 % I have \etoc in mind.
911 %
912 % |\tof@@starttags| and |\tof@@stoptags| are defined a bit later in the code.
913 % And we use |\tof@global|. And we need |\tof@@finish| to reset |\tof@tags| to
914 % empty, just in case |\tof@global| was |\global|. And also |\contentsline| !!
915 % But here it is a problem redefining it globally. In normal use of \tableof,
916 % nothing needs to be done, because the |\tof@endgroup| closes the scope. In
917 % global mode (triggered only by \etoc with |\etocglobaldefs| for tabulars),
918 % it needed to globally modify |\contentsline|, thus it or \etoc has to
919 % globally unmodify it. \etoc |1.08| by itself without \tableof doesn't have
920 % to reset |\contentsline| because it re-defined it \emph{before} an eventual
921 % tabular. But as it forced \tableof to do global things, in such case \etoc
922 % will have to proceed globally as well.
923 % \begin{macrocode}
924 \let\tof@global \@empty
925 \let\tof@begingroup \begingroup
926 \let\tof@endgroup \endgroup
927 % \end{macrocode}
928 % No more |\tof@endgroup| here at |1.4c|. See above explanations.
929 % \begin{macrocode}
930 \def\tof@@finish {\tof@global\let\contentsline\tof@savedcontentsline
931 \global\let\tof@begin\relax
932 \global\let\tof@tags\@empty }
933 \def\tof@@tagthis #1{\def\tof@tags@tmp{#1}}
934 \def\tof@@untagthis #1{\def\tof@untags@tmp{#1}}
935 % \end{macrocode}
936 % No more |\tof@begingroup| here at |1.4c|. See above explanations.
937 % \begin{macrocode}
938 \def\tof@init#1{%
939 \def\tof@begin{%
940 \tof@global\let\tof@tagthis \tof@@tagthis
941 \tof@global\let\tof@untagthis\tof@@untagthis
942 \tof@global\let\tof@starttags\tof@@starttags
943 \tof@global\let\tof@stoptags \tof@@stoptags
944 \tof@global\let\tof@finish \tof@@finish
945 \tof@global\let\tof@savedcontentsline\contentsline
946 \tof@global\def\contentsline {#1}}}
947 % \end{macrocode}
948 % place holder for comments
949 % \begin{macrocode}
950 \newcommand\tofOpenTocFileForWrite{%
951 \if@filesw
952 \newwrite \tf@toc
953 \immediate \openout \tf@toc \jobname.toc\relax
954 \fi}
955 % \end{macrocode}
956 % Creating our booleans is not the most economical, (one could have used a
957 % single list macro) but heck, how many tags are there going to be anyhow in
958 % normal use? a dozen at the very most I think.
959 %
960 % |1.4a|: fortunately no need for the |\tof@global| thing! However, careful
961 % with |\tof@tags| it will have to be reset to empty by |\tof@finish| in case
962 % |\tof@global| is |\global|.
963 % \begin{macrocode}
964 \let\tof@tags \@empty
965 \let\tof@tags@tmp \@empty
966 \let\tof@untags@tmp\@empty
967 \def\tof@true #1{\expandafter\let\csname tofsw@#1\endcsname\iftrue}
968 \def\tof@false#1{\expandafter\let\csname tofsw@#1\endcsname\iffalse}
969 \def\tof@secondiftrue#1%
970 {\csname tofsw@#1\endcsname \let\tof@next\@secondoftwo\fi}
971 \def\tof@secondiffalse#1%
972 {\csname tofsw@#1\endcsname\else\let\tof@next\@secondoftwo\fi}
973 % \end{macrocode}
974 % |1.4a|: fortunately no need for the |\tof@global| thing; the |\tof@setflags|
975 % is used at \emph{each} |\contentsline|. Quite useful design, congrats to the
976 % original architect !
977 % \begin{macrocode}
978 \def\tof@setflags #1{\let\tof@next\@firstoftwo
979 \@for\@tempa:=#1\do {\tof@true {\@tempa}}%
980 \@for\@tempa:=\tof@tags\do {\tof@false{\@tempa}}%
981 \@for\@tempa:=\tof@tags@tmp\do {\tof@false{\@tempa}}%
982 \@for\@tempa:=\tof@untags@tmp\do{\tof@true {\@tempa}}}
983 % \end{macrocode}
984 % Release |1.4| uses here a bunch of |\expandafter|'s in place of some
985 % |\edef|'s.
986 % \begin{macrocode}
987 \def\tof@filter#1#2{\ifx#1#2\else
988 \ifx\tof@tmptags\@empty
989 \expandafter\def\expandafter\tof@tmptags\expandafter{#2}%
990 \else
991 \expandafter\expandafter\expandafter\def
992 \expandafter\expandafter\expandafter\tof@tmptags
993 \expandafter\expandafter\expandafter{\expandafter
994 \tof@tmptags\expandafter,#2}%
995 \fi\fi}
996 % \end{macrocode}
997 % |1.4a| needs the |\tof@global| in the hope for \tableof to be compatible with
998 % future \etoc |1.08| when employed in the delicate art of TOC as a table !
999 % \begin{macrocode}
1000 \def\tof@@starttags#1{%
1001 \ifx\tof@tags\@empty
1002 \tof@global\def\tof@tags{#1}%
1003 \else
1004 \tof@global
1005 \expandafter\def\expandafter\tof@tags\expandafter{\tof@tags,#1}%
1006 \fi }
1007 \def\tof@@stoptags#1{%
1008 \@for\@tempa:=#1\do{%
1009 \def\tof@tmptags{}%
1010 \@for\@tempb:=\tof@tags\do{\tof@filter\@tempa\@tempb}%
1011 \tof@global
1012 \expandafter\def\expandafter\tof@tags\expandafter{\tof@tmptags}%
1013 }%
1014 }
1015 % \end{macrocode}
1016 % Until |1.3|, I was just using the \csa{@for} thing with no attempt at any
1017 % extra parsing, for spaces in particular. With |1.3| of |2015/02/11| I use an
1018 % |\edef| to remove all spaces first, using a |\zapspaces| macro pioneered in
1019 % |xintkernel.sty|. Thus, comma separated lists of tags can have spaces. They
1020 % will be removed if not protected by braces.
1021 % \begin{macrocode}
1022 \def\tof@zapspaces #1 #2{#1#2\tof@zapspaces }%
1023 \def\tof@cleanspaces #1#2{\edef\tof@tmp {{\tof@zapspaces #2 \@gobble}}%
1024 \expandafter #1\tof@tmp }
1025 % \end{macrocode}
1026 % placeholder for comments
1027 % \begin{macrocode}
1028 \def\tof@and #1{%
1029 \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
1030 \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
1031 \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}%
1032 \the\tof@toctoks }
1033 \def\tof@or #1{%
1034 \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
1035 \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
1036 \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}%
1037 \the\tof@toctoks }
1038 \def\tof@nor #1{%
1039 \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
1040 \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
1041 \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}%
1042 \the\tof@toctoks }
1043 \def\tof@nand #1{%
1044 \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
1045 \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
1046 \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}%
1047 \the\tof@toctoks }
1048 \newcommand*\tableof{\@ifstar{\tof@cleanspaces\tof@or}
1049 {\tof@cleanspaces\tof@and}}
1050 \newcommand*\tablenotof{\@ifstar{\tof@cleanspaces\tof@nand}
1051 {\tof@cleanspaces\tof@nor}}
1052 % \end{macrocode}
1053 % placeholder for comments
1054 % \begin{macrocode}
1055 \def\tof@nextof@or #1{\toks@{\tof@setflags{#1}%
1056 \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
1057 \tof@next
1058 {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}%
1059 \@ifstar{\tof@cleanspaces\tof@nextof@nand}
1060 {\tof@cleanspaces\tof@nextof@nor}}
1061 \def\tof@nextof@and #1{\toks@{\tof@setflags{#1}%
1062 \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
1063 \tof@next\@secondoftwo\@firstoftwo
1064 {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}%
1065 \@ifstar{\tof@cleanspaces\tof@nextof@nand}
1066 {\tof@cleanspaces\tof@nextof@nor}}
1067 \def\tof@nextof@nor #1{%
1068 \toks@\expandafter{\the\toks@
1069 {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
1070 \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}%
1071 \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}}%
1072 \expandafter\tof@init\expandafter{\the\toks@}%
1073 \tof@printtoc }
1074 \def\tof@nextof@nand #1{%
1075 \toks@\expandafter{\the\toks@
1076 {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}%
1077 \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}%
1078 \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}}%
1079 \expandafter\tof@init\expandafter{\the\toks@}%
1080 \tof@printtoc }
1081 \newcommand*{\nexttocwithtags}{\let\tof@printtoc\relax
1082 \@ifstar{\tof@cleanspaces\tof@nextof@or}
1083 {\tof@cleanspaces\tof@nextof@and}}
1084 \newcommand*{\tableoftaggedcontents}{\def\tof@printtoc{\the\tof@toctoks}%
1085 \@ifstar{\tof@cleanspaces\tof@nextof@or}
1086 {\tof@cleanspaces\tof@nextof@and}}
1087 % \end{macrocode}
1088 % placeholder for comments
1089 % \begin{macrocode}
1090 \newcommand*\toftagthis[1]
1091 {\addtocontents{toc}{\string\tof@tagthis {\tof@zapspaces #1 \@gobble }}}
1092 \newcommand*\tofuntagthis[1]
1093 {\addtocontents{toc}{\string\tof@untagthis{\tof@zapspaces #1 \@gobble }}}
1094 \newcommand*\toftagstart[1]
1095 {\addtocontents{toc}{\string\tof@starttags{\tof@zapspaces #1 \@gobble }}}
1096 \newcommand*\toftagstop[1]
1097 {\addtocontents{toc}{\string\tof@stoptags {\tof@zapspaces #1 \@gobble }}}
1098 \endinput
1099 % \end{macrocode}
1100 % \MakePercentComment
1101 \Finale
1102 %%
1103 %% End of file `tableof.dtx'.
1104