texlive[45166] Master/texmf-dist: tocloft (29aug17)

commits+karl at tug.org commits+karl at tug.org
Tue Aug 29 23:04:45 CEST 2017


Revision: 45166
          http://tug.org/svn/texlive?view=revision&revision=45166
Author:   karl
Date:     2017-08-29 23:04:44 +0200 (Tue, 29 Aug 2017)
Log Message:
-----------
tocloft (29aug17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/tocloft/README
    trunk/Master/texmf-dist/doc/latex/tocloft/tocloft.pdf
    trunk/Master/texmf-dist/source/latex/tocloft/tocloft.dtx
    trunk/Master/texmf-dist/tex/latex/tocloft/tocloft.sty

Modified: trunk/Master/texmf-dist/doc/latex/tocloft/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/tocloft/README	2017-08-29 21:04:31 UTC (rev 45165)
+++ trunk/Master/texmf-dist/doc/latex/tocloft/README	2017-08-29 21:04:44 UTC (rev 45166)
@@ -8,6 +8,13 @@
 _______________
 Change history:
 
+v2.3h
+- Fix conflict with fancyhdr not checking for \chapter in the same tocloft does
+
+v2.3g
+- Add \cftZprehook / \cftZposthook to support multicol ToCs, etc.
+  Listed as experimental.
+
 Changes in version 2.3f (2013/05/02)
 - (Try to) support KOMA and titlesec packages w.r.t. \part entries
 - Extraneous whitespace fixes

Modified: trunk/Master/texmf-dist/doc/latex/tocloft/tocloft.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/tocloft/tocloft.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tocloft/tocloft.dtx	2017-08-29 21:04:31 UTC (rev 45165)
+++ trunk/Master/texmf-dist/source/latex/tocloft/tocloft.dtx	2017-08-29 21:04:44 UTC (rev 45166)
@@ -4,7 +4,7 @@
 % Author: Peter Wilson, Herries Press
 % Maintainer: Will Robertson (will dot robertson at latex-project dot org)
 % Copyright 1998-2003 Peter R. Wilson
-% Copyright 2009 Will Robertson
+% Copyright 2009-2017 Will Robertson
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either
@@ -30,7 +30,7 @@
 %
 % \fi
 %
-% \CheckSum{2219}
+% \CheckSum{2303}
 %
 % \DoNotIndex{\',\.,\@M,\@@input,\@addtoreset,\@arabic,\@badmath}
 % \DoNotIndex{\@centercr,\@cite}
@@ -108,6 +108,8 @@
 % \def\fileversion{v2.3d} \def\filedate{2009/09/04}
 % \def\fileversion{v2.3e} \def\filedate{2010/10/13}
 % \def\fileversion{v2.3f} \def\filedate{2013/05/02}
+% \def\fileversion{v2.3g} \def\filedate{2014/06/14}
+% \def\fileversion{v2.3h} \def\filedate{2017/08/29}
 % \newcommand*{\Lpack}[1]{\textsf {#1}}           ^^A typeset a package
 % \newcommand*{\Lopt}[1]{\textsf {#1}}            ^^A typeset an option
 % \newcommand*{\file}[1]{\texttt {#1}}            ^^A typeset a file
@@ -1169,6 +1171,31 @@
 % \Lpack{ccaption} package. If the illustration is numbered, use the
 % |\cftaddnumtitleline| command instead of |\cftaddtitleline|.
 %
+% \DescribeMacro{\cftZprehook}
+% \DescribeMacro{\cftZposthook}
+% It's surprisingly difficult to achieve multicolumn ToCs; can you guess what the problem is to write the following?
+% \begin{verbatim}
+% \begin{multicols}{2}
+% \tableofcontents
+% \end{multicols}
+% \end{verbatim}
+% Probably the easiest way to do it in regular \LaTeX{} is something like
+% \begin{verbatim}
+% \RequirePackage{multicol}
+% \AtBeginDocument{\addtocontents{toc}{\protect\begin{multicols}{2}}}
+% \AtEndDocument  {\addtocontents{toc}{\protect\end  {multicols}}}
+% \end{verbatim}
+% This method of writing to the |.toc| file is most flexible for trying to control the typesetting output within the table of contents.
+%
+% To make this \emph{slightly} easier with \Lpack{tocloft}, the following macros are available: \cs{cftZprehook} and \cs{cftZprehook}, where |Z| is |toc|, |lof|, |lot|, etc.
+% If these are defined, they insert material just before the actual typesetting of the entries of the table of contents and so on.
+% A multicolumn ToC can therefore be achieved with this:
+% \begin{verbatim}
+% \RequirePackage{multicol}
+% \renewcommand\cfttocprehook{\begin{multicols}{2}}
+% \renewcommand\cfttocposthook{\end{multicols}}
+% \end{verbatim}
+%
 % \subsection{Usage with other packages}
 %
 %    The \Lpack{tocloft} and \Lpack{tocbibind} packages can be used together
@@ -1244,12 +1271,25 @@
 %    \begin{macrocode}
 %<*usc>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tocloft}[2013/05/02 v2.3f parameterised ToC, etc., typesetting]
+\ProvidesPackage{tocloft}[2017/08/29 v2.3h parameterised ToC, etc., typesetting]
 %    \end{macrocode}
 %
 % In order to try and avoid name clashes with other packages, each internal
 % name will include the character string \texttt{@cft}.
 %
+% \begin{macro}{\@cftifundefined}
+% \changes{v2.3h}{2017/08/29}{Use internal ifundefined macro to fix conflict with fancyhdr}
+% Due to a conflict with how this package and fancyhdr checked for undefinedness.
+%    \begin{macrocode}
+\newcommand\@cftifundefined[1]{%
+  \begingroup\expandafter\expandafter\expandafter\endgroup\ifx\csname #1\endcsname\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}{\@cftquit}
 % \begin{macro}{\if at cfthaschapter}
 % We will be using either chapter or section type headings for the ToC, etc.,
@@ -1286,9 +1326,9 @@
 % Issue a warning if there are no recognised sectional divisions 
 % and then skip the rest of the package code.
 %    \begin{macrocode}
-\@ifundefined{chapter}{%
+\@cftifundefined{chapter}{%
   \@cfthaschapterfalse
-  \@ifundefined{section}{%
+  \@cftifundefined{section}{%
     \PackageWarning{tocloft}%
       {I don't recognize any sectional divisions so I'll do nothing}
     \renewcommand{\@cftquit}{\endinput}
@@ -1724,7 +1764,7 @@
 %    \begin{macrocode}
 \newif\if at cftdopart
 \newif\if at cfthaspart
-\@ifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue}
+\@cftifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue}
 \if at cfthaspart
 \renewcommand*{\l at part}[2]{%
   \@cftdopartfalse
@@ -3168,6 +3208,7 @@
     \newlistentry[#1]{#2}{#3}{0}
   \fi
 %    \end{macrocode}
+% \end{macro}
 %
 % \begin{macro}{\ext at Z}
 % \begin{macro}{\Zdepth}
@@ -3291,6 +3332,15 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}{\cftZprehook}
+% \begin{macro}{\cftZposthook}
+% Hooks before and after the list of entries.
+%    \begin{macrocode}
+    \@namedef{cft#3prehook}{}
+    \@namedef{cft#3posthook}{}
+%    \end{macrocode}
+% \end{macro}
+%
 % This is the end of the definition of |\newlistof|.
 %    \begin{macrocode}
 }
@@ -3626,8 +3676,76 @@
 %    \end{macrocode}
 %
 %
+% \begin{macro}{\@starttoc}
 %
+% Okay, here's a roughly-comprehensive list where \cs{@starttoc} is redefined in \TeX{} Live 2014.
+% \begin{itemize}
+% \item amsart, amsbook, amsdtx, amsproc
+% \item asect
+% \item latx.ltx (of course)
+% \item newfloat
+% \item flowfram
+% \item gmampulex (?), gmtypos
+% \item hyperref, memhfixc
+% \item ijmart
+% \item scrartcl, scrbook, scrreprt
+% \item scrwtfile
+% \item tocbasic
+% \item tocstyle
+% \item memoir
+% \item multitoc
+% \item nccsect
+% \item notoccite
+% \item artikel3, boek3, rapport3, 
+% \item rerunfilecheck
+% \item parskip
+% \item pdfwin
+% \item revtex4
+% \item devanagari
+% \end{itemize}
+% This makes things difficult if we want to redefine \cs{@starttoc} here.
+% Many of the packages/classes above will not be used in conjunction with tocloft; on the other hand, we don't want to trample too much on others' code.
 %
+% So for our own work here, let's be extra conservative, at least for now, and only hook into \cs{starttoc} if it's the standard \LaTeX{} version.
+%    \begin{macrocode}
+\def\@starttoc at latex@orig#1{%
+ \begingroup
+   \makeatletter
+   \@input{\jobname.#1}%
+   \if at filesw
+     \expandafter\newwrite\csname tf@#1\endcsname
+     \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
+   \fi
+  \@nobreakfalse
+\endgroup}
+\ifx\@starttoc\@starttoc at latex@orig
+  \def\@starttoc#1{%
+    \csname cft#1prehook\endcsname
+    \begingroup
+      \makeatletter
+      \@input{\jobname.#1}%
+      \if at filesw
+        \expandafter\newwrite\csname tf@#1\endcsname
+        \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
+      \fi
+      \@nobreakfalse
+    \endgroup
+    \csname cft#1posthook\endcsname}
+  \newcommand\cfttocprehook{}
+  \newcommand\cftlofprehook{}
+  \newcommand\cftlotprehook{}
+  \newcommand\cfttocposthook{}
+  \newcommand\cftlofposthook{}
+  \newcommand\cftlotposthook{}
+\else
+  \PackageWarning{tocloft}{\string\@starttoc\space has already been redefined; tocloft bailing out.}
+\fi
+%    \end{macrocode}
+% \end{macro}
+%
+%
+%
+%
 %    The end of this package.
 %    \begin{macrocode}
 %</usc>

Modified: trunk/Master/texmf-dist/tex/latex/tocloft/tocloft.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tocloft/tocloft.sty	2017-08-29 21:04:31 UTC (rev 45165)
+++ trunk/Master/texmf-dist/tex/latex/tocloft/tocloft.sty	2017-08-29 21:04:44 UTC (rev 45166)
@@ -23,7 +23,13 @@
 %%   This work consists of the files listed in the README file.
 %% 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tocloft}[2013/05/02 v2.3f parameterised ToC, etc., typesetting]
+\ProvidesPackage{tocloft}[2017/08/29 v2.3h parameterised ToC, etc., typesetting]
+\newcommand\@cftifundefined[1]{%
+  \begingroup\expandafter\expandafter\expandafter\endgroup\ifx\csname #1\endcsname\relax
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
 \newcommand{\@cftquit}{}
 \newif\if at cfthaschapter
 \newif\if at cftkoma
@@ -33,9 +39,9 @@
 \@ifclassloaded{scrbook}{\@cftkomatrue}{}
 \newif\if at cfttitlesec
 \AtBeginDocument{\@ifpackageloaded{titlesec}{\@cfttitlesectrue}{}}
-\@ifundefined{chapter}{%
+\@cftifundefined{chapter}{%
   \@cfthaschapterfalse
-  \@ifundefined{section}{%
+  \@cftifundefined{section}{%
     \PackageWarning{tocloft}%
       {I don't recognize any sectional divisions so I'll do nothing}
     \renewcommand{\@cftquit}{\endinput}
@@ -179,7 +185,7 @@
 \newcommand{\@cftasnumb}{}
 \newif\if at cftdopart
 \newif\if at cfthaspart
-\@ifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue}
+\@cftifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue}
 \if at cfthaspart
 \renewcommand*{\l at part}[2]{%
   \@cftdopartfalse
@@ -943,6 +949,8 @@
       \fi
     \fi
     \@namedef{cftafter#3title}{}
+    \@namedef{cft#3prehook}{}
+    \@namedef{cft#3posthook}{}
 }
 \newcommand{\cftsetindents}[3]{%
   \def\@cftemp{#1}
@@ -1105,6 +1113,38 @@
   }{}
 }
 
+\def\@starttoc at latex@orig#1{%
+ \begingroup
+   \makeatletter
+   \@input{\jobname.#1}%
+   \if at filesw
+     \expandafter\newwrite\csname tf@#1\endcsname
+     \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
+   \fi
+  \@nobreakfalse
+\endgroup}
+\ifx\@starttoc\@starttoc at latex@orig
+  \def\@starttoc#1{%
+    \csname cft#1prehook\endcsname
+    \begingroup
+      \makeatletter
+      \@input{\jobname.#1}%
+      \if at filesw
+        \expandafter\newwrite\csname tf@#1\endcsname
+        \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
+      \fi
+      \@nobreakfalse
+    \endgroup
+    \csname cft#1posthook\endcsname}
+  \newcommand\cfttocprehook{}
+  \newcommand\cftlofprehook{}
+  \newcommand\cftlotprehook{}
+  \newcommand\cfttocposthook{}
+  \newcommand\cftlofposthook{}
+  \newcommand\cftlotposthook{}
+\else
+  \PackageWarning{tocloft}{\string\@starttoc\space has already been redefined; tocloft bailing out.}
+\fi
 \endinput
 %%
 %% End of file `tocloft.sty'.



More information about the tex-live-commits mailing list