summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-07-16 21:14:47 +0000
committerKarl Berry <karl@freefriends.org>2019-07-16 21:14:47 +0000
commite60e39769f3e2422fce8df70f0475a8d77c83000 (patch)
tree45db9926ff31482f29e778c672fbacda1e7c6301
parentcf12bb505e9a4455ac9fb495f04cf7a2d079186c (diff)
tocdata (16jul19)
git-svn-id: svn://tug.org/texlive/trunk@51654 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/tocdata/tocdata.pdfbin921048 -> 919235 bytes
-rw-r--r--Master/texmf-dist/source/latex/tocdata/tocdata.dtx392
-rw-r--r--Master/texmf-dist/tex/latex/tocdata/tocdata.sty238
3 files changed, 556 insertions, 74 deletions
diff --git a/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf b/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf
index eb8cdbfe99d..4f0498a95fe 100644
--- a/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf
+++ b/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/tocdata/tocdata.dtx b/Master/texmf-dist/source/latex/tocdata/tocdata.dtx
index 2dd937112e0..cfe157698bc 100644
--- a/Master/texmf-dist/source/latex/tocdata/tocdata.dtx
+++ b/Master/texmf-dist/source/latex/tocdata/tocdata.dtx
@@ -15,7 +15,7 @@
% \iffalse
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{tocdata}
-%<package> [2019/03/21 v2.02 Adds author/artist to TOC entries.]
+%<package> [2019/07/06 v2.03 Adds author/artist to TOC entries.]
%
%<*driver>
\documentclass{ltxdoc}
@@ -31,7 +31,7 @@ of the \acro{TOC}\Slash\acro{LOF}.
% \usepackage{lmodern}
\usepackage{erewhon}
-\usepackage{roboto}
+\usepackage{cabin}
\usepackage{inconsolata}
% \usepackage{libertine}
\usepackage[T1]{fontenc}
@@ -85,7 +85,7 @@ of the \acro{TOC}\Slash\acro{LOF}.
\definecolor{codecolor}{rgb}{0,.4,.2}
\definecolor{overviewcolor}{rgb}{0,.2,.4}
-\usepackage{dtxdescribe}[2019/01/11]
+\usepackage{dtxdescribe}[2019/07/16]
\usepackage{graphicx}
\graphicspath{{images/}}
@@ -186,7 +186,7 @@ Keywords={LaTeX, tocdata, contents}%
%</driver>
% \fi
%
-% \CheckSum{373}
+% \CheckSum{662}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -216,6 +216,7 @@ Keywords={LaTeX, tocdata, contents}%
% \changes{v2.00}{2019/03/15}{\ 2019/03/15}
% \changes{v2.01}{2019/03/15}{\ 2019/03/15}
% \changes{v2.02}{2019/03/21}{\ 2019/03/21}
+% \changes{v2.03}{2019/07/06}{\ 2019/07/06}
@@ -233,6 +234,7 @@ Keywords={LaTeX, tocdata, contents}%
% ^^A \includegraphics[width=.3\linewidth]{\mypackagename_logo.pdf}
% \vfill
% {\Huge The \pkg{\mypackagename} package}
+% \bigskip
%
% \fileversion{} --- \filedate
%
@@ -255,8 +257,9 @@ Keywords={LaTeX, tocdata, contents}%
% This new information is placed on a single line along with the caption and page number,
% as is commonly done in collections of literature, poetry, or art work.
%
-% \pkg{tocdata} works with the \TOC\ \Slash \LOF\ formatting of the default \LaTeX\ classes,
-% or with the \pkg{titletoc} or \pkg{tocloft} packages.
+% \pkg{tocdata} works with the \TOC\ \Slash \LOF\ formatting of
+% the default \LaTeX\ classes, \pkg{memoir}, \pkg{koma-script},
+% and with \pkg{titletoc}, \pkg{tocloft}, \pkg{tocbasic}, and \pkg{tocstyle}.
% \end{abstract}
%
% \vspace*{\fill}
@@ -384,7 +387,7 @@ Keywords={LaTeX, tocdata, contents}%
% into the table of contents, along with hooks for the \pkg{titletoc} and \pkg{tocloft} packages.
% \item The intermediate-level macro is \cs{tocdata}, which may be used to manually
% add a piece of data to a \cs{chapter}, \cs{section}, or \cs{caption}.
-% \cs{tocdatafont} is also provided to control the appearance of this data in the \acro{TOC}\Slash\acro{LOF}.
+% \cs{tocdataformat} is also provided to control the appearance of this data in the \acro{TOC}\Slash\acro{LOF}.
% \item At the highest level is a sample implementation of user-level macros which provides
% an easy way to create chapters, sections, and figures with associated authors and artists,
% along with supplemental information for figures, and automatic index entries.
@@ -407,13 +410,6 @@ Keywords={LaTeX, tocdata, contents}%
% \usepackage{tocloft}
% \end{sourceverb}
%
-% \begin{docsidebar}
-% If using \pkg{titletoc}:
-% \watchout[\cs{dottedcontents}]
-% Note that the user should not use the \cs{dottedcontents} macro, as this
-% is not patched for use with \pkg{tocdata}. Use \cs{titlecontents} instead,
-% inserting the \cs{TD@usetocdata} macro as shown below.
-% \end{docsidebar}
%
% \subsection{Mid-level applications}
%
@@ -423,17 +419,19 @@ Keywords={LaTeX, tocdata, contents}%
%
% \subsubsection{Font control in the \acro{TOC}\Slash\acro{LOF}}
%
-% \DescribeMacro{\tocdatafont} \marg{text}
+% \DescribeMacro{\tocdataformat} \marg{text}
%
-% To control the font used for the author on the table-of-contents line,
+% To control the font and formatting used for the author on the table-of-contents line,
% the default is:
% \begin{sourceverb}
-% \newcommand{\tocdatafont}[1]{{\normalfont\textit{\small#1}}}
+% \newcommand{\tocdataformat}[1]{{\normalfont\textit{\small#1}}}
% \end{sourceverb}
%
-% You may change to other font options, such as:
+% You may change to other font options, add parenetheses, etc.:
% \begin{sourceverb}
-% \renewcommand{\tocdatafont}[1]{\normalfont\textsc{\footnotesize#1}}
+% \renewcommand{\tocdataformat}[1]{%
+% \normalfont\textsc{\footnotesize\qquad --- (#1)}%
+% }
% \end{sourceverb}
%
%
@@ -545,7 +543,6 @@ Keywords={LaTeX, tocdata, contents}%
% \watchout[redefining]
% depend on \cs{tocdatapartprint}, so if it is redefined the others will
% have to be redefined as well.
-% Make these macros robust!\watchout[robust]
%
%
% \DescribeMacro{\tocdataartistprint}
@@ -655,6 +652,7 @@ Keywords={LaTeX, tocdata, contents}%
% after \pkg{tocdata}, so that \pkg{tocdata} can patch
% the \LaTeX\ core definitions first.
% \changes{v2.00}{2019/03/12}{Test for early \pkg{titletoc} or \pkg{tocloft}.}
+% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
% \begin{macrocode}
\@ifpackageloaded{titletoc}{
\PackageError{tocdata}
@@ -665,6 +663,11 @@ Keywords={LaTeX, tocdata, contents}%
Move \protect\usepackage{titletoc} after \protect\usepackage{tocdata}.%
}
}{}
+
+\@ifclassloaded{memoir}
+{}% memoir
+{% not memoir
+
\@ifpackageloaded{tocloft}{
\PackageError{tocdata}
{%
@@ -674,6 +677,8 @@ Keywords={LaTeX, tocdata, contents}%
Move \protect\usepackage{tocloft} after \protect\usepackage{tocdata}.%
}
}{}
+
+}% not memoir
% \end{macrocode}
% Prevent the use of both \pkg{titletoc} and \pkg{tocloft}.
@@ -724,14 +729,27 @@ Keywords={LaTeX, tocdata, contents}%
% \end{macro}
%
%
-% \begin{macro}{\tocdatafont} \marg{text}
+% \begin{macro}{\tocdatafont} \marg{text} \qquad
+% Provided for compatibility with older documents.
+% Instead, use and redefine \cs{tocdataformat} for newer documents.
+% \watchout[deprecated]
%
-% Controls the font for the \acro{TOC} data.
+% \begin{macrocode}
+\newcommand{\tocdatafont}[1]{{\normalfont\textit{\small#1}}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tocdataformat} \marg{text}
%
-% |\renewcommand{\tocdatafont}[1]{\textit{#1}}|, etc.
+% Controls the font and formatting for the \acro{TOC} data:
+%
+% \begin{sourceverb}
+% \renewcommand{\tocdataformat}[1]{\textit{#1}}
+% \end{sourceverb}
%
% \begin{macrocode}
-\newcommand{\tocdatafont}[1]{{\normalfont\textit{\small#1}}}
+\def\tocdataformat{\tocdatafont}
% \end{macrocode}
% \end{macro}
%
@@ -743,19 +761,51 @@ Keywords={LaTeX, tocdata, contents}%
% See the example using \pkg{titletoc}, below.
%
% Prints the data, then clears the storage so it is not printed again.
+%
+% \changes{v2.03}{2019/06/30}{Fix: No action if empty data.}
+% \changes{v2.03}{2019/06/30}{Uses \cs{tocdataformat} instead of \cs{tocdatafont}.}
% \begin{macrocode}
\newcommand{\TD@usetocdata}{%
- \tocdatafont{\TD@thistocdata}%
- \global\def\TD@thistocdata{}%
+ \ifdefvoid{\TD@thistocdata}{}{%
+ \tocdataformat{\TD@thistocdata}%
+ \global\def\TD@thistocdata{}%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+
+
+% \begin{macro}{\TD@checktocdatafont} \marg{text}
+%
+% Used to detect whether the user redefined \cs{tocdatafont},
+% in which case a warning is issued to use \cs{tocdataformat} instead.
+% \begin{macrocode}
+\let\TD@checktocdatafont\tocdatafont
+
+\AtBeginDocument{
+\ifdefequal\TD@checktocdatafont\tocdatafont{}{
+ \PackageWarningNoLine{tocdata}{%
+ You have redefined \protect\tocdatafont,\MessageBreak
+ which has been deprecated. Please redefine\MessageBreak
+ \protect\tocdataformat\space instead}
+}
}
% \end{macrocode}
% \end{macro}
+
+
% \subsection{Standard \LaTeX\ patches}
%
% \changes{v2.00}{2019/03/12}{Adds support for default \LaTeX\ \TOC\ formattting,
% without using \pkg{titletoc} or \pkg{tocloft}.}
+% \changes{v2.03}{2019/06/30}{Fix: Don't try to patch \pkg{lwarp}.}
+%
+% \begin{macro}{\TD@patchstandardlatex} Patches standard \LaTeX\ \TOC\ formatting.
+% \begin{macrocode}
+\newcommand*{\TD@patchstandardlatex}{
+% \end{macrocode}
%
% \begin{macro}{\@dottedtocline} Patched for \pkg{tocdata}.
% \begin{macrocode}
@@ -772,7 +822,11 @@ Keywords={LaTeX, tocdata, contents}%
% \end{macro}
% \begin{macro}{\l@part} Patched for \pkg{tocdata}.
+% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
+% \changes{v2.03}{2019/07/06}{Added support for \pkg{koma-script}.}
% \begin{macrocode}
+\@ifclassloaded{memoir}{}{%
+\@ifpackageloaded{tocbasic}{}{%
\xpatchcmd{\l@part}
{\hfil}
{\hfil\TD@usetocdata}
@@ -782,14 +836,17 @@ Keywords={LaTeX, tocdata, contents}%
Could not patch LaTeX core \protect\l@part.\MessageBreak
Authors may not appear in TOC parts}
}%
+}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\l@chapter} Patched for \pkg{tocdata}.
+% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
+% \changes{v2.03}{2019/07/06}{Added support for \pkg{koma-script}.}
% \begin{macrocode}
-\@ifundefined{chapter}
-{}
-{
+\@ifclassloaded{memoir}{}{%
+\@ifpackageloaded{tocbasic}{}{%
+\@ifundefined{chapter}{}{%
\xpatchcmd{\l@chapter}
{\hfil\nobreak}
{\hfil\TD@usetocdata\nobreak}
@@ -799,13 +856,15 @@ Keywords={LaTeX, tocdata, contents}%
Could not patch LaTeX core \protect\l@chapter.\MessageBreak
Authors may not appear in TOC chapters}
}%
-}
+}}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\l@section} Patched for \pkg{tocdata}.
% \changes{v2.01}{2019/03/15}{Fix for \LaTeX\ core section \TOC\ entry.}
+% \changes{v2.03}{2019/06/30}{Fix: Only patch if \pkg{article}.}
% \begin{macrocode}
+\@ifclassloaded{article}{
\xpatchcmd{\l@section}
{\hfil\nobreak}
{\hfil\TD@usetocdata\nobreak}
@@ -815,8 +874,25 @@ Keywords={LaTeX, tocdata, contents}%
Could not patch LaTeX core \protect\l@section.\MessageBreak
Authors may not appear in TOC sections}
}%
+}{}
% \end{macrocode}
% \end{macro}
+%
+% \begin{macrocode}
+}% TD@patchstandardlatex
+% \end{macrocode}
+% \end{macro}
+%
+%
+% Patch standard \LaTeX\ if not using \pkg{lwarp}, or if
+% \pkg{lwarp} is used in print mode:
+% \begin{macrocode}
+\@ifpackageloaded{lwarp}{%
+ \ifbool{warpingprint}{\TD@patchstandardlatex}{}%
+}{%
+ \TD@patchstandardlatex%
+}
+% \end{macrocode}
% \subsection{\pkg{titletoc} support}
@@ -829,6 +905,7 @@ Keywords={LaTeX, tocdata, contents}%
% \captionartist{Pi\label{fig:workofart}}{Greek}{Alphabet}
% \end{figure}
%
+% \changes{v2.03}{2019/07/04}{Tested to work with \cs{dottedcontents}.}
%
% If \pkg{titletoc} is loaded, patch macros for its use:
% \changes{v2.00}{2019/03/13}{Patches \cs{AtBeginDocument}.}
@@ -847,11 +924,6 @@ Keywords={LaTeX, tocdata, contents}%
% These macros also include spacing commands, and thus may need to be
% redefined by the user.
%
-% Note that the user should not use the \cs{dottedcontents} macro, as this
-% is not patched for use with \pkg{tocdata}. Use \cs{titlecontents} instead,
-% \watchout[\cs{dottedcontents}]
-% inserting the \cs{TD@usetocdata} macro as shown below.
-%
% The default macros are patched via the \LaTeX\ core.
% The following are only necessary if \cs{titlecontents} was used.
% Since every combination is tried, but will only succeed if \cs{titlecontents}
@@ -889,12 +961,29 @@ Keywords={LaTeX, tocdata, contents}%
% \end{macrocode}
-% \subsection{\pkg{tocloft} support}
+% \subsection{\pkg{tocloft} and \pkg{memoir} support}
%
-% If \pkg{tocloft} is loaded, the following patches are applied:
+% If \pkg{tocloft} is loaded, the following patches are applied.
+% \pkg{memoir} emulates \pkg{tocloft}, so it is patched here as well.
% \changes{v2.00}{2019/03/13}{Patches \cs{AtBeginDocument}.}
+% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
% \begin{macrocode}
\AtBeginDocument{
+\@ifclassloaded{memoir}
+{
+\appto{\cftpartleader}{\TD@usetocdata}
+\appto{\cftchapterleader}{\TD@usetocdata}
+\appto{\cftsectionleader}{\TD@usetocdata}
+\appto{\cftsubsectionleader}{\TD@usetocdata}
+\appto{\cftsubsubsectionleader}{\TD@usetocdata}
+\appto{\cftparagraphleader}{\TD@usetocdata}
+\appto{\cftsubparagraphleader}{\TD@usetocdata}
+\appto{\cftfigureleader}{\TD@usetocdata}
+\appto{\cfttableleader}{\TD@usetocdata}
+\appto{\cftsubfigureleader}{\TD@usetocdata}
+\appto{\cftsubtableleader}{\TD@usetocdata}
+}% memoir
+{% not memoir
\@ifpackageloaded{tocloft}
{
% \end{macrocode}
@@ -923,11 +1012,159 @@ Keywords={LaTeX, tocdata, contents}%
% \begin{macrocode}
}% end of tocloft patches
{}% tocloft not loaded
+}% not memoir
}% \AtBeginDocument
% \end{macrocode}
%
%
%
+% \subsection{Koma-script \pkg{tocbasic} support}
+%
+% \changes{v2.03}{2019/07/06}{Added support for \pkg{tocbasic}.}
+%
+% There is no easy way to patch this\dots
+% \cs{TD@usetocdata} is inserted near the end of the following:
+%
+% \begin{macrocode}
+\AtBeginDocument{
+
+\@ifpackageloaded{tocbasic}{
+\renewcommand*{\scr@dte@tocline}[3]{%
+ \ifnum \@nameuse{#1tocdepth}>\c@tocdepth
+ \else
+ \tocbasic@DependOnPenaltyAndTOCLevel{#1}%
+ \addvspace{\@nameuse{scr@tso@#1@beforeskip}}\relax
+ {%
+ \leftskip \@nameuse{scr@tso@#1@indent}\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \@nameuse{Ifscr@tso@#1@raggedpage}{%
+ \addtolength{\parfillskip}{\z@ \@plus 1fil}%
+ }{}%
+ \parindent \@nameuse{scr@tso@#1@indent}\relax
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \expandafter\ifx\csname ragged#1entry\endcsname\raggedright
+ \addtolength\rightskip\@flushglue
+ \else
+ \def\reserved@a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
+ \addtolength\rightskip\@flushglue
+ \else
+ \renewcommand\reserved@a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
+ \addtolength\rightskip\@flushglue
+ \fi
+ \fi
+ \fi
+ \leavevmode
+ \@tempdima \@nameuse{scr@tso@#1@numwidth}\relax
+ \@nameuse{Ifscr@tso@#1@dynnumwidth}{%
+ \scr@ifundefinedorrelax{scr@dte@#1@lastmaxnumwidth}{}{%
+ \ifdim \@nameuse{scr@dte@#1@lastmaxnumwidth}>\@tempdima
+ \@tempdima\@nameuse{scr@dte@#1@lastmaxnumwidth}\relax
+ \fi
+ }%
+ }{}%
+ \advance\leftskip \@tempdima
+ \null\nobreak\hskip -\leftskip
+ {%
+ \usetocbasicnumberline
+ \let\scr@dte@numberline@box\numberline@box
+ \def\numberline@box##1{%
+ \sbox\scr@dte@tocline@numbox{\@nameuse{scr@tso@#1@numberformat}{##1}}%
+ \global\scr@dte@tocline@numberwidth
+ \dimexpr\wd\scr@dte@tocline@numbox+\@nameuse{scr@tso@#1@numsep}\relax
+ \relax
+ \ifdim \scr@dte@tocline@numberwidth
+ >\@nameuse{scr@dte@#1@maxnumwidth}\relax
+ \global\@nameuse{scr@dte@#1@maxnumwidth}\scr@dte@tocline@numberwidth
+ \fi
+ \@nameuse{Ifscr@tso@#1@dynnumwidth}{}{%
+ \ifdim \scr@dte@tocline@numberwidth
+ >\dimexpr \@nameuse{scr@tso@#1@numwidth}%
+ +\@nameuse{scr@tso@#1@numsep}\relax\relax
+ \PackageWarning{tocbasic%
+ }{%
+ number width of #1 toc entries should be
+ increased!\MessageBreak
+ Currently used number width =
+ \the\wd\scr@dte@tocline@numbox,\MessageBreak
+ Wanted number separation
+ \space\space\space =
+ \the\dimexpr\@nameuse{scr@tso@#1@numsep}\relax,\MessageBreak
+ Reserved number width \space\space\space\space\space\space =
+ \the\dimexpr\@nameuse{scr@tso@#1@numwidth}\relax%
+ }%
+ \fi
+ }%
+ \scr@dte@numberline@box{\@nameuse{scr@tso@#1@numberformat}{##1}}%
+ \@nameuse{Ifscr@tso@#1@breakafternumber}{%
+ {\parfillskip\@flushglue\par}\nobreak\hskip-\leftskip
+ }{}%
+ }%
+ \@nameuse{scr@tso@#1@entryformat}{%
+ #2%
+ \nobreak
+ {%
+ \normalfont\normalsize\@nameuse{scr@tso@#1@linefill}%
+ \TD@usetocdata% lwarp
+ \nobreak
+ \@nameuse{scr@tso@#1@pagenumberbox}{%
+ \@nameuse{scr@tso@#1@pagenumberformat}{#3}%
+ }%
+ }%
+ \@par
+ }%
+ }%
+ }%
+ \tocbasic@SetPenaltyByTOCLevel{#1}%
+ \fi
+}
+
+}{}
+}
+% \end{macrocode}
+%
+%
+% \subsection{\pkg{tocstyle} support}
+%
+% \changes{v2.03}{2019/07/06}{Added support for \pkg{tocstyle}.}
+%
+% \begin{macrocode}
+\AtBeginDocument{
+\@ifpackageloaded{tocstyle}{
+\xpatchcmd\tocstyle@dottedtocline
+ {%
+ \ifx\tocstyle@feature@leaders\relax
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle@feature@leaders
+ \fi%
+ }
+ {%
+ \ifx\tocstyle@feature@leaders\relax
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle@feature@leaders
+ \fi%
+ \TD@usetocdata%
+ }
+ {}%
+ {%
+ \PackageWarningNoLine{tocdata}{%
+ Could not patch tocstyle \protect\tocstyle@dottedtocline.\MessageBreak
+ Authors may not appear in TOC, LOF}
+ }%
+}{}
+}
+% \end{macrocode}
+%
+%
%
% \clearpage
%
@@ -958,12 +1195,13 @@ Keywords={LaTeX, tocdata, contents}%
% \subsubsection{User customization}
%
%
-% \begin{macro}{\TD@optionalname} \marg{name}
+% \begin{macro}{\TDoptionalnameprint} \marg{name}
%
% Adds optional artist's name and the following space.
%
+% \changes{v2.03}{2019/07/04}{Name changed from \cs{TD@optionalnameprint}.}
% \begin{macrocode}
-\newcommand{\TD@optionalname}[1]
+\newcommand{\TDoptionalnameprint}[1]
{%
\ifblank{#1}%
{}%
@@ -979,20 +1217,19 @@ Keywords={LaTeX, tocdata, contents}%
%
% User-redefinable macro to print the author's name underneath the part title.
%
-% Make these macros robust.\watchout
-%
% \changes{v0.12}{2016/11/29}{Improved spacing.}
% \changes{v2.00}{2019/03/15}{Added.}
+% \changes{v2.03}{2019/07/04}{Removed \cs{unskip}.}
%
% \begin{macrocode}
-\newrobustcmd{\tocdatapartprint}[4]
+\newcommand{\tocdatapartprint}[4]
{%
- \par\unskip\noindent%
+ \par\noindent%
{%
\normalfont\normalsize%
\textit{%
\hspace*{4em}--- %
- \TD@optionalname{#1}\TD@optionalname{#2}#3#4%
+ \TDoptionalnameprint{#1}\TDoptionalnameprint{#2}#3#4%
}%
}%
}
@@ -1039,17 +1276,18 @@ Keywords={LaTeX, tocdata, contents}%
% \end{macro}
%
%
-% \begin{macro}{\TD@artistauthorprint} \marg{1: "artist" or "author"}
+% \begin{macro}{\TDartistauthorprint} \marg{1: "artist" or "author"}
% \marg{2: prefix} \marg{3: first} \marg{4: last} \marg{5: suffix}
%
% \changes{v2.00}{2019/03/15}{Improved font control.}
+% \changes{v2.03}{2019/07/04}{Name changed from \cs{TD@artistauthorprint}.}
%
% \begin{macrocode}
-\newcommand{\TD@artistauthorprint}[5]{%
+\newcommand{\TDartistauthorprint}[5]{%
\begin{minipage}{\linewidth}%
\csuse{TD@#1align}%
\footnotesize\normalfont%
- \textsc{{\TD@optionalname{#2}\TD@optionalname{#3}#4#5}}%
+ \textsc{{\TDoptionalnameprint{#2}\TDoptionalnameprint{#3}#4#5}}%
\end{minipage}%
\par%
\addvspace{2ex}%
@@ -1070,7 +1308,7 @@ Keywords={LaTeX, tocdata, contents}%
% \begin{macrocode}
\newcommand{\tocdataartistprint}{%
\par\smallskip%
- \TD@artistauthorprint{artist}%
+ \TDartistauthorprint{artist}%
}
% \end{macrocode}
% To remove the artist's name, redefine this as a null function taking four arguments:
@@ -1090,22 +1328,23 @@ Keywords={LaTeX, tocdata, contents}%
% \begin{macrocode}
\newcommand{\tocdataauthorprint}{%
\par\smallskip%
- \TD@artistauthorprint{author}%
+ \TDartistauthorprint{author}%
}
% \end{macrocode}
% \end{macro}
%
%
%
-% \begin{macro}{\TD@artistauthortextprint}
+% \begin{macro}{\TDartistauthortextprint}
% \marg{"artist" or "author"} \marg{text}
% \changes{v0.12}{2016/11/29}{Improved spacing.}
% \changes{v0.12}{2016/11/29}{Added text alignment.}
% \changes{v2.00}{2019/03/15}{Improved font control.}
% \changes{v2.00}{2019/03/14}{Replaced \cs{tocdatafigtextprint} with
% \cs{tocdataartisttextprint} and \cs{tocdataauthortextprint}.}
+% \changes{v2.03}{2019/07/04}{Name changed from \cs{TD@artistauthortextprint}.}
% \begin{macrocode}
-\newcommand{\TD@artistauthortextprint}[2]{%
+\newcommand{\TDartistauthortextprint}[2]{%
\addvspace{2ex}%
\begin{minipage}{\linewidth}%
\csuse{TD@#1textalign}%
@@ -1127,7 +1366,7 @@ Keywords={LaTeX, tocdata, contents}%
%
%
% \begin{macrocode}
-\newcommand{\tocdataartisttextprint}{\TD@artistauthortextprint{artist}}
+\newcommand{\tocdataartisttextprint}{\TDartistauthortextprint{artist}}
% \end{macrocode}
% \end{macro}
%
@@ -1136,7 +1375,7 @@ Keywords={LaTeX, tocdata, contents}%
% User-redefinable macro to print the optional text below the author's name.
%
% \begin{macrocode}
-\newcommand{\tocdataauthortextprint}{\TD@artistauthortextprint{author}}
+\newcommand{\tocdataauthortextprint}{\TDartistauthortextprint{author}}
% \end{macrocode}
% \end{macro}
%
@@ -1144,6 +1383,47 @@ Keywords={LaTeX, tocdata, contents}%
%
% \subsubsection{Chapters and sections}
%
+%
+% With \pkg{book} or \pkg{report} classes,
+% a starred \cs{part}'s name is printed on its own page,
+% \watchout[\cs{part*}]
+% making it difficult to add an author's name. If the author's name
+% is appended to the part's name, it also appears in name references as well.
+% Thus, if using one of these classes and a starred \cs{part}, the author's name is not
+% printed.
+% Using an unstarred \cs{part} with an author's name does work as expected.
+% The author's name is printed as part of the long name,
+% but does not appear in the name reference, which uses the short name.
+%
+% \begin{macro}{\TD@starredsectionauthorprint} \marg{author's name}
+% \changes{v2.03}{2019/07/04}{No author for \cs{part*} in \pkg{book} class.}
+% \begin{macrocode}
+\@ifclassloaded{article}
+{
+ \newcommand*{\TD@starredsectionauthorprint}[5]{%
+ \unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
+ \bigskip%
+ }
+}
+{
+ \newcommand*{\TD@starredsectionauthorprint}[5]{%
+ \ifstrequal{#1}{part}%
+ {%
+ \PackageWarning{tocdata}{%
+ The author's name will not be printed for\MessageBreak
+ the starred \protect\part%
+ }
+ }%
+ {%
+ \unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
+ \bigskip%
+ }%
+ }
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\TD@sectionauthor}
% \marg{1: section type}
% *
@@ -1153,7 +1433,8 @@ Keywords={LaTeX, tocdata, contents}%
% \changes{v0.12}{2016/11/28}{Expands first name before index check.}
% \changes{v2.00}{2019/03/15}{Improved page breaks.}
% \changes{v2.00}{2019/03/15}{Factored.}
-% \changes{v2.02}{2019/03/21}{Fix for sectioning name formatting.}
+% \changes{v2.02}{2019/03/21}{Fix: Sectioning name formatting.}
+% \changes{v2.03}{2019/06/30}{Fix: Starred sectioning name formatting and labels.}
% \begin{macrocode}
\NewDocumentCommand{\TD@sectionauthor}{m s o m O{} m m O{}}{%
% \end{macrocode}
@@ -1162,7 +1443,8 @@ Keywords={LaTeX, tocdata, contents}%
% \begin{macrocode}
\IfBooleanTF{#2}%
{% star:
- \csuse{#1}*{#4\nopagebreak\csuse{tocdata#1print}{#5}{#6}{#7}{#8}}%
+ \csuse{#1}*{#4}%
+ \TD@starredsectionauthorprint{#1}{#5}{#6}{#7}{#8}%
}%
% \end{macrocode}
% The un-starred version appears in the \acro{TOC}, so add the author's name:
diff --git a/Master/texmf-dist/tex/latex/tocdata/tocdata.sty b/Master/texmf-dist/tex/latex/tocdata/tocdata.sty
index 13314164446..ae4dfa715bf 100644
--- a/Master/texmf-dist/tex/latex/tocdata/tocdata.sty
+++ b/Master/texmf-dist/tex/latex/tocdata/tocdata.sty
@@ -17,7 +17,7 @@
%% version 2005/12/01 or later.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{tocdata}
- [2019/03/21 v2.02 Adds author/artist to TOC entries.]
+ [2019/07/06 v2.03 Adds author/artist to TOC entries.]
\RequirePackage{xparse}
@@ -33,6 +33,11 @@
Move \protect\usepackage{titletoc} after \protect\usepackage{tocdata}.%
}
}{}
+
+\@ifclassloaded{memoir}
+{}% memoir
+{% not memoir
+
\@ifpackageloaded{tocloft}{
\PackageError{tocdata}
{%
@@ -43,6 +48,8 @@
}
}{}
+}% not memoir
+
\AtBeginDocument{
\@ifpackageloaded{titletoc}{
\@ifpackageloaded{tocloft}{
@@ -67,11 +74,26 @@
\@bsphack\addtocontents{#1}{\protect\settocdata{#2}}\@esphack%
}
\newcommand{\tocdatafont}[1]{{\normalfont\textit{\small#1}}}
+\def\tocdataformat{\tocdatafont}
\newcommand{\TD@usetocdata}{%
- \tocdatafont{\TD@thistocdata}%
- \global\def\TD@thistocdata{}%
+ \ifdefvoid{\TD@thistocdata}{}{%
+ \tocdataformat{\TD@thistocdata}%
+ \global\def\TD@thistocdata{}%
+ }%
+}
+
+\let\TD@checktocdatafont\tocdatafont
+
+\AtBeginDocument{
+\ifdefequal\TD@checktocdatafont\tocdatafont{}{
+ \PackageWarningNoLine{tocdata}{%
+ You have redefined \protect\tocdatafont,\MessageBreak
+ which has been deprecated. Please redefine\MessageBreak
+ \protect\tocdataformat\space instead}
+}
}
+\newcommand*{\TD@patchstandardlatex}{
\xpatchcmd{\@dottedtocline}
{\hfill\nobreak}
{\hfill\TD@usetocdata\nobreak}
@@ -82,6 +104,8 @@
Authors may not appear in TOC, LOF}
}%
+\@ifclassloaded{memoir}{}{%
+\@ifpackageloaded{tocbasic}{}{%
\xpatchcmd{\l@part}
{\hfil}
{\hfil\TD@usetocdata}
@@ -91,10 +115,11 @@
Could not patch LaTeX core \protect\l@part.\MessageBreak
Authors may not appear in TOC parts}
}%
+}}
-\@ifundefined{chapter}
-{}
-{
+\@ifclassloaded{memoir}{}{%
+\@ifpackageloaded{tocbasic}{}{%
+\@ifundefined{chapter}{}{%
\xpatchcmd{\l@chapter}
{\hfil\nobreak}
{\hfil\TD@usetocdata\nobreak}
@@ -104,8 +129,9 @@
Could not patch LaTeX core \protect\l@chapter.\MessageBreak
Authors may not appear in TOC chapters}
}%
-}
+}}}
+\@ifclassloaded{article}{
\xpatchcmd{\l@section}
{\hfil\nobreak}
{\hfil\TD@usetocdata\nobreak}
@@ -115,6 +141,13 @@
Could not patch LaTeX core \protect\l@section.\MessageBreak
Authors may not appear in TOC sections}
}%
+}{}
+}% TD@patchstandardlatex
+\@ifpackageloaded{lwarp}{%
+ \ifbool{warpingprint}{\TD@patchstandardlatex}{}%
+}{%
+ \TD@patchstandardlatex%
+}
\AtBeginDocument{
\@ifpackageloaded{titletoc}{
@@ -147,6 +180,21 @@
}% end of \AtBeginDocument
\AtBeginDocument{
+\@ifclassloaded{memoir}
+{
+\appto{\cftpartleader}{\TD@usetocdata}
+\appto{\cftchapterleader}{\TD@usetocdata}
+\appto{\cftsectionleader}{\TD@usetocdata}
+\appto{\cftsubsectionleader}{\TD@usetocdata}
+\appto{\cftsubsubsectionleader}{\TD@usetocdata}
+\appto{\cftparagraphleader}{\TD@usetocdata}
+\appto{\cftsubparagraphleader}{\TD@usetocdata}
+\appto{\cftfigureleader}{\TD@usetocdata}
+\appto{\cfttableleader}{\TD@usetocdata}
+\appto{\cftsubfigureleader}{\TD@usetocdata}
+\appto{\cftsubtableleader}{\TD@usetocdata}
+}% memoir
+{% not memoir
\@ifpackageloaded{tocloft}
{
\appto{\cftpartleader}{\TD@usetocdata}
@@ -165,21 +213,150 @@
}% end of tocloft patches
{}% tocloft not loaded
+}% not memoir
}% \AtBeginDocument
-\newcommand{\TD@optionalname}[1]
+\AtBeginDocument{
+
+\@ifpackageloaded{tocbasic}{
+\renewcommand*{\scr@dte@tocline}[3]{%
+ \ifnum \@nameuse{#1tocdepth}>\c@tocdepth
+ \else
+ \tocbasic@DependOnPenaltyAndTOCLevel{#1}%
+ \addvspace{\@nameuse{scr@tso@#1@beforeskip}}\relax
+ {%
+ \leftskip \@nameuse{scr@tso@#1@indent}\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \@nameuse{Ifscr@tso@#1@raggedpage}{%
+ \addtolength{\parfillskip}{\z@ \@plus 1fil}%
+ }{}%
+ \parindent \@nameuse{scr@tso@#1@indent}\relax
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \expandafter\ifx\csname ragged#1entry\endcsname\raggedright
+ \addtolength\rightskip\@flushglue
+ \else
+ \def\reserved@a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
+ \addtolength\rightskip\@flushglue
+ \else
+ \renewcommand\reserved@a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved@a
+ \addtolength\rightskip\@flushglue
+ \fi
+ \fi
+ \fi
+ \leavevmode
+ \@tempdima \@nameuse{scr@tso@#1@numwidth}\relax
+ \@nameuse{Ifscr@tso@#1@dynnumwidth}{%
+ \scr@ifundefinedorrelax{scr@dte@#1@lastmaxnumwidth}{}{%
+ \ifdim \@nameuse{scr@dte@#1@lastmaxnumwidth}>\@tempdima
+ \@tempdima\@nameuse{scr@dte@#1@lastmaxnumwidth}\relax
+ \fi
+ }%
+ }{}%
+ \advance\leftskip \@tempdima
+ \null\nobreak\hskip -\leftskip
+ {%
+ \usetocbasicnumberline
+ \let\scr@dte@numberline@box\numberline@box
+ \def\numberline@box##1{%
+ \sbox\scr@dte@tocline@numbox{\@nameuse{scr@tso@#1@numberformat}{##1}}%
+ \global\scr@dte@tocline@numberwidth
+ \dimexpr\wd\scr@dte@tocline@numbox+\@nameuse{scr@tso@#1@numsep}\relax
+ \relax
+ \ifdim \scr@dte@tocline@numberwidth
+ >\@nameuse{scr@dte@#1@maxnumwidth}\relax
+ \global\@nameuse{scr@dte@#1@maxnumwidth}\scr@dte@tocline@numberwidth
+ \fi
+ \@nameuse{Ifscr@tso@#1@dynnumwidth}{}{%
+ \ifdim \scr@dte@tocline@numberwidth
+ >\dimexpr \@nameuse{scr@tso@#1@numwidth}%
+ +\@nameuse{scr@tso@#1@numsep}\relax\relax
+ \PackageWarning{tocbasic%
+ }{%
+ number width of #1 toc entries should be
+ increased!\MessageBreak
+ Currently used number width =
+ \the\wd\scr@dte@tocline@numbox,\MessageBreak
+ Wanted number separation
+ \space\space\space =
+ \the\dimexpr\@nameuse{scr@tso@#1@numsep}\relax,\MessageBreak
+ Reserved number width \space\space\space\space\space\space =
+ \the\dimexpr\@nameuse{scr@tso@#1@numwidth}\relax%
+ }%
+ \fi
+ }%
+ \scr@dte@numberline@box{\@nameuse{scr@tso@#1@numberformat}{##1}}%
+ \@nameuse{Ifscr@tso@#1@breakafternumber}{%
+ {\parfillskip\@flushglue\par}\nobreak\hskip-\leftskip
+ }{}%
+ }%
+ \@nameuse{scr@tso@#1@entryformat}{%
+ #2%
+ \nobreak
+ {%
+ \normalfont\normalsize\@nameuse{scr@tso@#1@linefill}%
+ \TD@usetocdata% lwarp
+ \nobreak
+ \@nameuse{scr@tso@#1@pagenumberbox}{%
+ \@nameuse{scr@tso@#1@pagenumberformat}{#3}%
+ }%
+ }%
+ \@par
+ }%
+ }%
+ }%
+ \tocbasic@SetPenaltyByTOCLevel{#1}%
+ \fi
+}
+
+}{}
+}
+\AtBeginDocument{
+\@ifpackageloaded{tocstyle}{
+\xpatchcmd\tocstyle@dottedtocline
+ {%
+ \ifx\tocstyle@feature@leaders\relax
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle@feature@leaders
+ \fi%
+ }
+ {%
+ \ifx\tocstyle@feature@leaders\relax
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle@feature@leaders
+ \fi%
+ \TD@usetocdata%
+ }
+ {}%
+ {%
+ \PackageWarningNoLine{tocdata}{%
+ Could not patch tocstyle \protect\tocstyle@dottedtocline.\MessageBreak
+ Authors may not appear in TOC, LOF}
+ }%
+}{}
+}
+\newcommand{\TDoptionalnameprint}[1]
{%
\ifblank{#1}%
{}%
{#1~}%
}
-\newrobustcmd{\tocdatapartprint}[4]
+\newcommand{\tocdatapartprint}[4]
{%
- \par\unskip\noindent%
+ \par\noindent%
{%
\normalfont\normalsize%
\textit{%
\hspace*{4em}--- %
- \TD@optionalname{#1}\TD@optionalname{#2}#3#4%
+ \TDoptionalnameprint{#1}\TDoptionalnameprint{#2}#3#4%
}%
}%
}
@@ -190,24 +367,24 @@
}% end of chapters-only
\let\tocdatasectionprint\tocdatapartprint
\let\tocdatasubsectionprint\tocdatapartprint
-\newcommand{\TD@artistauthorprint}[5]{%
+\newcommand{\TDartistauthorprint}[5]{%
\begin{minipage}{\linewidth}%
\csuse{TD@#1align}%
\footnotesize\normalfont%
- \textsc{{\TD@optionalname{#2}\TD@optionalname{#3}#4#5}}%
+ \textsc{{\TDoptionalnameprint{#2}\TDoptionalnameprint{#3}#4#5}}%
\end{minipage}%
\par%
\addvspace{2ex}%
}
\newcommand{\tocdataartistprint}{%
\par\smallskip%
- \TD@artistauthorprint{artist}%
+ \TDartistauthorprint{artist}%
}
\newcommand{\tocdataauthorprint}{%
\par\smallskip%
- \TD@artistauthorprint{author}%
+ \TDartistauthorprint{author}%
}
-\newcommand{\TD@artistauthortextprint}[2]{%
+\newcommand{\TDartistauthortextprint}[2]{%
\addvspace{2ex}%
\begin{minipage}{\linewidth}%
\csuse{TD@#1textalign}%
@@ -219,12 +396,35 @@
\par%
\addvspace{2ex}%
}
-\newcommand{\tocdataartisttextprint}{\TD@artistauthortextprint{artist}}
-\newcommand{\tocdataauthortextprint}{\TD@artistauthortextprint{author}}
+\newcommand{\tocdataartisttextprint}{\TDartistauthortextprint{artist}}
+\newcommand{\tocdataauthortextprint}{\TDartistauthortextprint{author}}
+\@ifclassloaded{article}
+{
+ \newcommand*{\TD@starredsectionauthorprint}[5]{%
+ \unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
+ \bigskip%
+ }
+}
+{
+ \newcommand*{\TD@starredsectionauthorprint}[5]{%
+ \ifstrequal{#1}{part}%
+ {%
+ \PackageWarning{tocdata}{%
+ The author's name will not be printed for\MessageBreak
+ the starred \protect\part%
+ }
+ }%
+ {%
+ \unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
+ \bigskip%
+ }%
+ }
+}
\NewDocumentCommand{\TD@sectionauthor}{m s o m O{} m m O{}}{%
\IfBooleanTF{#2}%
{% star:
- \csuse{#1}*{#4\nopagebreak\csuse{tocdata#1print}{#5}{#6}{#7}{#8}}%
+ \csuse{#1}*{#4}%
+ \TD@starredsectionauthorprint{#1}{#5}{#6}{#7}{#8}%
}%
{% no star:
\tocdata{toc}{#6 #7}%