summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tocloft
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-08-29 21:04:44 +0000
committerKarl Berry <karl@freefriends.org>2017-08-29 21:04:44 +0000
commit2e6c7e8759a7bfd9eeb47e47f79614d924bd0e47 (patch)
tree0127c2a0dbe631388090ffebe213e788ee617f61 /Master/texmf-dist/source/latex/tocloft
parentb180f86879660a6bbae8a3778b7bc92aa650026d (diff)
tocloft (29aug17)
git-svn-id: svn://tug.org/texlive/trunk@45166 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tocloft')
-rw-r--r--Master/texmf-dist/source/latex/tocloft/tocloft.dtx130
1 files changed, 124 insertions, 6 deletions
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.