diff options
author | Karl Berry <karl@freefriends.org> | 2015-02-21 23:03:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-02-21 23:03:57 +0000 |
commit | e4f727c8991f7980badd242b13ad357e3aa970bd (patch) | |
tree | f78eac5986bf438bff65d50aa935cfbe29a6f28b /Master/texmf-dist/source/latex | |
parent | ce8d92af4260f815abdb49c6dc8736307d50e93e (diff) |
tableof (21feb15)
git-svn-id: svn://tug.org/texlive/trunk@36347 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/tableof/tableof.dtx | 139 | ||||
-rw-r--r-- | Master/texmf-dist/source/latex/tableof/tableof.ins | 6 |
2 files changed, 88 insertions, 57 deletions
diff --git a/Master/texmf-dist/source/latex/tableof/tableof.dtx b/Master/texmf-dist/source/latex/tableof/tableof.dtx index d03f2fc8765..cf0eda06a61 100644 --- a/Master/texmf-dist/source/latex/tableof/tableof.dtx +++ b/Master/texmf-dist/source/latex/tableof/tableof.dtx @@ -1,13 +1,13 @@ % -*- coding: iso-latin-1; -*- %<*none> -{\def\doctimestamp {Time-stamp <11-02-2015 23:14:33 CET>}% +{\def\doctimestamp {Time-stamp: <20-02-2015 23:02:03 CET>}% \def\getdtxtimestamp #1 <#2 #3 #4>{#2 at #3 #4}% \xdef\tofdtxtimestamp {\expandafter\getdtxtimestamp\doctimestamp }}% -\def\docdate{2015/02/11} +\def\docdate{2015/02/20} %</none> %% %% Package: tableof -%% Version: 1.3 (2015/02/11) +%% Version: 1.4 (2015/02/20) %% License: LPPL 1.3c %% Copyright (C) 2012-2015 Jean-Francois Burnol <jfbu at free dot fr> %% @@ -41,8 +41,8 @@ % %<*ins> \def\pkgname {tableof} -\def\pkgdate {2015/02/11} -\def\pkgversion {v1.3} +\def\pkgdate {2015/02/20} +\def\pkgversion {v1.4} \def\pkgdescription {Tables of tagged contents (jfB)} %</ins> %<*none> @@ -255,6 +255,16 @@ A,B,C %</test> %<*none> \fi +\makeatletter + \@for\@tempa:=hyperref,bookmark,graphicx,color\do + {\PassOptionsToPackage{dvipdfmx}\@tempa} + % + \PassOptionsToPackage{dvipdfm}{geometry} + \PassOptionsToPackage{bookmarks=true}{hyperref} + \PassOptionsToPackage{dvipdfmx-outline-open}{hyperref} + \PassOptionsToPackage{dvipdfmx-outline-open}{bookmark} + % +\makeatother \documentclass[a4paper,fontsize=11pt,abstract]{scrdoc} \pagestyle{headings} \usepackage[latin1]{inputenc} @@ -378,20 +388,21 @@ pdfpagemode=UseOutlines} \begin{abstract} The commands \csa{toftagstart}, \csa{toftagstop}, \csa{toftagthis}, -\csa{tofuntagthis} are used to tag chapters or sections. Then: +\csa{tofuntagthis} are used to tag chapters, sections or any other sectioning +units destined to end up in the table(s) of contents. Then: \begin{quote} - \csa{nexttocwithtags}\{required1, requ.2, ...\}\{excluded1, - excl.2, ...\}\\ + \csa{nexttocwithtags}\{req. 1, req. 2, ...\}\{excl. 1, + 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, +For documents with classes where \csa{tableofcontents} is only single-use, the package provides: \begin{quote} - \csa{tableoftaggedcontents}\{required1, requ.2, ...\}\{excluded1, - excl.2, ...\} + \csa{tableoftaggedcontents}\{req. 1, req. 2, ...\}\{excl. 1, + excl. 2, ...\} \end{quote} which does not have this restriction. \end{abstract} @@ -533,20 +544,27 @@ 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. + file used characters not yet activated by Babel.} +Notice that this reading of the |.toc| file into memory is only of relevance +if the document makes use of one of the \csa{tableoftaggedcontents}, +\csa{tableof} or \csa{tablenotof} commands. 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. +what its name indicates. This command should \textbf{not} be used in the +preamble, however +\begin{verbatim} + \usepackage{tableof} + \AtBeginDocument{\tofOpenTocFileForWrite} +\end{verbatim} +is possible. -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 -the document uses exclusively \csa{tableoftaggedcontents}, \csa{tableof} and -\csa{tablenotof}. +Please consider: this command should \emph{not} be used when the + document makes use of its own \csa{tableofcontents} or equivalent. It is + provided \emph{only} for the case where the document uses \emph{exclusively} + \csa{tableoftaggedcontents}, \csa{tableof} and \csa{tablenotof}. \subsection{Compatibility with other packages} @@ -554,41 +572,39 @@ the document uses exclusively \csa{tableoftaggedcontents}, \csa{tableof} and 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 requires that the document |.toc| file uses the |\contentsline| macro +(possibly patched by other packages). It is thus incompatible with the +|beamer| class. However, if |beamer| is used in an article mode, i.e., with +the article class in conjunction with the |beamerarticle| package, then \tableof +should work (not tested\dots). + \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. 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 -% also the new document must use |hyperref| if the original did so.} +the middle of multi-line commands \verb+:-(+.) 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.\footnote{but - that was a long time ago\dots} - -\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 -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 ... +\etoc.\footnote{\url{http://www.ctan.org/pkg/etoc}} It went fine. \subsection{Version History} \begingroup \parindent0pt \makeatletter -\settowidth{\dimen@}{\ttfamily 2015/02/11 v1.3: i.\space} +\settowidth{\dimen@}{\ttfamily 2015/02/20 v1.4: 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). +|2015/02/20 v1.4: i. |some code efficiency improvements (some +|\edef|'s replaced by a bunch of |\expandafter|'s.) + +| ii. |improved documentation. + +|2015/02/11 v1.3: i. |comma separated lists of tags now allow spaces. | ii. |only one line used for the |.toc| code silently unactivating |tableof| if its |\usepackage{tableof}| has been removed from the @@ -616,16 +632,14 @@ document uses standard |\tableofcontents| or like commands. \section{Generating the package file and the test file} -Running |latex| (or |pdflatex|) on |tableof.dtx| generates: +Running |latex| on |tableof.dtx| generates: {1})~the package file |tableof.sty| (which should be moved to a suitable location within the \TeX{} installation), -{2})~|tableof.ins| for \TeX{} -distributions expecting such a file, -{3})~|tableoftest.tex| which -demonstrates the package features (one should run |latex| twice on it), -and -{4})~the documentation itself (run |pdflatex| twice to get the -bookmarks.) +{2})~|tableof.ins| for \TeX{} distributions expecting such a file, +{3})~|tableoftest.tex| which demonstrates the package features (one should run +|latex| twice on it), and +{4})~the documentation itself. After running |latex| twice, use |dvipdfmx| to +produce the pdf documentation. \section{Implementation} @@ -671,8 +685,6 @@ release. \NeedsTeXFormat{LaTeX2e} \DeclareOption*{\PackageWarning{tableof}{Option `\CurrentOption' is unknown.}} \ProcessOptions\relax -% \end{macrocode} -% \begin{macrocode} \newtoks\tof@toctoks % \end{macrocode} % |1.3| codes this |\tof@readtoc| slightly better (copied from etoc.dtx). @@ -745,6 +757,7 @@ release. \def\tof@secondiffalse#1% {\csname tofsw@#1\endcsname\else\let\tof@next\@secondoftwo\fi} % \end{macrocode} +% placeholder for comments % \begin{macrocode} \def\tof@setflags #1{\let\tof@next\@firstoftwo \@for\@tempa:=#1\do {\tof@true {\@tempa}}% @@ -752,18 +765,33 @@ release. \@for\@tempa:=\tof@tags@tmp\do {\tof@false{\@tempa}}% \@for\@tempa:=\tof@untags@tmp\do{\tof@true {\@tempa}}} % \end{macrocode} +% Release |1.4| uses here a bunch of |\expandafter|'s in place of some +% |\edef|'s. % \begin{macrocode} \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} + \ifx\tof@tmptags\@empty + \expandafter\def\expandafter\tof@tmptags\expandafter{#2}% + \else + \expandafter\expandafter\expandafter\def + \expandafter\expandafter\expandafter\tof@tmptags + \expandafter\expandafter\expandafter{\expandafter + \tof@tmptags\expandafter,#2}% + \fi\fi} \def\tof@@starttags#1{% - \ifx\tof@tags\@empty\edef\tof@tags{#1}\else - \edef\tof@tags{\tof@tags,#1}\fi} + \ifx\tof@tags\@empty + \def\tof@tags{#1}% + \else + \expandafter\def\expandafter\tof@tags\expandafter{\tof@tags,#1}% + \fi } \def\tof@@stoptags#1{% - \@for\@tempa:=#1\do{\def\tof@tmptags{}% - \@for\@tempb:=\tof@tags\do{\tof@filter\@tempa\@tempb}% - \edef\tof@tags{\tof@tmptags}}} + \@for\@tempa:=#1\do{% + \def\tof@tmptags{}% + \@for\@tempb:=\tof@tags\do{\tof@filter\@tempa\@tempb}% + \expandafter\def\expandafter\tof@tags\expandafter{\tof@tmptags}% + }% + } % \end{macrocode} +% placeholder for comments % \begin{macrocode} \def\tof@init#1{% \def\tof@begin{% @@ -786,6 +814,7 @@ release. \def\tof@cleanspaces #1#2{\edef\tof@tmp {{\tof@zapspaces #2 \@gobble}}% \expandafter #1\tof@tmp } % \end{macrocode} +% placeholder for comments % \begin{macrocode} \def\tof@and #1{% \tof@init{\tof@setflags{#1}\def\tof@tags@tmp{}\def\tof@untags@tmp{}% @@ -812,6 +841,7 @@ release. \newcommand*\tablenotof{\@ifstar{\tof@cleanspaces\tof@nand} {\tof@cleanspaces\tof@nor}} % \end{macrocode} +% placeholder for comments % \begin{macrocode} \def\tof@nextof@or #1{\toks@{\tof@setflags{#1}% \@for\@tempa:=#1\do{\tof@secondiffalse{\@tempa}}% @@ -846,6 +876,7 @@ release. \@ifstar{\tof@cleanspaces\tof@nextof@or} {\tof@cleanspaces\tof@nextof@and}} % \end{macrocode} +% placeholder for comments % \begin{macrocode} \newcommand*\toftagthis[1] {\addtocontents{toc}{\string\tof@tagthis {\tof@zapspaces #1 \@gobble }}} @@ -874,7 +905,7 @@ release. Grave accent \` Left brace \{ Vertical bar \| Right brace \} Tilde \~} -\CheckSum{485} +\CheckSum{505} \Finale %% diff --git a/Master/texmf-dist/source/latex/tableof/tableof.ins b/Master/texmf-dist/source/latex/tableof/tableof.ins index 7337c871904..af6d6597489 100644 --- a/Master/texmf-dist/source/latex/tableof/tableof.ins +++ b/Master/texmf-dist/source/latex/tableof/tableof.ins @@ -1,12 +1,12 @@ %% %% Package: tableof -%% Version: 1.3 (2015/02/11) +%% Version: 1.4 (2015/02/20) %% License: LPPL 1.3c %% Copyright (C) 2012-2015 Jean-Francois Burnol <jfbu at free dot fr> %% \def\pkgname {tableof} -\def\pkgdate {2015/02/11} -\def\pkgversion {v1.3} +\def\pkgdate {2015/02/20} +\def\pkgversion {v1.4} \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'. |