texlive[51654] Master/texmf-dist: tocdata (16jul19)
commits+karl at tug.org
commits+karl at tug.org
Tue Jul 16 23:14:47 CEST 2019
Revision: 51654
http://tug.org/svn/texlive?view=revision&revision=51654
Author: karl
Date: 2019-07-16 23:14:47 +0200 (Tue, 16 Jul 2019)
Log Message:
-----------
tocdata (16jul19)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf
trunk/Master/texmf-dist/source/latex/tocdata/tocdata.dtx
trunk/Master/texmf-dist/tex/latex/tocdata/tocdata.sty
Modified: trunk/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/source/latex/tocdata/tocdata.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/tocdata/tocdata.dtx 2019-07-16 21:14:36 UTC (rev 51653)
+++ trunk/Master/texmf-dist/source/latex/tocdata/tocdata.dtx 2019-07-16 21:14:47 UTC (rev 51654)
@@ -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 @@
% \usepackage{lmodern}
\usepackage{erewhon}
-\usepackage{roboto}
+\usepackage{cabin}
\usepackage{inconsolata}
% \usepackage{libertine}
\usepackage[T1]{fontenc}
@@ -85,7 +85,7 @@
\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 @@
%</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 @@
% \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 @@
% ^^A \includegraphics[width=.3\linewidth]{\mypackagename_logo.pdf}
% \vfill
% {\Huge The \pkg{\mypackagename} package}
+% \bigskip
%
% \fileversion{} --- \filedate
%
@@ -255,8 +257,9 @@
% 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 @@
% 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 @@
% \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 at usetocdata} macro as shown below.
-% \end{docsidebar}
%
% \subsection{Mid-level applications}
%
@@ -423,17 +419,19 @@
%
% \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 @@
% \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 @@
% 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 @@
Move \protect\usepackage{titletoc} after \protect\usepackage{tocdata}.%
}
}{}
+
+\@ifclassloaded{memoir}
+{}% memoir
+{% not memoir
+
\@ifpackageloaded{tocloft}{
\PackageError{tocdata}
{%
@@ -674,6 +677,8 @@
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 @@
% \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}
%
-% |\renewcommand{\tocdatafont}[1]{\textit{#1}}|, etc.
%
+% \begin{macro}{\tocdataformat} \marg{text}
+%
+% 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,20 +761,52 @@
% 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 at usetocdata}{%
- \tocdatafont{\TD at thistocdata}%
- \global\def\TD at thistocdata{}%
+ \ifdefvoid{\TD at thistocdata}{}{%
+ \tocdataformat{\TD at thistocdata}%
+ \global\def\TD at thistocdata{}%
+ }%
}
% \end{macrocode}
% \end{macro}
+% \begin{macro}{\TD at 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 at checktocdatafont\tocdatafont
+
+\AtBeginDocument{
+\ifdefequal\TD at 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 at patchstandardlatex} Patches standard \LaTeX\ \TOC\ formatting.
+% \begin{macrocode}
+\newcommand*{\TD at patchstandardlatex}{
+% \end{macrocode}
+%
% \begin{macro}{\@dottedtocline} Patched for \pkg{tocdata}.
% \begin{macrocode}
\xpatchcmd{\@dottedtocline}
@@ -772,7 +822,11 @@
% \end{macro}
% \begin{macro}{\l at 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 at part}
{\hfil}
{\hfil\TD at usetocdata}
@@ -782,14 +836,17 @@
Could not patch LaTeX core \protect\l at part.\MessageBreak
Authors may not appear in TOC parts}
}%
+}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\l at 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 at chapter}
{\hfil\nobreak}
{\hfil\TD at usetocdata\nobreak}
@@ -799,13 +856,15 @@
Could not patch LaTeX core \protect\l at chapter.\MessageBreak
Authors may not appear in TOC chapters}
}%
-}
+}}}
% \end{macrocode}
% \end{macro}
% \begin{macro}{\l at 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 at section}
{\hfil\nobreak}
{\hfil\TD at usetocdata\nobreak}
@@ -815,8 +874,25 @@
Could not patch LaTeX core \protect\l at section.\MessageBreak
Authors may not appear in TOC sections}
}%
+}{}
% \end{macrocode}
% \end{macro}
+%
+% \begin{macrocode}
+}% TD at 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 at patchstandardlatex}{}%
+}{%
+ \TD at patchstandardlatex%
+}
+% \end{macrocode}
% \subsection{\pkg{titletoc} support}
@@ -829,6 +905,7 @@
% \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 @@
% 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 at 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 @@
% \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 at usetocdata}
+\appto{\cftchapterleader}{\TD at usetocdata}
+\appto{\cftsectionleader}{\TD at usetocdata}
+\appto{\cftsubsectionleader}{\TD at usetocdata}
+\appto{\cftsubsubsectionleader}{\TD at usetocdata}
+\appto{\cftparagraphleader}{\TD at usetocdata}
+\appto{\cftsubparagraphleader}{\TD at usetocdata}
+\appto{\cftfigureleader}{\TD at usetocdata}
+\appto{\cfttableleader}{\TD at usetocdata}
+\appto{\cftsubfigureleader}{\TD at usetocdata}
+\appto{\cftsubtableleader}{\TD at usetocdata}
+}% memoir
+{% not memoir
\@ifpackageloaded{tocloft}
{
% \end{macrocode}
@@ -923,12 +1012,160 @@
% \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 at usetocdata} is inserted near the end of the following:
+%
+% \begin{macrocode}
+\AtBeginDocument{
+
+\@ifpackageloaded{tocbasic}{
+\renewcommand*{\scr at dte@tocline}[3]{%
+ \ifnum \@nameuse{#1tocdepth}>\c at tocdepth
+ \else
+ \tocbasic at DependOnPenaltyAndTOCLevel{#1}%
+ \addvspace{\@nameuse{scr at tso@#1 at beforeskip}}\relax
+ {%
+ \leftskip \@nameuse{scr at tso@#1 at indent}\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \@nameuse{Ifscr at tso@#1 at raggedpage}{%
+ \addtolength{\parfillskip}{\z@ \@plus 1fil}%
+ }{}%
+ \parindent \@nameuse{scr at tso@#1 at indent}\relax
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \expandafter\ifx\csname ragged#1entry\endcsname\raggedright
+ \addtolength\rightskip\@flushglue
+ \else
+ \def\reserved at a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved at a
+ \addtolength\rightskip\@flushglue
+ \else
+ \renewcommand\reserved at a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved at a
+ \addtolength\rightskip\@flushglue
+ \fi
+ \fi
+ \fi
+ \leavevmode
+ \@tempdima \@nameuse{scr at tso@#1 at numwidth}\relax
+ \@nameuse{Ifscr at tso@#1 at dynnumwidth}{%
+ \scr at ifundefinedorrelax{scr at dte@#1 at lastmaxnumwidth}{}{%
+ \ifdim \@nameuse{scr at dte@#1 at lastmaxnumwidth}>\@tempdima
+ \@tempdima\@nameuse{scr at dte@#1 at lastmaxnumwidth}\relax
+ \fi
+ }%
+ }{}%
+ \advance\leftskip \@tempdima
+ \null\nobreak\hskip -\leftskip
+ {%
+ \usetocbasicnumberline
+ \let\scr at dte@numberline at box\numberline at box
+ \def\numberline at box##1{%
+ \sbox\scr at dte@tocline at numbox{\@nameuse{scr at tso@#1 at numberformat}{##1}}%
+ \global\scr at dte@tocline at numberwidth
+ \dimexpr\wd\scr at dte@tocline at numbox+\@nameuse{scr at tso@#1 at numsep}\relax
+ \relax
+ \ifdim \scr at dte@tocline at numberwidth
+ >\@nameuse{scr at dte@#1 at maxnumwidth}\relax
+ \global\@nameuse{scr at dte@#1 at maxnumwidth}\scr at dte@tocline at numberwidth
+ \fi
+ \@nameuse{Ifscr at tso@#1 at dynnumwidth}{}{%
+ \ifdim \scr at dte@tocline at numberwidth
+ >\dimexpr \@nameuse{scr at tso@#1 at numwidth}%
+ +\@nameuse{scr at tso@#1 at numsep}\relax\relax
+ \PackageWarning{tocbasic%
+ }{%
+ number width of #1 toc entries should be
+ increased!\MessageBreak
+ Currently used number width =
+ \the\wd\scr at dte@tocline at numbox,\MessageBreak
+ Wanted number separation
+ \space\space\space =
+ \the\dimexpr\@nameuse{scr at tso@#1 at numsep}\relax,\MessageBreak
+ Reserved number width \space\space\space\space\space\space =
+ \the\dimexpr\@nameuse{scr at tso@#1 at numwidth}\relax%
+ }%
+ \fi
+ }%
+ \scr at dte@numberline at box{\@nameuse{scr at tso@#1 at numberformat}{##1}}%
+ \@nameuse{Ifscr at tso@#1 at breakafternumber}{%
+ {\parfillskip\@flushglue\par}\nobreak\hskip-\leftskip
+ }{}%
+ }%
+ \@nameuse{scr at tso@#1 at entryformat}{%
+ #2%
+ \nobreak
+ {%
+ \normalfont\normalsize\@nameuse{scr at tso@#1 at linefill}%
+ \TD at usetocdata% lwarp
+ \nobreak
+ \@nameuse{scr at tso@#1 at pagenumberbox}{%
+ \@nameuse{scr at tso@#1 at pagenumberformat}{#3}%
+ }%
+ }%
+ \@par
+ }%
+ }%
+ }%
+ \tocbasic at 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 at dottedtocline
+ {%
+ \ifx\tocstyle at feature@leaders\relax
+ \leaders\hbox{$\m at th
+ \mkern \@dotsep mu\hbox{\tocstyle at feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle at feature@leaders
+ \fi%
+ }
+ {%
+ \ifx\tocstyle at feature@leaders\relax
+ \leaders\hbox{$\m at th
+ \mkern \@dotsep mu\hbox{\tocstyle at feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle at feature@leaders
+ \fi%
+ \TD at usetocdata%
+ }
+ {}%
+ {%
+ \PackageWarningNoLine{tocdata}{%
+ Could not patch tocstyle \protect\tocstyle at dottedtocline.\MessageBreak
+ Authors may not appear in TOC, LOF}
+ }%
+}{}
+}
+% \end{macrocode}
+%
+%
+%
% \clearpage
%
% \subsection{User-level macros}
@@ -958,12 +1195,13 @@
% \subsubsection{User customization}
%
%
-% \begin{macro}{\TD at 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 at optionalnameprint}.}
% \begin{macrocode}
-\newcommand{\TD at optionalname}[1]
+\newcommand{\TDoptionalnameprint}[1]
{%
\ifblank{#1}%
{}%
@@ -979,20 +1217,19 @@
%
% 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 at optionalname{#1}\TD at optionalname{#2}#3#4%
+ \TDoptionalnameprint{#1}\TDoptionalnameprint{#2}#3#4%
}%
}%
}
@@ -1039,17 +1276,18 @@
% \end{macro}
%
%
-% \begin{macro}{\TD at 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 at artistauthorprint}.}
%
% \begin{macrocode}
-\newcommand{\TD at artistauthorprint}[5]{%
+\newcommand{\TDartistauthorprint}[5]{%
\begin{minipage}{\linewidth}%
\csuse{TD@#1align}%
\footnotesize\normalfont%
- \textsc{{\TD at optionalname{#2}\TD at optionalname{#3}#4#5}}%
+ \textsc{{\TDoptionalnameprint{#2}\TDoptionalnameprint{#3}#4#5}}%
\end{minipage}%
\par%
\addvspace{2ex}%
@@ -1070,7 +1308,7 @@
% \begin{macrocode}
\newcommand{\tocdataartistprint}{%
\par\smallskip%
- \TD at artistauthorprint{artist}%
+ \TDartistauthorprint{artist}%
}
% \end{macrocode}
% To remove the artist's name, redefine this as a null function taking four arguments:
@@ -1090,7 +1328,7 @@
% \begin{macrocode}
\newcommand{\tocdataauthorprint}{%
\par\smallskip%
- \TD at artistauthorprint{author}%
+ \TDartistauthorprint{author}%
}
% \end{macrocode}
% \end{macro}
@@ -1097,7 +1335,7 @@
%
%
%
-% \begin{macro}{\TD at 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.}
@@ -1104,8 +1342,9 @@
% \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 at artistauthortextprint}.}
% \begin{macrocode}
-\newcommand{\TD at artistauthortextprint}[2]{%
+\newcommand{\TDartistauthortextprint}[2]{%
\addvspace{2ex}%
\begin{minipage}{\linewidth}%
\csuse{TD@#1textalign}%
@@ -1127,7 +1366,7 @@
%
%
% \begin{macrocode}
-\newcommand{\tocdataartisttextprint}{\TD at artistauthortextprint{artist}}
+\newcommand{\tocdataartisttextprint}{\TDartistauthortextprint{artist}}
% \end{macrocode}
% \end{macro}
%
@@ -1136,7 +1375,7 @@
% User-redefinable macro to print the optional text below the author's name.
%
% \begin{macrocode}
-\newcommand{\tocdataauthortextprint}{\TD at artistauthortextprint{author}}
+\newcommand{\tocdataauthortextprint}{\TDartistauthortextprint{author}}
% \end{macrocode}
% \end{macro}
%
@@ -1144,6 +1383,47 @@
%
% \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 at 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 at starredsectionauthorprint}[5]{%
+ \unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
+ \bigskip%
+ }
+}
+{
+ \newcommand*{\TD at 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 at sectionauthor}
% \marg{1: section type}
% *
@@ -1153,7 +1433,8 @@
% \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 at sectionauthor}{m s o m O{} m m O{}}{%
% \end{macrocode}
@@ -1162,7 +1443,8 @@
% \begin{macrocode}
\IfBooleanTF{#2}%
{% star:
- \csuse{#1}*{#4\nopagebreak\csuse{tocdata#1print}{#5}{#6}{#7}{#8}}%
+ \csuse{#1}*{#4}%
+ \TD at starredsectionauthorprint{#1}{#5}{#6}{#7}{#8}%
}%
% \end{macrocode}
% The un-starred version appears in the \acro{TOC}, so add the author's name:
Modified: trunk/Master/texmf-dist/tex/latex/tocdata/tocdata.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/tocdata/tocdata.sty 2019-07-16 21:14:36 UTC (rev 51653)
+++ trunk/Master/texmf-dist/tex/latex/tocdata/tocdata.sty 2019-07-16 21:14:47 UTC (rev 51654)
@@ -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 at usetocdata}{%
- \tocdatafont{\TD at thistocdata}%
- \global\def\TD at thistocdata{}%
+ \ifdefvoid{\TD at thistocdata}{}{%
+ \tocdataformat{\TD at thistocdata}%
+ \global\def\TD at thistocdata{}%
+ }%
}
+\let\TD at checktocdatafont\tocdatafont
+
+\AtBeginDocument{
+\ifdefequal\TD at checktocdatafont\tocdatafont{}{
+ \PackageWarningNoLine{tocdata}{%
+ You have redefined \protect\tocdatafont,\MessageBreak
+ which has been deprecated. Please redefine\MessageBreak
+ \protect\tocdataformat\space instead}
+}
+}
+
+\newcommand*{\TD at patchstandardlatex}{
\xpatchcmd{\@dottedtocline}
{\hfill\nobreak}
{\hfill\TD at usetocdata\nobreak}
@@ -82,6 +104,8 @@
Authors may not appear in TOC, LOF}
}%
+\@ifclassloaded{memoir}{}{%
+\@ifpackageloaded{tocbasic}{}{%
\xpatchcmd{\l at part}
{\hfil}
{\hfil\TD at usetocdata}
@@ -91,10 +115,11 @@
Could not patch LaTeX core \protect\l at part.\MessageBreak
Authors may not appear in TOC parts}
}%
+}}
-\@ifundefined{chapter}
-{}
-{
+\@ifclassloaded{memoir}{}{%
+\@ifpackageloaded{tocbasic}{}{%
+\@ifundefined{chapter}{}{%
\xpatchcmd{\l at chapter}
{\hfil\nobreak}
{\hfil\TD at usetocdata\nobreak}
@@ -104,8 +129,9 @@
Could not patch LaTeX core \protect\l at chapter.\MessageBreak
Authors may not appear in TOC chapters}
}%
-}
+}}}
+\@ifclassloaded{article}{
\xpatchcmd{\l at section}
{\hfil\nobreak}
{\hfil\TD at usetocdata\nobreak}
@@ -115,6 +141,13 @@
Could not patch LaTeX core \protect\l at section.\MessageBreak
Authors may not appear in TOC sections}
}%
+}{}
+}% TD at patchstandardlatex
+\@ifpackageloaded{lwarp}{%
+ \ifbool{warpingprint}{\TD at patchstandardlatex}{}%
+}{%
+ \TD at patchstandardlatex%
+}
\AtBeginDocument{
\@ifpackageloaded{titletoc}{
@@ -147,6 +180,21 @@
}% end of \AtBeginDocument
\AtBeginDocument{
+\@ifclassloaded{memoir}
+{
+\appto{\cftpartleader}{\TD at usetocdata}
+\appto{\cftchapterleader}{\TD at usetocdata}
+\appto{\cftsectionleader}{\TD at usetocdata}
+\appto{\cftsubsectionleader}{\TD at usetocdata}
+\appto{\cftsubsubsectionleader}{\TD at usetocdata}
+\appto{\cftparagraphleader}{\TD at usetocdata}
+\appto{\cftsubparagraphleader}{\TD at usetocdata}
+\appto{\cftfigureleader}{\TD at usetocdata}
+\appto{\cfttableleader}{\TD at usetocdata}
+\appto{\cftsubfigureleader}{\TD at usetocdata}
+\appto{\cftsubtableleader}{\TD at usetocdata}
+}% memoir
+{% not memoir
\@ifpackageloaded{tocloft}
{
\appto{\cftpartleader}{\TD at usetocdata}
@@ -165,21 +213,150 @@
}% end of tocloft patches
{}% tocloft not loaded
+}% not memoir
}% \AtBeginDocument
-\newcommand{\TD at optionalname}[1]
+\AtBeginDocument{
+
+\@ifpackageloaded{tocbasic}{
+\renewcommand*{\scr at dte@tocline}[3]{%
+ \ifnum \@nameuse{#1tocdepth}>\c at tocdepth
+ \else
+ \tocbasic at DependOnPenaltyAndTOCLevel{#1}%
+ \addvspace{\@nameuse{scr at tso@#1 at beforeskip}}\relax
+ {%
+ \leftskip \@nameuse{scr at tso@#1 at indent}\relax
+ \rightskip \@tocrmarg
+ \parfillskip -\rightskip
+ \@nameuse{Ifscr at tso@#1 at raggedpage}{%
+ \addtolength{\parfillskip}{\z@ \@plus 1fil}%
+ }{}%
+ \parindent \@nameuse{scr at tso@#1 at indent}\relax
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \expandafter\ifx\csname ragged#1entry\endcsname\raggedright
+ \addtolength\rightskip\@flushglue
+ \else
+ \def\reserved at a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved at a
+ \addtolength\rightskip\@flushglue
+ \else
+ \renewcommand\reserved at a{\raggedright}%
+ \expandafter\ifx\csname ragged#1entry\endcsname\reserved at a
+ \addtolength\rightskip\@flushglue
+ \fi
+ \fi
+ \fi
+ \leavevmode
+ \@tempdima \@nameuse{scr at tso@#1 at numwidth}\relax
+ \@nameuse{Ifscr at tso@#1 at dynnumwidth}{%
+ \scr at ifundefinedorrelax{scr at dte@#1 at lastmaxnumwidth}{}{%
+ \ifdim \@nameuse{scr at dte@#1 at lastmaxnumwidth}>\@tempdima
+ \@tempdima\@nameuse{scr at dte@#1 at lastmaxnumwidth}\relax
+ \fi
+ }%
+ }{}%
+ \advance\leftskip \@tempdima
+ \null\nobreak\hskip -\leftskip
+ {%
+ \usetocbasicnumberline
+ \let\scr at dte@numberline at box\numberline at box
+ \def\numberline at box##1{%
+ \sbox\scr at dte@tocline at numbox{\@nameuse{scr at tso@#1 at numberformat}{##1}}%
+ \global\scr at dte@tocline at numberwidth
+ \dimexpr\wd\scr at dte@tocline at numbox+\@nameuse{scr at tso@#1 at numsep}\relax
+ \relax
+ \ifdim \scr at dte@tocline at numberwidth
+ >\@nameuse{scr at dte@#1 at maxnumwidth}\relax
+ \global\@nameuse{scr at dte@#1 at maxnumwidth}\scr at dte@tocline at numberwidth
+ \fi
+ \@nameuse{Ifscr at tso@#1 at dynnumwidth}{}{%
+ \ifdim \scr at dte@tocline at numberwidth
+ >\dimexpr \@nameuse{scr at tso@#1 at numwidth}%
+ +\@nameuse{scr at tso@#1 at numsep}\relax\relax
+ \PackageWarning{tocbasic%
+ }{%
+ number width of #1 toc entries should be
+ increased!\MessageBreak
+ Currently used number width =
+ \the\wd\scr at dte@tocline at numbox,\MessageBreak
+ Wanted number separation
+ \space\space\space =
+ \the\dimexpr\@nameuse{scr at tso@#1 at numsep}\relax,\MessageBreak
+ Reserved number width \space\space\space\space\space\space =
+ \the\dimexpr\@nameuse{scr at tso@#1 at numwidth}\relax%
+ }%
+ \fi
+ }%
+ \scr at dte@numberline at box{\@nameuse{scr at tso@#1 at numberformat}{##1}}%
+ \@nameuse{Ifscr at tso@#1 at breakafternumber}{%
+ {\parfillskip\@flushglue\par}\nobreak\hskip-\leftskip
+ }{}%
+ }%
+ \@nameuse{scr at tso@#1 at entryformat}{%
+ #2%
+ \nobreak
+ {%
+ \normalfont\normalsize\@nameuse{scr at tso@#1 at linefill}%
+ \TD at usetocdata% lwarp
+ \nobreak
+ \@nameuse{scr at tso@#1 at pagenumberbox}{%
+ \@nameuse{scr at tso@#1 at pagenumberformat}{#3}%
+ }%
+ }%
+ \@par
+ }%
+ }%
+ }%
+ \tocbasic at SetPenaltyByTOCLevel{#1}%
+ \fi
+}
+
+}{}
+}
+\AtBeginDocument{
+\@ifpackageloaded{tocstyle}{
+\xpatchcmd\tocstyle at dottedtocline
+ {%
+ \ifx\tocstyle at feature@leaders\relax
+ \leaders\hbox{$\m at th
+ \mkern \@dotsep mu\hbox{\tocstyle at feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle at feature@leaders
+ \fi%
+ }
+ {%
+ \ifx\tocstyle at feature@leaders\relax
+ \leaders\hbox{$\m at th
+ \mkern \@dotsep mu\hbox{\tocstyle at feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle at feature@leaders
+ \fi%
+ \TD at usetocdata%
+ }
+ {}%
+ {%
+ \PackageWarningNoLine{tocdata}{%
+ Could not patch tocstyle \protect\tocstyle at 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 at optionalname{#1}\TD at optionalname{#2}#3#4%
+ \TDoptionalnameprint{#1}\TDoptionalnameprint{#2}#3#4%
}%
}%
}
@@ -190,11 +367,11 @@
}% end of chapters-only
\let\tocdatasectionprint\tocdatapartprint
\let\tocdatasubsectionprint\tocdatapartprint
-\newcommand{\TD at artistauthorprint}[5]{%
+\newcommand{\TDartistauthorprint}[5]{%
\begin{minipage}{\linewidth}%
\csuse{TD@#1align}%
\footnotesize\normalfont%
- \textsc{{\TD at optionalname{#2}\TD at optionalname{#3}#4#5}}%
+ \textsc{{\TDoptionalnameprint{#2}\TDoptionalnameprint{#3}#4#5}}%
\end{minipage}%
\par%
\addvspace{2ex}%
@@ -201,13 +378,13 @@
}
\newcommand{\tocdataartistprint}{%
\par\smallskip%
- \TD at artistauthorprint{artist}%
+ \TDartistauthorprint{artist}%
}
\newcommand{\tocdataauthorprint}{%
\par\smallskip%
- \TD at artistauthorprint{author}%
+ \TDartistauthorprint{author}%
}
-\newcommand{\TD at artistauthortextprint}[2]{%
+\newcommand{\TDartistauthortextprint}[2]{%
\addvspace{2ex}%
\begin{minipage}{\linewidth}%
\csuse{TD@#1textalign}%
@@ -219,12 +396,35 @@
\par%
\addvspace{2ex}%
}
-\newcommand{\tocdataartisttextprint}{\TD at artistauthortextprint{artist}}
-\newcommand{\tocdataauthortextprint}{\TD at artistauthortextprint{author}}
+\newcommand{\tocdataartisttextprint}{\TDartistauthortextprint{artist}}
+\newcommand{\tocdataauthortextprint}{\TDartistauthortextprint{author}}
+\@ifclassloaded{article}
+{
+ \newcommand*{\TD at starredsectionauthorprint}[5]{%
+ \unskip\medskip\csuse{tocdata#1print}{#2}{#3}{#4}{#5}\par%
+ \bigskip%
+ }
+}
+{
+ \newcommand*{\TD at 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 at 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 at starredsectionauthorprint{#1}{#5}{#6}{#7}{#8}%
}%
{% no star:
\tocdata{toc}{#6 #7}%
More information about the tex-live-commits
mailing list