From ba9eec42efe9df19a65c797ec91f16384e2a168f Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 13 Feb 2015 00:22:02 +0000 Subject: tableof (12feb15) git-svn-id: svn://tug.org/texlive/trunk@36265 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/tableof/README | 57 --- Master/texmf-dist/doc/latex/tableof/README.md | 74 +++ Master/texmf-dist/doc/latex/tableof/tableof.pdf | Bin 41278 -> 99422 bytes Master/texmf-dist/source/latex/tableof/tableof.dtx | 500 +++++++++++---------- Master/texmf-dist/source/latex/tableof/tableof.ins | 21 +- Master/texmf-dist/tex/latex/tableof/tableof.sty | 145 +++--- 6 files changed, 433 insertions(+), 364 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/tableof/README create mode 100644 Master/texmf-dist/doc/latex/tableof/README.md diff --git a/Master/texmf-dist/doc/latex/tableof/README b/Master/texmf-dist/doc/latex/tableof/README deleted file mode 100644 index 51b1c4430ee..00000000000 --- a/Master/texmf-dist/doc/latex/tableof/README +++ /dev/null @@ -1,57 +0,0 @@ - - Package `tableof' (v1.2, 2013/03/04) - `tables of tagged contents' (jfB) - - The package commands \toftagstart, \toftagstop, \toftagthis, - \tofuntagthis are used to flag chapters or sections or anything - ending up in the .toc file following an (implicit or explicit) - \addcontentsline. Then - - \nexttocwithtags{required1,required2,...}{excluded1,excluded2,...} - - specifies which tags are to be required and which ones are to be - excluded by the next \tableofcontents (or equivalent) document - command. For document with classes where \tableofcontents is - only single-use, the package provides: - - \tableoftaggedcontents{required1,required2,...}{excluded1,excluded2,...} - - which removes this restriction. - - Copyright (C) 2012, 2013 by Jean-Francois Burnol - - The source file tableof.dtx and its derived files 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 2003/12/01 or later. - - Installation: - ============ - - `latex tableof.dtx' or `pdflatex tableof.dtx' - Run twice to get the bookmarks right. - - `tableof.sty', `tableof.ins' and `tableoftest.tex' are generated on - the first latex run. - - Move `tableof.sty' to a suitable location within the TeX installation: - tableof.sty -> ..path..to../tex/latex/tableof/ - - `tableof.ins' is for TeX distributions expecting it. - - `tableoftest.tex' is an example of use of the package commands. Run - latex twice on it to get the tagged tables of contents. - - Change History: - ============== - - v1.2 (2013/03/04) added command \tableoftaggedcontents - v1.1 (2012/12/13) added command \nexttocwithtags. - v1.0 (2012/12/06) - diff --git a/Master/texmf-dist/doc/latex/tableof/README.md b/Master/texmf-dist/doc/latex/tableof/README.md new file mode 100644 index 00000000000..59068fe241c --- /dev/null +++ b/Master/texmf-dist/doc/latex/tableof/README.md @@ -0,0 +1,74 @@ +Abstract +======== + +- Package: tableof (Tables of tagged contents) +- Version: 1.3 (2015/02/11) +- License: LPPL 1.3c +- Copyright (C) 2012-2015 Jean-Francois Burnol + +The commands `\toftagstart`, `\toftagstop`, `\toftagthis`, +`\tofuntagthis` are used to tag chapters or sections. Then: + + \nexttocwithtags{required1, requ.2, ...}{excluded1, excl.2, ...} + \tableofcontents % or equivalent command + +specifies which tags are to be required and which ones are to be +excluded from the typeset TOC. + +For document with classes where `\tableofcontents` is only single-use, +the package provides: + + \tableoftaggedcontents{required1, requ.2, ...}{excluded1, excl.2, ...} + +which does not have this restriction. + + +Installation +============ + + latex tableof.dtx or pdflatex tableof.dtx + +Run twice to get the bookmarks right. `tableof.sty`, `tableof.ins` and +`tableoftest.tex` are generated on the first latex run. Move `tableof.sty` to +a suitable location within the TeX installation: + + tableof.sty -> /tex/latex/tableof/ + +`tableof.ins` is for TeX distributions expecting it. + +`tableoftest.tex` is an example of use of the package commands. Run +latex twice on it to see examples of tagged tables of contents. + + +Change History +============== + +* v1.3 (2015/02/11) spaces now allowed in tags. + +* v1.2 (2013/03/04) added command `\tableoftaggedcontents`. + +* v1.1 (2012/12/13) added command `\nexttocwithtags`. + +* v1.0 (2012/12/06) + + +License +======= + + This Work may be distributed and/or modified under the + conditions of the LaTeX Project Public License, either + version 1.3c of this license or (at your option) any later + version. This version of this license is in + + + + and the latest version of this license is in + + + + and version 1.3 or later is part of all distributions of + LaTeX version 2005/12/01 or later. + + The Author of this Work is: + Jean-Francois Burnol + diff --git a/Master/texmf-dist/doc/latex/tableof/tableof.pdf b/Master/texmf-dist/doc/latex/tableof/tableof.pdf index c927f8b4cc0..115930090e6 100644 Binary files a/Master/texmf-dist/doc/latex/tableof/tableof.pdf and b/Master/texmf-dist/doc/latex/tableof/tableof.pdf differ diff --git a/Master/texmf-dist/source/latex/tableof/tableof.dtx b/Master/texmf-dist/source/latex/tableof/tableof.dtx index a875d4f33f7..d03f2fc8765 100644 --- a/Master/texmf-dist/source/latex/tableof/tableof.dtx +++ b/Master/texmf-dist/source/latex/tableof/tableof.dtx @@ -1,52 +1,53 @@ % -*- coding: iso-latin-1; -*- -%<*ins> -\def\pkgname{tableof} -\def\pkgdate{2013/03/04} -\def\pkgversion{v1.2} -\def\pkgdescription{tables of tagged contents (jfB)} -% +%<*none> +{\def\doctimestamp {Time-stamp <11-02-2015 23:14:33 CET>}% + \def\getdtxtimestamp #1 <#2 #3 #4>{#2 at #3 #4}% + \xdef\tofdtxtimestamp {\expandafter\getdtxtimestamp\doctimestamp }}% +\def\docdate{2015/02/11} +% %% -%% Package `tableof' by Jean-Francois Burnol -%% Copyright (C) 2012,2013 by Jean-Francois Burnol +%% Package: tableof +%% Version: 1.3 (2015/02/11) +%% License: LPPL 1.3c +%% Copyright (C) 2012-2015 Jean-Francois Burnol %% -%<*none> -\def\lasttimestamp{Time-stamp: <04-03-2013 21:29:27 CET jfb>} -\def\docdate{2013/03/04} -\def\striptimestamp#1 <#2 #3 #4 #5>{#2 at #3 #4} -\edef\dtxtimestamp{\expandafter\striptimestamp\lasttimestamp} -\ProvidesFile{\pkgname.dtx} - [`\pkgname' source and documentation (\dtxtimestamp)] +% This Work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or (at your option) any later +% version. This version of this license is in +% http://www.latex-project.org/lppl/lppl-1-3c.txt +% and 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. % -% The copyright notice applies to `tableof.dtx' and to its derived files. -% -% They 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 2003/12/01 or later. +% The Author of this Work is: Jean-Francois Burnol % % Installation: % ============ % -% `latex tableof.dtx' or `pdflatex tableof.dtx' -% Run twice to get the bookmarks right. +% latex tableof.dtx or pdflatex tableof.dtx % -% `tableof.sty', `tableof.ins' and `tableoftest.tex' are generated on -% the first latex run. +% Run twice to get the bookmarks right. `tableof.sty`, `tableof.ins` and +% `tableoftest.tex` are generated on the first latex run. Move `tableof.sty` to +% a suitable location within the TeX installation: % -% Move `tableof.sty' to a suitable location within the TeX installation: -% tableof.sty -> ..path..to../tex/latex/tableof/ +% tableof.sty -> /tex/latex/tableof/ % -% `tableof.ins' is for TeX distributions expecting it. +% `tableof.ins` is for TeX distributions expecting it. % -% `tableoftest.tex' is an example of use of the package commands. Run -% latex twice on it to get examples of tagged tables of contents. +% `tableoftest.tex` is an example of use of the package commands. Run +% latex twice on it to see examples of tagged tables of contents. % +%<*ins> +\def\pkgname {tableof} +\def\pkgdate {2015/02/11} +\def\pkgversion {v1.3} +\def\pkgdescription {Tables of tagged contents (jfB)} +% +%<*none> +\ProvidesFile{\pkgname.dtx}% + [\pkgname source and documentation (\tofdtxtimestamp)] \begingroup \input docstrip.tex \askforoverwritefalse @@ -67,20 +68,17 @@ %% This file `tableof.ins' is provided for compatibility with TeX %% distributions expecting to find it for installation of `tableof.sty'. %% -%% As usual `latex tableof.ins' produces `tableof.sty' from the source +%% As usual `tex tableof.ins' produces `tableof.sty' from the source %% `tableof.dtx' %% %% (an already existing `tableof.sty' in the same repertory will be %% overwritten) %% %% Move `tableof.sty' to a suitable location within the TeX installation: -%% tableof.sty -> ................/tex/latex/tableof/ +%% tableof.sty -> /tex/latex/tableof/ %% %% The generated auxiliary files may be discarded. %% -%% See `tableof.dtx' for the statements of copyright and conditions of -%% distribution and/or modification. -%% \input docstrip.tex \askforoverwritefalse \def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J% @@ -113,19 +111,20 @@ \section*{\string\tableof\{\}} \tableof{} \section*{\string\tableof\lowast\{A,B,C,D,E,F\}} -\tableof*{A,B,C,D,E,F} +% vérifions que c'est bon avec les espaces: (1.3 de 2015/02/11) +\tableof*{ A, B,C , D , E, F } \section*{\string\tableof\{A\}} \tableof{A} \section*{\string\tableof\lowast\{A\}} \tableof*{A} \section*{\string\tableof\{A,C\}} -\tableof{A,C} +\tableof{ A ,C } \section*{\string\tableof\lowast\{A,C\}} -\tableof*{A,C} +\tableof*{A, C } \section*{\string\tableoftaggedcontents\lowast\{A,D\}\{B,F\}} -\tableoftaggedcontents*{A,D}{B,F} +\tableoftaggedcontents*{ A,D}{B, F} \renewcommand\contentsname{\string\nexttocwithtags\lowast\{A,D\}\lowast\{B,F\}\string\tableofcontents} -\nexttocwithtags*{A,D}*{B,F} +\nexttocwithtags*{ A , D}*{B ,F} \tableofcontents %% requires package etoc %% \etoctocstyle{1}{with A and D and without B and without F} @@ -134,24 +133,24 @@ %% \nexttocwithtags*{A,D}{B,F}\tableofcontents %% \etoctocstyle{1}{with A and D and (without B or without F)} %% \nexttocwithtags{A,D}*{B,F}\tableofcontents -\section*{with B or with C (using \string\tableoftaggecontents)} -\tableoftaggedcontents*{B,C}{} +\section*{with B or with C (using \string\tableoftaggedcontents)} +\tableoftaggedcontents*{B, C}{} \section*{with B or with C (using \string\tableof\lowast)} -\tableof*{B,C} +\tableof*{B, C} \section*{with A and with B and with C} -\tableof{A,B,C} +\tableof{A, B, C} \section*{with A or with B or with C} -\tableof*{A,B,C} +\tableof*{ A,B ,C } \section*{without B (and) (using \string\tableoftaggedcontents)} \tableoftaggedcontents{}{B} \section*{without A and without B (using \string\tableoftaggedcontents)} -\tableoftaggedcontents{}{A,B} +\tableoftaggedcontents{}{A , B} \section*{without A or without C} -\tablenotof*{A,C} +\tablenotof*{ A, C} \section*{without A and without B and without C} -\tablenotof{A,B,C} +\tablenotof{ A , B , C} \section*{without A or without B or without C} -\tablenotof*{A,B,C} +\tablenotof*{A, B,C } \section*{with D and with E} \tableof{D,E} \section*{with E} @@ -159,11 +158,11 @@ \section*{without D} \tablenotof{D} \section*{ecology and rabbits} -\tableof{ecology,rabbits} +\tableof{ ecology , rabbits } \section*{rabbits and not ecology} -\tableoftaggedcontents{rabbits}{ecology} +\tableoftaggedcontents{ rabbits }{ ecology } \section*{kitchenware and not rabbits} -\tableoftaggedcontents{kitchenware}{rabbits} +\tableoftaggedcontents{ kitchenware }{ rabbits} \clearpage \section{no tag} nothing @@ -171,7 +170,7 @@ nothing \toftagstart{D,E,F} \toftagthis{A} \end{verbatim} -\toftagstart{D,E,F} +\toftagstart{ D, E, F } \toftagthis{A} \section{A,D,E,F} A,D,E,F @@ -184,7 +183,7 @@ B,D,E,F \begin{verbatim} \toftagthis{C} \end{verbatim} -\toftagthis{C} +\toftagthis{ C } \section{C,D,E,F} C,D,E,F \begin{verbatim} @@ -192,37 +191,37 @@ C,D,E,F \toftagthis{A,B} \end{verbatim} \toftagstop{F} -\toftagthis{A,B} +\toftagthis{ A,B} \section{A,B,D,E} A,B,D,E \begin{verbatim} \toftagthis{B,C} \end{verbatim} -\toftagthis{B,C} +\toftagthis{B, C} \section{B,C,D,E} B,C,D \begin{verbatim} \toftagthis{A,C} \toftagstop{E} \end{verbatim} -\toftagthis{A,C} -\toftagstop{E} +\toftagthis{ A, C} +\toftagstop{ E} \section{A,C,D} A,C,D \begin{verbatim} \toftagstop{D} \toftagthis{A,B,C} \end{verbatim} -\toftagstop{D} -\toftagthis{A,B,C} +\toftagstop{D } +\toftagthis{A,B,C } \section{A,B,C} A,B,C \begin{verbatim} \toftagstop{A,B,C,D,E,F} \toftagstart{kitchenware,rabbits} \end{verbatim} -\toftagstop{A,B,C,D,E,F} -\toftagstart{kitchenware,rabbits} +\toftagstop{A,B, C,D,E,F} +\toftagstart{ kitchenware,rabbits} \section{Knives and rabbits} \begin{verbatim} \tofuntagthis{kitchenware} @@ -238,29 +237,29 @@ A,B,C \begin{verbatim} \toftagstart{ecology}\tofuntagthis{rabbits} \end{verbatim} -\toftagstart{ecology}\tofuntagthis{rabbits} +\toftagstart{ecology}\tofuntagthis{ rabbits} \section{Knives and global climate} \begin{verbatim} \toftagstop{kitchenware} \end{verbatim} -\toftagstop{kitchenware} +\toftagstop{kitchenware } \section{The rabbit in the wild} \subsection{Impact of the rabbit on global climate} \begin{verbatim} \toftagstop{rabbits} \end{verbatim} -\toftagstop{rabbits} +\toftagstop{ rabbits} \section{Other species of interest for cooking} \end{document}\endinput %------------------------------------------------------------------------------- % %<*none> \fi -\documentclass[a4paper,11pt,abstract]{scrdoc} +\documentclass[a4paper,fontsize=11pt,abstract]{scrdoc} \pagestyle{headings} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} -\usepackage[hscale=0.66,vscale=0.75]{geometry} +\usepackage[hscale=0.66,vscale=0.76]{geometry} \usepackage{txfonts} \DeclareFontFamily{T1}{txtt}{} @@ -320,8 +319,7 @@ A,B,C \usepackage[english]{babel} -\usepackage[%dvipdfmx,% -pdfencoding=pdfdoc,bookmarks=true]{hyperref} +\usepackage[pdfencoding=pdfdoc]{hyperref} \hypersetup{% linktoc=all,% @@ -334,6 +332,7 @@ pdfkeywords={LaTeX, table of contents},% pdfstartview=FitH,% pdfpagemode=UseOutlines} +\usepackage{bookmark} \DeclareRobustCommand\csa[1]{{\ttfamily\char`\\#1}} \DeclareRobustCommand\csb[1]{{\color{blue}\ttfamily\char`\\#1}} @@ -374,23 +373,27 @@ pdfpagemode=UseOutlines} jfbu (at) free (dot) fr\\ Package version: \pkgversion\ (\pkgdate)\\ Documentation generated from the source file\\ - with timestamp ``\dtxtimestamp'' + with timestamp ``\tofdtxtimestamp'' \end{center} \begin{abstract} - The package commands \csa{toftagstart}, \csa{toftagstop}, \csa{toftagthis}, - \csa{tofuntagthis} are used to flag chapters or sections or anything ending up - in the |.toc| file following an (implicit or explicit) - \csa{addcontentsline}. Then\\ - \hbox to - \linewidth{\hss\csa{nexttocwithtags}\marg{required1,required2,...}\marg{excluded1,excluded2,...}\hss} - specifies which tags are to be required and which ones are to be excluded by - the next \csa{tableofcontents} (or equivalent) document command. For document - with classes where \csa{tableofcontents} is only single-use, the package - provides:\\ - \hbox to - \linewidth{\hss\csa{tableoftaggedcontents}\marg{required1,required2,...}\marg{excluded1,excluded2,...}\hss} - which removes this restriction. +The commands \csa{toftagstart}, \csa{toftagstop}, \csa{toftagthis}, +\csa{tofuntagthis} are used to tag chapters or sections. Then: +\begin{quote} + \csa{nexttocwithtags}\{required1, requ.2, ...\}\{excluded1, + excl.2, ...\}\\ + \csa{tableofcontents} |% or equivalent command| +\end{quote} +specifies which tags are to be required and which ones are to be +excluded from the typeset TOC. + +For document with classes where \csa{tableofcontents} is only single-use, +the package provides: +\begin{quote} + \csa{tableoftaggedcontents}\{required1, requ.2, ...\}\{excluded1, + excl.2, ...\} +\end{quote} +which does not have this restriction. \end{abstract} \tableofcontents @@ -398,12 +401,13 @@ pdfpagemode=UseOutlines} \section{Tagging commands} -\subsection{\csbhyp{toftagstart\{csv,list\}} and \csbhyp{toftagstop\{csv,list\}}} +\subsection{\csbhyp{toftagstart \{tag1, tag2, ...\}} and + \csbhyp{toftagstop \{tag1, tag2, ...\}}} These commands have a mandatory argument which is a comma separated list of tags. The tags need not have been predeclared. \begin{verbatim} -\toftagstart{kitchenware,weaponry,gastronomy} +\toftagstart{kitchenware, weaponry, gastronomy} \section{Dealing with knives} % tagged with kitchenware+weaponry+gastronomy \toftagstop{kitchenware} @@ -416,13 +420,14 @@ tags. The tags need not have been predeclared. \section{Eating rabbits} % tagged with gastronomy+tag1 \end{verbatim} -\subsection{\csbhyp{toftagthis\{csv,list\}} and \csbhyp{tofuntagthis\{csv,list\}}} +\subsection{\csbhyp{toftagthis \{tag1, tag2, ...\}} and + \csbhyp{tofuntagthis \{tag1, tag2, ...\}}} The \csa{toftagthis} command flags with the comma separated values from its list argument only the \emph{next} sectioning command. The \csa{tofuntagthis} command similarly untags only the \emph{next} entry. \begin{verbatim} -\toftagstart{kitchenware,rabbits} +\toftagstart{kitchenware, rabbits} \section{Knives and rabbits} % tagged with kitchenware and rabbits \tofuntagthis{kitchenware} @@ -440,23 +445,46 @@ similarly untags only the \emph{next} entry. \subsection{Spaces} -Spaces in tags are significant (as usual with \TeX{} multiple spaces count for -one). Do not use spaces after the opening brace or before the closing brace, do -not use spaces before or after a comma: |\toftagthis{one tag with spaces}| is -ok, |\toftagthis{tag1 }| or |\toftagthis{tag1, tag2}| are not. +Spaces in tags and around commas in tag lists are transparently removed. +(\emph{new with release} |1.3|). Tags may be macros, they are completely +expanded before use. +\section{Table of contents commands} +\subsection{\csbhyp{nexttocwithtags \{required tag1, required tag2, + ...\}\{excluded tag1, excluded tag2, ...\}}} -\section{Table of contents commands} +This command influences the next \csa{tableofcontents} (or equivalent) command: +\begin{verbatim} +\nexttocwithtags{A, B}{C, D, E} +\tableofcontents +\end{verbatim} +will let \csa{tableofcontents} print only the sectioning units having been +flagged with both |A| and |B| and none of |C|, |D|, or |E|. + +\textbf{Do not forget the second pair of braces if you only want to require + some tags:} \csa{nexttocwithtags}|{tag1, tag2}{}|. + + +\subsubsection{starred variants} + +There are starred variants: +\begin{verbatim} +\nexttocwithtags{A, B}{C, D, E} % A and B and neither C nor D nor E +\nexttocwithtags*{A, B}{C, D, E} % (A or B) and neither C nor D nor E +\nexttocwithtags{A, B}*{C, D, E} % A and B and (not C or not D or not E) +\nexttocwithtags*{A, B}*{C, D, E} % (A or B) and (not C or not D or not E) +\end{verbatim} -\subsection{\csbhyp{tableoftaggedcontents\{required,csv,list\}\{excluded,csv,list\}}} +\subsection{\csbhyp{tableoftaggedcontents \{required tag1, required tag2, + ...\}\{excluded tag1, excluded tag2, ... \}}} -This command is provided in case the document class allows only a single use of -\csa{tableofcontents}: it can be used arbitrarily many times. However it does not -typeset a heading. Example: +This command is provided in case the document class allows only a single use +of \csa{tableofcontents}, indeed \csa{tableoftaggedcontents} can be used +arbitrarily many times. \textbf{However it does not typeset a heading}. Example: \begin{verbatim} \section*{A table of tagged contents} % <- needs to be explicitely added -\tableoftaggedcontents{weaponry,hunting}{ecology,climate} +\tableoftaggedcontents{weaponry, hunting}{ecology, climate} \end{verbatim} This will limit the printed TOC entries to the ones which have been tagged with |weaponry| and also with |hunting|, but not with |ecology| and neither with @@ -466,80 +494,54 @@ This will limit the printed TOC entries to the ones which have been tagged with There are starred variants: \begin{verbatim} -\tableoftaggedcontents{A,B}{C,D,E} % A and B and neither C nor D nor E -\tableoftaggedcontents*{A,B}{C,D,E} % (A or B) and neither C nor D nor E -\tableoftaggedcontents{A,B}*{C,D,E} % A and B and (not C or not D or not E) -\tableoftaggedcontents*{A,B}*{C,D,E} % (A or B) and (not C or not D or not E) +\tableoftaggedcontents{A, B}{C, D, E} % A and B and neither C nor D nor E +\tableoftaggedcontents*{A, B}{C, D, E} % (A or B) and neither C nor D nor E +\tableoftaggedcontents{A, B}*{C, D, E} % A and B and (not C or not D or not E) +\tableoftaggedcontents*{A, B}*{C, D, E} % (A or B) and (not C or not D or not E) \end{verbatim} -\subsection{\csbhyp{tableof\{required,csv,list\}}} +\subsection{\csbhyp{tableof \{required tag1, required tag2, ...\}}} -This is equivalent to |\tableoftaggedcontents{required,csv,list}{}|. +This is equivalent to |\tableoftaggedcontents{required tag1, ...}{}|. \begin{verbatim} \tableof{weaponry,hunting} % will print the entries tagged with weaponry AND hunting \end{verbatim} There is a starred variant: \begin{verbatim} -\tableof*{weaponry,hunting} % will print the entries tagged with weaponry +\tableof*{weaponry, hunting} % will print the entries tagged with weaponry OR hunting \end{verbatim} -\subsection{\csbhyp{tablenotof\{excluded,csv,list\}}} +\subsection{\csbhyp{tablenotof \{excluded tag1, excluded tag2, ...\}}} -This is equivalent to |\tableoftaggedcontents{}{excluded,csv,list}|. +This is equivalent to |\tableoftaggedcontents{}{excluded tag1, ...}|. \begin{verbatim} -\tablenotof{weaponry,hunting} % will print the entries NOT tagged with weaponry - NEITHER with hunting +\tablenotof{weaponry, hunting} +% will print the entries NOT tagged with weaponry NEITHER with hunting \end{verbatim} There is a starred variant: \begin{verbatim} -\tablenotof*{weaponry,hunting} % will print the entries NOT tagged with weaponry - OR NOT tagged with hunting -\end{verbatim} - - -\subsection{\csbhyp{nexttocwithtags\{required,csv,list\}\{excluded,csv,list\}}} - -This command influences the next \csa{tableofcontents} (or equivalent) command: -\begin{verbatim} -\nexttocwithtags{A,B}{C,D,E} -\tableofcontents -\end{verbatim} -will let \csa{tableofcontents} print only the sectioning units having been -flagged with both |A| and |B| and none of |C|, |D|, or |E|. - -Do not forget the second pair of braces if you only want to require some tags: -\csa{nexttocwithtags}|{tag1,tag2}{}|. - -\subsubsection{starred variants} - -There are starred variants: -\begin{verbatim} -\nexttocwithtags{A,B}{C,D,E} % A and B and neither C nor D nor E -\nexttocwithtags*{A,B}{C,D,E} % (A or B) and neither C nor D nor E -\nexttocwithtags{A,B}*{C,D,E} % A and B and (not C or not D or not E) -\nexttocwithtags*{A,B}*{C,D,E} % (A or B) and (not C or not D or not E) +\tablenotof*{weaponry, hunting} +% will print the entries NOT tagged with weaponry OR NOT tagged with hunting \end{verbatim} \subsection{\csbhyp{tofOpenTocFileForWrite}} -The |.toc| file is read (if it exists) into memory by \tableof at the time -of \csa{usepackage\{tableof\}}, for use by \csa{tableoftaggedcontents}, -\csa{tableof} and \csa{tablenotof}. - -But the creation -of the |.toc| file is not dealt with by \tableof itself: either this will be -done by a standard \csa{tableofcontents} command somewhere in the document, or, -one may use the package provided command \csa{tofOpenTocFileForWrite} which does -not display anything and just does what its name indicates. This command can be -used also in the preamble. +The contents of the |.toc| file (if it already exists) are read into memory by +\tableof once, at the time of |\begin{document}|.\footnote{New with |1.3|. + Earlier versions read the |.toc| file at the time of + \csa{usepackage\{tableof\}}. But this could cause a problem if the |.toc| + file used characters not yet activated by Babel.} +This is only of relevance if the \csa{tableoftaggedcontents}, +\csa{tableof} or \csa{tablenotof} are made use of in the document. -% \footnote{Note to people or packages wanting also to -% access the |.toc| file: as happens with the standard \csa{tableofcontents}, the -% |.toc| file becomes temporarily empty immediately after -% \csa{tofOpenTocFileForWrite}.} +The creation of the |.toc| file is \emph{not} dealt with by \tableof itself: +either this will be done by a standard \csa{tableofcontents} command somewhere +in the document, or, one may use the package provided command +\csa{tofOpenTocFileForWrite} which does not display anything and just does +what its name indicates. This command can be used also in the preamble. Again: this command should \emph{not} be used when the document makes use of its own \csa{tableofcontents} or equivalent. It is provided only for the case where @@ -553,7 +555,11 @@ lines in the |.toc| file (and this must be taken into account). This check is done at the \csa{begin}|{document}| so the order of loading is not important. \tableof adds the tag data to the |.toc| file, but this data self-defines -itself to do nothing when not activated by \tableof's own commands. +itself to do nothing when not activated by \tableof's own commands. Since +release |1.3|, these redefinitions are done in \emph{one single} line of the +|.toc| file to circumvent \emph{crazy} interference of |biblatex| which adds +commands to the |.toc| line on every other line (thus, potentially right in +the middle of multi-line commands \verb+:-(+. % Hence the generated |.toc| file may be imported for use % by other \TeX{} documents.\footnote{this import must do \csa{makeatletter} and @@ -561,9 +567,10 @@ itself to do nothing when not activated by \tableof's own commands. No testing has actually been done of compatibility with packages manipulating tables of contents, apart from -\etoc.\footnote{\url{http://www.ctan.org/pkg/etoc}} It went fine. +\etoc.\footnote{\url{http://www.ctan.org/pkg/etoc}} It went fine.\footnote{but + that was a long time ago\dots} -\subsection{TODO} +\subsection{(old) TODO (never to be done ?)} Create a parser for arbitrary iterated boolean combinations of tags . . . but this kind of thing must have been done a zillion times already, as it belongs to @@ -571,16 +578,27 @@ the basics in computer science! ... and it surely is no easy task in \TeX{}! so I cautiously retreated from re-doing something difficult which has already been done somewhere by someone ... -\subsection{version history} +\subsection{Version History} \begingroup \parindent0pt \makeatletter -\settowidth{\dimen@}{\ttfamily 2013/03/04 v1.2: i.\space} +\settowidth{\dimen@}{\ttfamily 2015/02/11 v1.3: i.\space} \everypar\expandafter{\expandafter\hangindent\the\dimen@ \hangafter1 } \makeatother +|2015/02/11 v1.3: i. |comma separated tags now allow spaces (they are removed). + +| ii. |only one line used for the |.toc| code silently +unactivating |tableof| if its |\usepackage{tableof}| has been removed from the +document source. (needed due to aggressive |biblatex| interference with |.toc| +files.) + +| iii. |reading of .toc file is delayed to |\begin{document}| to +account for possible Babel active characters used therein. Not relevant if +document uses standard |\tableofcontents| or like commands. + |2013/03/04 v1.2: i. |added \csa{tableoftaggedcontents} as a wrapper for using \csa{nexttocwithtags} followed with |tableof|'s private copy of the |.toc| data. @@ -657,38 +675,50 @@ release. % \begin{macrocode} \newtoks\tof@toctoks % \end{macrocode} +% |1.3| codes this |\tof@readtoc| slightly better (copied from etoc.dtx). % \begin{macrocode} -\def\tof@readtoc#1{% - \ifeof #1 - \let\tof@nextread\@gobble - \global\tof@toctoks\expandafter{\the\tof@toctoks}% +\def\tof@readtoc {% + \ifeof \tof@tf \else - \let\tof@nextread\tof@readtoc - \read #1 to \tof@buffer + \read\tof@tf to \tof@buffer \tof@toctoks\expandafter\expandafter\expandafter {\expandafter\the\expandafter\tof@toctoks\tof@buffer}% - \fi - \tof@nextread{#1}} + \expandafter\tof@readtoc + \fi } % \end{macrocode} +% |1.3| of |2015/02/11| moves the reading of the toc file to At Begin +% Document. This is needed for Babel activated characters. I also re-use +% |\endlinechar-1| which I had commented out since release |1.1|. Notice +% though that this is irrelevant if the document uses |tableof| only via its +% tagging abilities, and has standard |\tableofcontents| command to print the +% TOC. % \begin{macrocode} -\IfFileExists{\jobname .toc} - {{% \endlinechar-1 +\AtBeginDocument{\IfFileExists{\jobname.toc} + {{\endlinechar-1 \makeatletter \newread\tof@tf \openin\tof@tf\@filef@und - \tof@readtoc\tof@tf - \closein\tof@tf}}{} + \tof@readtoc + \global\tof@toctoks=\expandafter{\the\tof@toctoks}% + \closein\tof@tf}}{}} % \end{macrocode} -% 2013/03/04: \csa{string\{}->\{, idem with \}. And added \csa{if@filesw} test. +% |1.2| of |2013/03/04|: \csa{string\{}->\{, idem with +% \}. And added \csa{if@filesw} test. +% +% |1.3| of |2015/02/11|: to circumvent aggressive biblatex manipulation of the +% |.toc| file, I put things to the |.toc| file in one-go; else weird commands +% might get inserted right in the middle of arguments to a multi-line macro! +% also removed a bunch of |\string|'s: when I first wrote this package I had +% still limited understanding of \TeX's macros. % \begin{macrocode} \AtBeginDocument{ - \addtocontents{toc}{\string\@ifundefined{tof@begin}} - \addtocontents{toc}{{\let\string\tof@begin\string\relax% - \string\let\string\tof@finish\string\relax% - \string\let\string\tof@starttags\string\@gobble% - \string\let\string\tof@stoptags\string\@gobble% - \string\let\string\tof@tagthis\string\@gobble% - \string\let\string\tof@untagthis\string\@gobble}{}} + \addtocontents{toc}{\string\@ifundefined{tof@begin}% + {\let\string\tof@begin\relax + \let\string\tof@finish\relax + \let\string\tof@starttags\string\@gobble + \let\string\tof@stoptags\string\@gobble + \let\string\tof@tagthis\string\@gobble + \let\string\tof@untagthis\string\@gobble}{}} \addtocontents{toc}{\string\tof@begin} \@ifpackageloaded{hyperref} {\def\tof@gobblethree@orfour#1#2#3#4{}% @@ -698,7 +728,7 @@ release. \newcommand\tofOpenTocFileForWrite{% \if@filesw \newwrite \tf@toc - \immediate \openout \tf@toc \jobname .toc\relax + \immediate \openout \tf@toc \jobname.toc\relax \fi} % \end{macrocode} % Creating our booleans is not the most economical, (one could have used a @@ -708,21 +738,19 @@ release. \def\tof@tags{} \def\tof@tags@tmp{} \def\tof@untags@tmp{} -\def\tof@true#1{\expandafter\let\csname tofsw@#1\endcsname\iftrue} +\def\tof@true #1{\expandafter\let\csname tofsw@#1\endcsname\iftrue} \def\tof@false#1{\expandafter\let\csname tofsw@#1\endcsname\iffalse} -\def\tof@secondiftrue#1{\csname tofsw@#1\endcsname - \let\tof@next\@secondoftwo\fi} -\def\tof@secondiffalse#1{\csname tofsw@#1\endcsname\else - \let\tof@next\@secondoftwo\fi} +\def\tof@secondiftrue#1% + {\csname tofsw@#1\endcsname \let\tof@next\@secondoftwo\fi} +\def\tof@secondiffalse#1% + {\csname tofsw@#1\endcsname\else\let\tof@next\@secondoftwo\fi} % \end{macrocode} -% Just using the \csa{@for} thing with no attempt at any more sophisticated -% parsing (for spaces in particular). % \begin{macrocode} -\def\tof@setflags#1{\let\tof@next\@firstoftwo - \@for\@tempa:=#1\do{\tof@true{\@tempa}}% - \@for\@tempa:=\tof@tags\do{\tof@false{\@tempa}}% - \@for\@tempa:=\tof@tags@tmp\do{\tof@false{\@tempa}}% - \@for\@tempa:=\tof@untags@tmp\do{\tof@true{\@tempa}}} +\def\tof@setflags #1{\let\tof@next\@firstoftwo + \@for\@tempa:=#1\do {\tof@true {\@tempa}}% + \@for\@tempa:=\tof@tags\do {\tof@false{\@tempa}}% + \@for\@tempa:=\tof@tags@tmp\do {\tof@false{\@tempa}}% + \@for\@tempa:=\tof@untags@tmp\do{\tof@true {\@tempa}}} % \end{macrocode} % \begin{macrocode} \def\tof@filter#1#2{\ifx#1#2\else @@ -744,73 +772,89 @@ release. \let\tof@savedcontentsline\contentsline \let\tof@starttags\tof@@starttags \let\tof@stoptags\tof@@stoptags - \def\tof@tagthis####1{\def\tof@tags@tmp{####1}}% - \def\tof@untagthis####1{\def\tof@untags@tmp{####1}}% - \def\contentsline{#1}}} + \def\tof@tagthis ####1{\def\tof@tags@tmp{####1}}% + \def\tof@untagthis ####1{\def\tof@untags@tmp{####1}}% + \def\contentsline {#1}}} +% \end{macrocode} +% Until |1.3|, I was just using the \csa{@for} thing with no attempt at any +% extra parsing, for spaces in particular. With |1.3| of |2015/02/11| I use an +% |\edef| to remove all spaces first, using a |\zapspaces| macro pioneered in +% |xintkernel.sty|. Thus, comma separated lists of tags can have spaces. They +% will be removed if not protected by braces. +% \begin{macrocode} +\def\tof@zapspaces #1 #2{#1#2\tof@zapspaces }% +\def\tof@cleanspaces #1#2{\edef\tof@tmp {{\tof@zapspaces #2 \@gobble}}% + \expandafter #1\tof@tmp } % \end{macrocode} % \begin{macrocode} -\def\tof@and#1{% +\def\tof@and #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}% - \the\tof@toctoks} -\def\tof@or#1{% + \the\tof@toctoks } +\def\tof@or #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}% - \the\tof@toctoks} -\def\tof@nor#1{% + \the\tof@toctoks } +\def\tof@nor #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}% - \the\tof@toctoks} -\def\tof@nand#1{% + \the\tof@toctoks } +\def\tof@nand #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}% - \the\tof@toctoks} -\newcommand*\tableof{\@ifstar{\tof@or}{\tof@and}} -\newcommand*\tablenotof{\@ifstar{\tof@nand}{\tof@nor}} + \the\tof@toctoks } +\newcommand*\tableof{\@ifstar{\tof@cleanspaces\tof@or} + {\tof@cleanspaces\tof@and}} +\newcommand*\tablenotof{\@ifstar{\tof@cleanspaces\tof@nand} + {\tof@cleanspaces\tof@nor}} % \end{macrocode} % \begin{macrocode} -\def\tof@nextof@or#1{\toks\z@{\tof@setflags{#1}% +\def\tof@nextof@or #1{\toks@{\tof@setflags{#1}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}% - \@ifstar{\tof@nextof@nand}{\tof@nextof@nor}} -\def\tof@nextof@and#1{\toks\z@{\tof@setflags{#1}% + \@ifstar{\tof@cleanspaces\tof@nextof@nand} + {\tof@cleanspaces\tof@nextof@nor}} +\def\tof@nextof@and #1{\toks@{\tof@setflags{#1}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\@secondoftwo\@firstoftwo {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}% - \@ifstar{\tof@nextof@nand}{\tof@nextof@nor}} -\def\tof@nextof@nor#1{% - \toks\z@\expandafter{\the\toks\z@ + \@ifstar{\tof@cleanspaces\tof@nextof@nand} + {\tof@cleanspaces\tof@nextof@nor}} +\def\tof@nextof@nor #1{% + \toks@\expandafter{\the\toks@ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}}% - \expandafter\tof@init\expandafter{\the\toks\z@}% - \tof@printtoc} -\def\tof@nextof@nand#1{% - \toks\z@\expandafter{\the\toks\z@ + \expandafter\tof@init\expandafter{\the\toks@}% + \tof@printtoc } +\def\tof@nextof@nand #1{% + \toks@\expandafter{\the\toks@ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}}% - \expandafter\tof@init\expandafter{\the\toks\z@}% - \tof@printtoc} + \expandafter\tof@init\expandafter{\the\toks@}% + \tof@printtoc } \newcommand*{\nexttocwithtags}{\let\tof@printtoc\relax - \@ifstar{\tof@nextof@or}{\tof@nextof@and}} + \@ifstar{\tof@cleanspaces\tof@nextof@or} + {\tof@cleanspaces\tof@nextof@and}} \newcommand*{\tableoftaggedcontents}{\def\tof@printtoc{\the\tof@toctoks}% - \@ifstar{\tof@nextof@or}{\tof@nextof@and}} + \@ifstar{\tof@cleanspaces\tof@nextof@or} + {\tof@cleanspaces\tof@nextof@and}} % \end{macrocode} % \begin{macrocode} -\newcommand*\toftagthis[1]{\addtocontents{toc} - {\string\tof@tagthis{#1}}} -\newcommand*\tofuntagthis[1]{\addtocontents{toc} - {\string\tof@untagthis{#1}}} -\newcommand*\toftagstart[1]{\addtocontents{toc} - {\string\tof@starttags{#1}}} -\newcommand*\toftagstop[1]{\addtocontents{toc} - {\string\tof@stoptags{#1}}} +\newcommand*\toftagthis[1] + {\addtocontents{toc}{\string\tof@tagthis {\tof@zapspaces #1 \@gobble }}} +\newcommand*\tofuntagthis[1] + {\addtocontents{toc}{\string\tof@untagthis{\tof@zapspaces #1 \@gobble }}} +\newcommand*\toftagstart[1] + {\addtocontents{toc}{\string\tof@starttags{\tof@zapspaces #1 \@gobble }}} +\newcommand*\toftagstop[1] + {\addtocontents{toc}{\string\tof@stoptags {\tof@zapspaces #1 \@gobble }}} \endinput % \end{macrocode} % \MakePercentComment @@ -830,7 +874,7 @@ release. Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{473} +\CheckSum{485} \Finale %% diff --git a/Master/texmf-dist/source/latex/tableof/tableof.ins b/Master/texmf-dist/source/latex/tableof/tableof.ins index 1266d9479ef..7337c871904 100644 --- a/Master/texmf-dist/source/latex/tableof/tableof.ins +++ b/Master/texmf-dist/source/latex/tableof/tableof.ins @@ -1,28 +1,27 @@ -\def\pkgname{tableof} -\def\pkgdate{2013/03/04} -\def\pkgversion{v1.2} -\def\pkgdescription{tables of tagged contents (jfB)} %% -%% Package `tableof' by Jean-Francois Burnol -%% Copyright (C) 2012,2013 by Jean-Francois Burnol +%% Package: tableof +%% Version: 1.3 (2015/02/11) +%% License: LPPL 1.3c +%% Copyright (C) 2012-2015 Jean-Francois Burnol %% +\def\pkgname {tableof} +\def\pkgdate {2015/02/11} +\def\pkgversion {v1.3} +\def\pkgdescription {Tables of tagged contents (jfB)} %% This file `tableof.ins' is provided for compatibility with TeX %% distributions expecting to find it for installation of `tableof.sty'. %% -%% As usual `latex tableof.ins' produces `tableof.sty' from the source +%% As usual `tex tableof.ins' produces `tableof.sty' from the source %% `tableof.dtx' %% %% (an already existing `tableof.sty' in the same repertory will be %% overwritten) %% %% Move `tableof.sty' to a suitable location within the TeX installation: -%% tableof.sty -> ................/tex/latex/tableof/ +%% tableof.sty -> /tex/latex/tableof/ %% %% The generated auxiliary files may be discarded. %% -%% See `tableof.dtx' for the statements of copyright and conditions of -%% distribution and/or modification. -%% \input docstrip.tex \askforoverwritefalse \def\pkgpreamble{\defaultpreamble^^J\MetaPrefix^^J% diff --git a/Master/texmf-dist/tex/latex/tableof/tableof.sty b/Master/texmf-dist/tex/latex/tableof/tableof.sty index 0a3723f9327..73d4b1a944f 100644 --- a/Master/texmf-dist/tex/latex/tableof/tableof.sty +++ b/Master/texmf-dist/tex/latex/tableof/tableof.sty @@ -22,41 +22,41 @@ %% in the same archive or directory.) %% \ProvidesPackage{tableof} - [2013/03/04 v1.2 tables of tagged contents (jfB)] + [2015/02/11 v1.3 Tables of tagged contents (jfB)] %% -%% Package `tableof' by Jean-Francois Burnol -%% Copyright (C) 2012,2013 by Jean-Francois Burnol +%% Package: tableof +%% Version: 1.3 (2015/02/11) +%% License: LPPL 1.3c +%% Copyright (C) 2012-2015 Jean-Francois Burnol %% \NeedsTeXFormat{LaTeX2e} \DeclareOption*{\PackageWarning{tableof}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax \newtoks\tof@toctoks -\def\tof@readtoc#1{% - \ifeof #1 - \let\tof@nextread\@gobble - \global\tof@toctoks\expandafter{\the\tof@toctoks}% +\def\tof@readtoc {% + \ifeof \tof@tf \else - \let\tof@nextread\tof@readtoc - \read #1 to \tof@buffer + \read\tof@tf to \tof@buffer \tof@toctoks\expandafter\expandafter\expandafter {\expandafter\the\expandafter\tof@toctoks\tof@buffer}% - \fi - \tof@nextread{#1}} -\IfFileExists{\jobname .toc} - {{% \endlinechar-1 + \expandafter\tof@readtoc + \fi } +\AtBeginDocument{\IfFileExists{\jobname.toc} + {{\endlinechar-1 \makeatletter \newread\tof@tf \openin\tof@tf\@filef@und - \tof@readtoc\tof@tf - \closein\tof@tf}}{} + \tof@readtoc + \global\tof@toctoks=\expandafter{\the\tof@toctoks}% + \closein\tof@tf}}{}} \AtBeginDocument{ - \addtocontents{toc}{\string\@ifundefined{tof@begin}} - \addtocontents{toc}{{\let\string\tof@begin\string\relax% - \string\let\string\tof@finish\string\relax% - \string\let\string\tof@starttags\string\@gobble% - \string\let\string\tof@stoptags\string\@gobble% - \string\let\string\tof@tagthis\string\@gobble% - \string\let\string\tof@untagthis\string\@gobble}{}} + \addtocontents{toc}{\string\@ifundefined{tof@begin}% + {\let\string\tof@begin\relax + \let\string\tof@finish\relax + \let\string\tof@starttags\string\@gobble + \let\string\tof@stoptags\string\@gobble + \let\string\tof@tagthis\string\@gobble + \let\string\tof@untagthis\string\@gobble}{}} \addtocontents{toc}{\string\tof@begin} \@ifpackageloaded{hyperref} {\def\tof@gobblethree@orfour#1#2#3#4{}% @@ -66,22 +66,22 @@ \newcommand\tofOpenTocFileForWrite{% \if@filesw \newwrite \tf@toc - \immediate \openout \tf@toc \jobname .toc\relax + \immediate \openout \tf@toc \jobname.toc\relax \fi} \def\tof@tags{} \def\tof@tags@tmp{} \def\tof@untags@tmp{} -\def\tof@true#1{\expandafter\let\csname tofsw@#1\endcsname\iftrue} +\def\tof@true #1{\expandafter\let\csname tofsw@#1\endcsname\iftrue} \def\tof@false#1{\expandafter\let\csname tofsw@#1\endcsname\iffalse} -\def\tof@secondiftrue#1{\csname tofsw@#1\endcsname - \let\tof@next\@secondoftwo\fi} -\def\tof@secondiffalse#1{\csname tofsw@#1\endcsname\else - \let\tof@next\@secondoftwo\fi} -\def\tof@setflags#1{\let\tof@next\@firstoftwo - \@for\@tempa:=#1\do{\tof@true{\@tempa}}% - \@for\@tempa:=\tof@tags\do{\tof@false{\@tempa}}% - \@for\@tempa:=\tof@tags@tmp\do{\tof@false{\@tempa}}% - \@for\@tempa:=\tof@untags@tmp\do{\tof@true{\@tempa}}} +\def\tof@secondiftrue#1% + {\csname tofsw@#1\endcsname \let\tof@next\@secondoftwo\fi} +\def\tof@secondiffalse#1% + {\csname tofsw@#1\endcsname\else\let\tof@next\@secondoftwo\fi} +\def\tof@setflags #1{\let\tof@next\@firstoftwo + \@for\@tempa:=#1\do {\tof@true {\@tempa}}% + \@for\@tempa:=\tof@tags\do {\tof@false{\@tempa}}% + \@for\@tempa:=\tof@tags@tmp\do {\tof@false{\@tempa}}% + \@for\@tempa:=\tof@untags@tmp\do{\tof@true {\@tempa}}} \def\tof@filter#1#2{\ifx#1#2\else \ifx\tof@tmptags\@empty\edef\tof@tmptags{#2}\else \edef\tof@tmptags{\tof@tmptags,#2}\fi\fi} @@ -99,67 +99,76 @@ \let\tof@savedcontentsline\contentsline \let\tof@starttags\tof@@starttags \let\tof@stoptags\tof@@stoptags - \def\tof@tagthis####1{\def\tof@tags@tmp{####1}}% - \def\tof@untagthis####1{\def\tof@untags@tmp{####1}}% - \def\contentsline{#1}}} -\def\tof@and#1{% + \def\tof@tagthis ####1{\def\tof@tags@tmp{####1}}% + \def\tof@untagthis ####1{\def\tof@untags@tmp{####1}}% + \def\contentsline {#1}}} +\def\tof@zapspaces #1 #2{#1#2\tof@zapspaces }% +\def\tof@cleanspaces #1#2{\edef\tof@tmp {{\tof@zapspaces #2 \@gobble}}% + \expandafter #1\tof@tmp } +\def\tof@and #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}% - \the\tof@toctoks} -\def\tof@or#1{% + \the\tof@toctoks } +\def\tof@or #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}% - \the\tof@toctoks} -\def\tof@nor#1{% + \the\tof@toctoks } +\def\tof@nor #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}% - \the\tof@toctoks} -\def\tof@nand#1{% + \the\tof@toctoks } +\def\tof@nand #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}% - \the\tof@toctoks} -\newcommand*\tableof{\@ifstar{\tof@or}{\tof@and}} -\newcommand*\tablenotof{\@ifstar{\tof@nand}{\tof@nor}} -\def\tof@nextof@or#1{\toks\z@{\tof@setflags{#1}% + \the\tof@toctoks } +\newcommand*\tableof{\@ifstar{\tof@cleanspaces\tof@or} + {\tof@cleanspaces\tof@and}} +\newcommand*\tablenotof{\@ifstar{\tof@cleanspaces\tof@nand} + {\tof@cleanspaces\tof@nor}} +\def\tof@nextof@or #1{\toks@{\tof@setflags{#1}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}% - \@ifstar{\tof@nextof@nand}{\tof@nextof@nor}} -\def\tof@nextof@and#1{\toks\z@{\tof@setflags{#1}% + \@ifstar{\tof@cleanspaces\tof@nextof@nand} + {\tof@cleanspaces\tof@nextof@nor}} +\def\tof@nextof@and #1{\toks@{\tof@setflags{#1}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\@secondoftwo\@firstoftwo {\def\tof@tags@tmp{}\def\tof@untags@tmp{}\tof@gobblethree@orfour}}% - \@ifstar{\tof@nextof@nand}{\tof@nextof@nor}} -\def\tof@nextof@nor#1{% - \toks\z@\expandafter{\the\toks\z@ + \@ifstar{\tof@cleanspaces\tof@nextof@nand} + {\tof@cleanspaces\tof@nextof@nor}} +\def\tof@nextof@nor #1{% + \toks@\expandafter{\the\toks@ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% \tof@next\tof@savedcontentsline\tof@gobblethree@orfour}}% - \expandafter\tof@init\expandafter{\the\toks\z@}% - \tof@printtoc} -\def\tof@nextof@nand#1{% - \toks\z@\expandafter{\the\toks\z@ + \expandafter\tof@init\expandafter{\the\toks@}% + \tof@printtoc } +\def\tof@nextof@nand #1{% + \toks@\expandafter{\the\toks@ {\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% \@for\@tempa:=#1\do{\tof@secondiftrue{\@tempa}}% \tof@next\tof@gobblethree@orfour\tof@savedcontentsline}}% - \expandafter\tof@init\expandafter{\the\toks\z@}% - \tof@printtoc} + \expandafter\tof@init\expandafter{\the\toks@}% + \tof@printtoc } \newcommand*{\nexttocwithtags}{\let\tof@printtoc\relax - \@ifstar{\tof@nextof@or}{\tof@nextof@and}} + \@ifstar{\tof@cleanspaces\tof@nextof@or} + {\tof@cleanspaces\tof@nextof@and}} \newcommand*{\tableoftaggedcontents}{\def\tof@printtoc{\the\tof@toctoks}% - \@ifstar{\tof@nextof@or}{\tof@nextof@and}} -\newcommand*\toftagthis[1]{\addtocontents{toc} - {\string\tof@tagthis{#1}}} -\newcommand*\tofuntagthis[1]{\addtocontents{toc} - {\string\tof@untagthis{#1}}} -\newcommand*\toftagstart[1]{\addtocontents{toc} - {\string\tof@starttags{#1}}} -\newcommand*\toftagstop[1]{\addtocontents{toc} - {\string\tof@stoptags{#1}}} + \@ifstar{\tof@cleanspaces\tof@nextof@or} + {\tof@cleanspaces\tof@nextof@and}} +\newcommand*\toftagthis[1] + {\addtocontents{toc}{\string\tof@tagthis {\tof@zapspaces #1 \@gobble }}} +\newcommand*\tofuntagthis[1] + {\addtocontents{toc}{\string\tof@untagthis{\tof@zapspaces #1 \@gobble }}} +\newcommand*\toftagstart[1] + {\addtocontents{toc}{\string\tof@starttags{\tof@zapspaces #1 \@gobble }}} +\newcommand*\toftagstop[1] + {\addtocontents{toc}{\string\tof@stoptags {\tof@zapspaces #1 \@gobble }}} \endinput %% %% End of file `tableof.sty'. -- cgit v1.2.3