From 2e6c7e8759a7bfd9eeb47e47f79614d924bd0e47 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 29 Aug 2017 21:04:44 +0000 Subject: tocloft (29aug17) git-svn-id: svn://tug.org/texlive/trunk@45166 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/tocloft/README | 7 ++ Master/texmf-dist/doc/latex/tocloft/tocloft.pdf | Bin 449529 -> 424251 bytes Master/texmf-dist/source/latex/tocloft/tocloft.dtx | 130 ++++++++++++++++++++- Master/texmf-dist/tex/latex/tocloft/tocloft.sty | 48 +++++++- 4 files changed, 175 insertions(+), 10 deletions(-) diff --git a/Master/texmf-dist/doc/latex/tocloft/README b/Master/texmf-dist/doc/latex/tocloft/README index a50cabd8796..8039160e22d 100644 --- a/Master/texmf-dist/doc/latex/tocloft/README +++ b/Master/texmf-dist/doc/latex/tocloft/README @@ -8,6 +8,13 @@ define your own kinds of `List of ...' _______________ 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 diff --git a/Master/texmf-dist/doc/latex/tocloft/tocloft.pdf b/Master/texmf-dist/doc/latex/tocloft/tocloft.pdf index 4096e801c65..a7db551d88b 100644 Binary files a/Master/texmf-dist/doc/latex/tocloft/tocloft.pdf and b/Master/texmf-dist/doc/latex/tocloft/tocloft.pdf differ diff --git a/Master/texmf-dist/source/latex/tocloft/tocloft.dtx b/Master/texmf-dist/source/latex/tocloft/tocloft.dtx index c27a028c25a..6f890b26791 100644 --- a/Master/texmf-dist/source/latex/tocloft/tocloft.dtx +++ b/Master/texmf-dist/source/latex/tocloft/tocloft.dtx @@ -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@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 @@ Consider installing the current version of tocbibind.}} % \begin{macrocode} \newif\if@cftdopart \newif\if@cfthaspart -\@ifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue} +\@cftifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue} \if@cfthaspart \renewcommand*{\l@part}[2]{% \@cftdopartfalse @@ -3168,6 +3208,7 @@ Consider installing the current version of tocbibind.}} \newlistentry[#1]{#2}{#3}{0} \fi % \end{macrocode} +% \end{macro} % % \begin{macro}{\ext@Z} % \begin{macro}{\Zdepth} @@ -3291,6 +3332,15 @@ Consider installing the current version of tocbibind.}} % \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,6 +3676,74 @@ Consider installing the current version of tocbibind.}} % \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@latex@orig#1{% + \begingroup + \makeatletter + \@input{\jobname.#1}% + \if@filesw + \expandafter\newwrite\csname tf@#1\endcsname + \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax + \fi + \@nobreakfalse +\endgroup} +\ifx\@starttoc\@starttoc@latex@orig + \def\@starttoc#1{% + \csname cft#1prehook\endcsname + \begingroup + \makeatletter + \@input{\jobname.#1}% + \if@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. diff --git a/Master/texmf-dist/tex/latex/tocloft/tocloft.sty b/Master/texmf-dist/tex/latex/tocloft/tocloft.sty index 907d17a728c..133efc420bc 100644 --- a/Master/texmf-dist/tex/latex/tocloft/tocloft.sty +++ b/Master/texmf-dist/tex/latex/tocloft/tocloft.sty @@ -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@cfthaschapter \newif\if@cftkoma @@ -33,9 +39,9 @@ \@ifclassloaded{scrbook}{\@cftkomatrue}{} \newif\if@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 @@ Consider installing the current version of tocbibind.}} \newcommand{\@cftasnumb}{} \newif\if@cftdopart \newif\if@cfthaspart -\@ifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue} +\@cftifundefined{part}{\@cfthaspartfalse}{\@cfthasparttrue} \if@cfthaspart \renewcommand*{\l@part}[2]{% \@cftdopartfalse @@ -943,6 +949,8 @@ Consider installing the current version of tocbibind.}} \fi \fi \@namedef{cftafter#3title}{} + \@namedef{cft#3prehook}{} + \@namedef{cft#3posthook}{} } \newcommand{\cftsetindents}[3]{% \def\@cftemp{#1} @@ -1105,6 +1113,38 @@ Consider installing the current version of tocbibind.}} }{} } +\def\@starttoc@latex@orig#1{% + \begingroup + \makeatletter + \@input{\jobname.#1}% + \if@filesw + \expandafter\newwrite\csname tf@#1\endcsname + \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax + \fi + \@nobreakfalse +\endgroup} +\ifx\@starttoc\@starttoc@latex@orig + \def\@starttoc#1{% + \csname cft#1prehook\endcsname + \begingroup + \makeatletter + \@input{\jobname.#1}% + \if@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'. -- cgit v1.2.3