summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tocdata
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-03-15 21:16:31 +0000
committerKarl Berry <karl@freefriends.org>2019-03-15 21:16:31 +0000
commit6e5c7721efd8538de71d9c13e23ba3cc7683c789 (patch)
tree029f75d16aa6c9ab09189043371895dd7553d714 /Master/texmf-dist/source/latex/tocdata
parenta25eed5c445ed84429754cc0b7fce952b363ee16 (diff)
tocdata (15mar19)
git-svn-id: svn://tug.org/texlive/trunk@50403 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/tocdata')
-rw-r--r--Master/texmf-dist/source/latex/tocdata/tocdata.dtx941
1 files changed, 650 insertions, 291 deletions
diff --git a/Master/texmf-dist/source/latex/tocdata/tocdata.dtx b/Master/texmf-dist/source/latex/tocdata/tocdata.dtx
index 1033a28608c..25f73bfb69a 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/01/12 v1.00 Adds author/artist to TOC entries.]
+%<package> [2019/03/15 v2.00 Adds author/artist to TOC entries.]
%
%<*driver>
\documentclass{ltxdoc}
@@ -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}
+\usepackage{dtxdescribe}[2019/01/11]
\usepackage{graphicx}
\graphicspath{{images/}}
@@ -96,17 +96,34 @@ of the \acro{TOC}\Slash\acro{LOF}.
\usepackage{longtable}
\usepackage{booktabs}
+\usepackage[all,defaultlines=2]{nowidow}
+
\usepackage[normalem]{ulem}
-% \usepackage{verbatim}
\usepackage{fancyvrb}
-\usepackage{comment}
-\excludecomment{testing}
-% \usepackage{morefloats}
-% \usepackage{marginfix}
+\usepackage{newfloat}
+
+\DeclareFloatingEnvironment[
+ fileext=loi,
+ listname={List of Illustrations},
+ name=Illustration,
+ placement=tbp,
+]{illustration}
+
+\DeclareFloatingEnvironment[
+ fileext=loq,
+ listname={List of Quotations},
+ name=Quotation,
+ placement=tbp,
+]{aquote}
+\setlength{\floatsep}{5ex}
+\setlength{\textfloatsep}{5ex}
+
+
+\usepackage{\mypackagename}
@@ -127,7 +144,6 @@ of the \acro{TOC}\Slash\acro{LOF}.
-
\usepackage[pdftex,bookmarks=true,hidelinks,%
colorlinks,linkcolor=mylinkcolor,urlcolor=myurlcolor,%
pageanchor=true,hyperindex=false,
@@ -151,13 +167,12 @@ Keywords={LaTeX, tocdata, contents}%
-\setlength{\parindent}{0em}
-\setlength{\parskip}{2ex}
+\setlength{\parindent}{2em}
+\setlength{\parskip}{0ex}
+
\setlength{\IndexMin}{40ex}
-\usepackage{\mypackagename}
-
\setcounter{IndexColumns}{2}
\setcounter{GlossaryColumns}{1}
@@ -171,7 +186,7 @@ Keywords={LaTeX, tocdata, contents}%
%</driver>
% \fi
%
-% \CheckSum{0}
+% \CheckSum{363}
%
% \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
@@ -193,8 +208,12 @@ Keywords={LaTeX, tocdata, contents}%
% \changes{v0.11}{2016/07/11}{\ 2016/07/11}
% \changes{v0.11}{2016/07/11}{Minor docs improvements in spelling, grammar, formatting.}
% \changes{v0.12}{2016/12/02}{\ 2016/12/02}
-% \changes{v1.00}{2019/01/12}{\ 2019/01/12}
% \changes{v1.00}{2019/01/08}{Improved source formatting.}
+% \changes{v1.00}{2019/01/12}{\ 2019/01/12}
+% \changes{v2.00}{2019/03/15}{Added part and subsection macros.}
+% \changes{v2.00}{2019/03/15}{Added caption authors.}
+% \changes{v2.00}{2019/03/15}{Added support for new float types.}
+% \changes{v2.00}{2019/03/15}{\ 2019/03/15}
@@ -230,11 +249,12 @@ Keywords={LaTeX, tocdata, contents}%
% \begin{abstract}
% \noindent
% The \pkg{tocdata} package adds information such as an author or artist to
-% an entry in the table of contents or list of figures,
-% on a single line along with the caption and page number.
-% This is commonly done in collections of literature, poetry, or art work.
+% an entry in the table of contents or list of figures or new float type.
+% 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.
%
-% Either the \pkg{titletoc} or \pkg{tocloft} package must be loaded before \pkg{tocdata}.
+% \pkg{tocdata} works with the \TOC\ \Slash \LOF\ formatting of the default \LaTeX\ classes,
+% or with the \pkg{titletoc} or \pkg{tocloft} packages.
% \end{abstract}
%
% \vspace*{\fill}
@@ -242,10 +262,14 @@ Keywords={LaTeX, tocdata, contents}%
% \vspace*{\fill}
% \end{center}
%
-% \tableofcontents
% \clearpage
+%
+% \tableofcontents
+% ^^A \clearpage
% \listoffigures
% ^^A \listoftables
+% \listofillustrations
+% \listofaquotes
%
%
% \thispagestyle{pageheadfoot}
@@ -258,11 +282,20 @@ Keywords={LaTeX, tocdata, contents}%
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[width=2in]{go_problem.png}}
-% \captionartist{The Opening Challenge}
+% \captionartist{A Challenge}
% [Problem 1-2, from \textit{Gokyo Shumyo}]
% {Hayashi}{Genbi}
% \end{figure}
-
+%
+% \begin{aquote}
+% \itshape
+% ``Go uses the most elemental materials and concepts --- line and circle,
+% wood and stone, black and white --- combining them with simple rules
+% to generate subtle strategies and complex tactics that stagger the imagination.''
+% \captionauthor{\textit{Go uses the most elemental materials and concepts \dots}}%
+% {Iwamoto}{Kaoru}%
+% [\textnormal{ --- former \textit{Honinbo} title holder}]
+% \end{aquote}
%
% Anthologies may be printed with the author alongside each title in the
% table of contents.
@@ -273,22 +306,29 @@ Keywords={LaTeX, tocdata, contents}%
%
% The \pkg{tocdata} package provides some basic infrastructure to help
% add some information to a line in the table of contents, after the title
-% and just before the page number. This function requires the use of either
-% the \pkg{titletoc} or \pkg{tocloft} packages.
+% and just before the page number. This function works with the standard
+% \LaTeX\ classes, or with either of the \pkg{titletoc} or \pkg{tocloft} packages.
%
% Additionally,
% user-level macros are provided which add the author's name to a chapter or section,
-% and add the artist's name and optional additional text to a figure.
+% and add the author's or artist's name and optional additional text to a figure.
% Author and artist names are also added to the index.
%
% As examples of the use of these high-level macros,
% the major section headings of this documentation
-% have the author's name applied, and additional illustrations are supplied as well.
-% The results are demonstrated in the table of contents, list of figures, and the index.
+% have the author's name applied, and additional figures, illustrations, and quotes
+% are supplied as well.
+% The results are demonstrated in the table of contents, list of figures,
+% list of illustrations, list of quotes, and the index.\footnote{%
+% Yes, I \emph{do} recognize the absurdity of placing my own name in the index
+% amongst the likes of Churchill, Genbi, Herschel, Kaoru, Newton\,\dots}
%
%
% \clearpage
%
+% \setlength{\parindent}{0em}
+% \setlength{\parskip}{2ex}
+%
% \sectionauthor[Other methods]{Other methods}{Various}{Authors}
% \label{sec:othermethods}
%
@@ -312,14 +352,14 @@ Keywords={LaTeX, tocdata, contents}%
% {http://tex.stackexchange.com/questions/156862/displaying-author-for-each-chapter-in-book}
% {http://tex.stackexchange.com/questions/ \\ \hspace*{1in} 156862/displaying-author-for-each-chapter-in-book}%
%
-% \begin{figure}
+% \begin{illustration}
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[height=3in]{engineer.jpg}}
% \captionartist
% [The Crazy Engineer]
% {The Crazy Engineer}[Illustration from \textit{The Crazy Engineer} \par \textit{McGuffey's Fifth Eclectic Reader}]{H. F.}{Farny}
-% \end{figure}
+% \end{illustration}
%
% \clearpage
%
@@ -355,17 +395,14 @@ Keywords={LaTeX, tocdata, contents}%
%
% \subsubsection{Preamble}
%
-% \pkg{tocdata} requires the use of either the \pkg{tocloft} or \pkg{titletoc} package.
+% \pkg{tocdata} may be used with either the \pkg{tocloft} or \pkg{titletoc} package,
+% or neither.
%
% In the preamble, use:
% \begin{sourceverb}
-% \usepackage{tocloft}
-% \usepackage{tocdata}
-% \end{sourceverb}
-% -\textit{or}-
-% \begin{sourceverb}
-% \usepackage{titletoc}
-% \usepackage{tocdata}
+% \usepackage{tocdata}% optional
+% \usepackage{titletoc}% optional
+% \usepackage{tocloft}
% \end{sourceverb}
%
% \begin{docsidebar}
@@ -376,8 +413,16 @@ Keywords={LaTeX, tocdata, contents}%
% inserting the \cs{TD@usetocdata} macro as shown below.
% \end{docsidebar}
%
+% \subsection{Mid-level applications}
+%
+% Should the user only wish to add a bit of text into the \acro{TOC}\Slash\acro{LOF},
+% the \cs{tocdata} macro may be used just before the sectioning or caption command,
+% as shown below.
+%
% \subsubsection{Font control in the \acro{TOC}\Slash\acro{LOF}}
%
+% \DescribeMacro{\tocdatafont} \marg{text}
+%
% To control the font used for the author on the table-of-contents line,
% the default is:
% \begin{sourceverb}
@@ -390,13 +435,10 @@ Keywords={LaTeX, tocdata, contents}%
% \end{sourceverb}
%
%
-% \subsection{Mid-level applications}
+% \subsubsection{Adding \acro{TOC} data per section}
%
-% Should the user only wish to add a bit of text into the \acro{TOC}\Slash\acro{LOF},
-% the \cs{tocdata} macro may be used just before the sectioning or caption command,
-% as shown next.
+% \DescribeMacro{\tocdata} \marg{list extension} \marg{text}
%
-% \subsubsection{Adding \acro{TOC} data per section}
% Before each \cs{chapter} or \cs{section} which is to have an author or other data:
%
% \begin{sourceverb}
@@ -422,9 +464,10 @@ Keywords={LaTeX, tocdata, contents}%
% These are user-level sectioning and captioning commands which add the
% names to the \acro{TOC} and \acro{LOF},
% and also add the artist's name and optional additional text
-% to a figure (as in Figure \ref{fig:quail}),
+% to a figure or other float (as in Figure \ref{fig:quail}),
% and also add the names to the index.
-% An optional prefix and suffix may be attached to the names (as in Figure \ref{fig:astronometer}),
+% An optional prefix and suffix may be attached to the names
+% (as in Figure \ref{fig:astronometer}),
% and these will be printed at the section heading or caption, but not
% in the \acro{TOC}\Slash\acro{LOF} or in the index.
%
@@ -432,46 +475,54 @@ Keywords={LaTeX, tocdata, contents}%
%
% \subsubsection{Sectioning commands with authors}
%
+% \DescribeMacro{\partauthor}
% \DescribeMacro{\chapterauthor}
+% \DescribeMacro{\sectionauthor}
+% \DescribeMacro{\subsectionauthor}
% To use these macros, do not use \cs{tocdata} as shown above, but instead use,
-% in the place of \cs{chapter}:
-%
+% in the place of \cs{part}:
% \begin{sourceverb}
-% \chapterauthor[\TOC\ entry]{Title}[Prefix]{First}{Last}[Suffix]
+% \partauthor[list entry]{Title}[Prefix]{First}{Last}[Suffix]
% \end{sourceverb}
+% Likewise for chapters, sections, and subsections.
%
-% \DescribeMacro{\sectionauthor}
-% or, in the place of \cs{section}:
%
-% \begin{sourceverb}
-% \sectionauthor[\TOC\ entry]{Title}[Prefix]{First}{Last}[Suffix]
-% \end{sourceverb}
%
-% \subsubsection{Figure captions with artist names and add'l text}
+% \subsubsection{Figure captions with author \Slash artist names and additional text}
%
% \DescribeMacro{\captionartist}
-% For figures, in the place of \cs{caption}:
+% \DescribeMacro{\captionauthor}
+% For figures, in the place of \cs{caption}, use:
%
% \begin{sourceverb}
-% \captionartist[\LOF\ entry]{Title}[Text][Prefix]{First}{Last}[Suffix]
+% \captionartist[list entry]{Title}[Text][Prefix]{First}{Last}[Suffix]
+% -or-
+% \captionauthor[list entry]{Title}[Text][Prefix]{First}{Last}[Suffix]
% \end{sourceverb}
%
+% By default, \cs{captionartist} prints the artist centered below the figure,
+% and \cs{captionauthor} prints the author below and flush right, without
+% an extra vertical skip.
+%
% If you are using the optional prefix, the optional text must also be given, even if it
% is empty. For example, use:
% \watchout[Optional arguments]
-% \begin{sourceverb}
-% \captionartist{Title}|\textcolor{red}{|[]|}|[Sir]{Isaac}{Newton}
-% \end{sourceverb}
-% If only one optional argument is given before the first name, it will be
-% interpreted as the optional text, not as the optional prefix.
+% \begin{sourcedisplay}
+% \cs{captionartist}\{Title\}\textcolor{red}{[]}[Sir]\{Isaac\}\{Newton\}
+% \end{sourcedisplay}
+% (If only one optional argument is given before the first name, it will be
+% interpreted as the optional text, not as the optional prefix.)
%
% \DescribeMacro{\captionartist*}
+% \DescribeMacro{\captionauthor*}
% If you are using the \pkg{caption} package or another package which
-% supports \cs{caption*}, you may use \cs{captionartist*} with \pkg{tocdata}.
-% The artist and supplemental text will still be printed below the figure,
+% supports \cs{caption*}, you may use \cs{captionartist*} and \cs{captionauthor*}
+% with \pkg{tocdata}.
+% The artist \Slash author and supplemental text will still be printed below the figure,
% and an unnumbered caption will be generated, even though a \acro{LOF} entry will not be made.
%
-% Should you mistakenly use \cs{captionartist*} without the \pkg{caption} package,
+% Should you mistakenly use \cs{captionartist*} or \cs{captionauthor*}
+% without the \pkg{caption} package,
% expect to get a caption with a visible star in it.
% \watchout[\pkg{caption} package]
% To fix the problem:\\
@@ -479,37 +530,50 @@ Keywords={LaTeX, tocdata, contents}%
%
% \subsubsection{Formatting in sections and figures}
%
-% \DescribeMacro{\tocdatachapprint}
-% \DescribeMacro{\tocdatasecprint}
+% \DescribeMacro{\tocdatapartprint}
+% \DescribeMacro{\tocdatachapterprint}
+% \DescribeMacro{\tocdatasectionprint}
+% \DescribeMacro{\tocdatasubsectionprint}
% To change the formatting of the author names printed after
% each chapter or section, or to remove them entirely, use
% these macros, as described in section~\ref{sec:usermacros}
% on page~\pageref{sec:usermacros}.
%
+% \cs{tocdatachapterprint} and \cs{tocdatasectionprint} by default
+% \watchout[redefining]
+% depend on \cs{tocdatapartprint}, so if it is redefined the others will
+% have to be redefined as well.
+%
%
-% \DescribeMacro{\tocdatafigprint}
-% \DescribeMacro{\tocdatafigtextprint}
-% To change the formatting of a figure's artist's name and optional text,
+% \DescribeMacro{\tocdataartistprint}
+% \DescribeMacro{\tocdataartisttextprint}
+% \DescribeMacro{\tocdataauthorprint}
+% \DescribeMacro{\tocdataauthortextprint}
+% To change the formatting of a figure's artist's name or author's name and optional text,
% use these macros, also described in section \ref{sec:usermacros}.
%
%
% \subsubsection{Text justification}
%
-% \DescribeMacro{\tdnamejustify}
-% \DescribeMacro{\tdnamecenter}
-% \DescribeMacro{\tdnameleft}
-% \DescribeMacro{\tdnameright}
-% To change the text jusification of the name below a figure, use one of
-% the |tdname| macros before the figure.
-% All following figures use the selected justification
-% until it is changed to another.
-%
-% \DescribeMacro{\tdtextjustify}
-% \DescribeMacro{\tdtextcenter}
-% \DescribeMacro{\tdtextleft}
-% \DescribeMacro{\tdtextright}
-% To change the text jusification of the additional text below a figure, use one of
-% the |txtext| macros before the figure.
+% \DescribeMacro{\tdartistnamejustify}
+% \DescribeMacro{\tdartistnamecenter}
+% \DescribeMacro{\tdartistnameleft}
+% \DescribeMacro{\tdartistnameright}
+% \DescribeMacro{\tdartisttextjustify}
+% \DescribeMacro{\tdartisttextcenter}
+% \DescribeMacro{\tdartisttextleft}
+% \DescribeMacro{\tdartisttextright}
+% \DescribeMacro{\tdauthornamejustify}
+% \DescribeMacro{\tdauthornamecenter}
+% \DescribeMacro{\tdauthornameleft}
+% \DescribeMacro{\tdauthornameright}
+% \DescribeMacro{\tdauthortextjustify}
+% \DescribeMacro{\tdauthortextcenter}
+% \DescribeMacro{\tdauthortextleft}
+% \DescribeMacro{\tdauthortextright}
+% The text alignment of artists, artists' additional text,
+% authors, and authors' additional text may be set using
+% these macros.
% All following figures use the selected justification
% until it is changed to another.
%
@@ -517,22 +581,35 @@ Keywords={LaTeX, tocdata, contents}%
% \StopEventually{\PrintChanges
% \PrintIndex
%
-% \begin{figure}[hbp]
+% \clearpage
+%
+% \tdauthortextright
+% \begin{aquote}[tbp]
+% \itshape
+% ``Now this is not the end.
+% It is not even the beginning of the end.
+% But it is, perhaps, the end of the beginning.''
+% \captionauthor{\textit{Now this is not the end \dots}}
+% [(Full name used for demonstration purposes.)][Sir]{Winston Leonard Spencer}{Churchill}
+% \end{aquote}
+%
+% \begin{figure}[tbp]
% \centering
% \setlength{\fboxsep}{2ex}
% {\fontsize{35}{50}\selectfont\textOmega}
-% \captionartist{Omega --- The End}{Greek}{Alphabet}
+% \captionartist{Omega}{Greek}{Alphabet}
% \end{figure}
+%
%}
%
-% \begin{figure}[hbp]
+% \begin{illustration}[hbp]
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[width=3in]{quail.jpg}}
% \captionartist{Quail\label{fig:quail}}
% [Illustration from \textit{About Quail} \par \textit{McGuffey's Fifth Eclectic Reader}]
% {Alexander}{Pope}
-% \end{figure}
+% \end{illustration}
%
%
% \clearpage
@@ -551,7 +628,8 @@ Keywords={LaTeX, tocdata, contents}%
% place the data into the table of contents and list of figures, as well as
% the code to control the font used while doing so.
%
-% Next are sections used to support \pkg{titletoc} and \pkg{tocloft}.
+% Next are sections used to support the default \LaTeX\ classes,
+% as well as \pkg{titletoc} and \pkg{tocloft}.
%
% Finally, the high-level macros are provided. The user may ignore or redefine these
% as desired.
@@ -565,25 +643,52 @@ Keywords={LaTeX, tocdata, contents}%
% \begin{macrocode}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
+\RequirePackage{xpatch}
% \end{macrocode}
-% Test for either \pkg{titletoc} or \pkg{tocloft}.
-% \changes{v1.00}{2019/01/09}{Test for \pkg{titletoc} or \pkg{tocloft}.}
+
+% Require that \pkg{titletoc} and \pkg{tocloft} be loaded
+% 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}.}
+% \begin{macrocode}
+\@ifpackageloaded{titletoc}{
+ \PackageError{tocdata}
+ {%
+ Load titletoc after tocdata%
+ }
+ {%
+ Move \protect\usepackage{titletoc} after \protect\usepackage{tocdata}.%
+ }
+}{}
+\@ifpackageloaded{tocloft}{
+ \PackageError{tocdata}
+ {%
+ Load tocloft after tocdata%
+ }
+ {%
+ Move \protect\usepackage{tocloft} after \protect\usepackage{tocdata}.%
+ }
+}{}
+% \end{macrocode}
+
+% Prevent the use of both \pkg{titletoc} and \pkg{tocloft}.
+% \changes{v2.00}{2019/03/12}{Test for both \pkg{titletoc} and \pkg{tocloft}.}
% \begin{macrocode}
+\AtBeginDocument{
\@ifpackageloaded{titletoc}{
\@ifpackageloaded{tocloft}{
\PackageError{tocdata}
- {Both titletoc and tocloft are being used. Load only one}
- {The tocdata package requires either one of titletoc or tocloft.}
- }{}
-}{% Not titletoc.
- \@ifpackageloaded{tocloft}{}{
- \PackageError{tocdata}
- {
- The tocdata package requires either the tocloft or titletoc package%
+ {%
+ Both titletoc and tocloft are being used.\MessageBreak
+ Load only one%
+ }
+ {%
+ The tocdata package may use the default LaTeX formatting,\MessageBreak
+ or either one of titletoc or tocloft.
}
- {Load either, then load tocdata next.}
- }
+ }{}
+}{}
}
% \end{macrocode}
@@ -598,7 +703,7 @@ Keywords={LaTeX, tocdata, contents}%
% \end{macro}
% \begin{macro}{\settocdata}
-% Written to the |.toc| or |.lof| file, assigns \cs{thistocdata}:
+% Written to the |.toc| or |.lof| file, assigns \cs{TD@thistocdata}:
% \begin{macrocode}
\newcommand{\settocdata}[1]{\renewcommand{\TD@thistocdata}{#1}}
% \end{macrocode}
@@ -643,6 +748,58 @@ Keywords={LaTeX, tocdata, contents}%
% \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}.}
+%
+% \begin{macro}{\@dottedtocline} Patched for \pkg{tocdata}.
+% \begin{macrocode}
+\xpatchcmd{\@dottedtocline}
+ {\hfill\nobreak}
+ {\hfill\TD@usetocdata\nobreak}
+ {}%
+ {%
+ \PackageWarningNoLine{tocdata}{%
+ Could not patch LaTeX core \protect\@dottedtocline.\MessageBreak
+ Authors will not appear in TOC, LOF}
+ }%
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\l@part} Patched for \pkg{tocdata}.
+% \begin{macrocode}
+\xpatchcmd{\l@part}
+ {\hfil}
+ {\hfil\TD@usetocdata}
+ {}%
+ {%
+ \PackageWarningNoLine{tocdata}{%
+ Could not patch LaTeX core \protect\l@part.\MessageBreak
+ Authors will not appear in TOC parts}
+ }%
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\l@chapter} Patched for \pkg{tocdata}.
+% \begin{macrocode}
+\@ifundefined{chapter}
+{}
+{
+\xpatchcmd{\l@chapter}
+ {\hfil\nobreak}
+ {\hfil\TD@usetocdata\nobreak}
+ {}%
+ {%
+ \PackageWarningNoLine{tocdata}{%
+ Could not patch LaTeX core \protect\l@chapter.\MessageBreak
+ Authors will not appear in TOC chapters}
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+
+
% \subsection{\pkg{titletoc} support}
%
% \begin{figure}
@@ -650,19 +807,22 @@ Keywords={LaTeX, tocdata, contents}%
% \setlength{\fboxsep}{2ex}
%
% {\fontsize{140}{160}\selectfont$\pi$}
-% \captionartist{Pi --- A Work of Art\label{fig:workofart}}{Greek}{Alphabet}
+% \captionartist{Pi\label{fig:workofart}}{Greek}{Alphabet}
% \end{figure}
%
%
% If \pkg{titletoc} is loaded, patch macros for its use:
+% \changes{v2.00}{2019/03/13}{Patches \cs{AtBeginDocument}.}
% \begin{macrocode}
+\AtBeginDocument{
\@ifpackageloaded{titletoc}{
% \end{macrocode}
%
% \DescribeMacro{\titlecontents}
% A set of \pkg{titletoc} commands which set up the formatting of the
-% \acro{TOC} entries. These are patched to include the tocdata just after
+% \acro{TOC} entries. These are patched \cs{AtBeginDocument},
+% after user customizations in the preamble, to include the tocdata just after
% the leader (|titlerule*|), and just before the page number.
%
% These macros also include spacing commands, and thus may need to be
@@ -672,79 +832,80 @@ Keywords={LaTeX, tocdata, contents}%
% is not patched for use with \pkg{tocdata}. Use \cs{titlecontents} instead,
% \watchout[\cs{dottedcontents}]
% inserting the \cs{TD@usetocdata} macro as shown below.
-% \begin{macrocode}
-\@ifundefined{chapter}
-{}
-{
-\titlecontents{chapter}[0em]{}{\contentslabel{2.5em}}{}{%
-% \dotfill
-\titlerule*[.75pc]{.}%
%
-% \end{macrocode}
-% The new patch goes here:
-% \begin{macrocode}
-\TD@usetocdata% <-- newly added for the tocdata package
+% 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}
+% was used, no warnings are printed if the patch fails.
+%
+% \changes{v2.00}{2019/03/13}{Improved patches for \pkg{titletoc}.}
%
-\contentspage}[\vspace{-.5ex}]%
-}
-% \end{macrocode}
-% Likewise for sections:
-% \begin{macrocode}
-\titlecontents{section}[2.5em]{}{\contentslabel{2.5em}}{}{%
-% \dotfill
-\titlerule*[.75pc]{.}%
-\TD@usetocdata%
-\contentspage}[\vspace{-.5ex}]%
-% \end{macrocode}
-% Likewise for figures:
% \begin{macrocode}
-\titlecontents{figure}[0em]{}{\contentslabel{3em}}{}{%
-% \dotfill
-\titlerule*[1pc]{.}%
-\TD@usetocdata%
-\contentspage}[\vspace{-.5ex}]%
-% \end{macrocode}
+\newcommand*{\TD@titletoc@patch}[1]{%
+ \expandafter\xpatchcmd\csname ttl@savel@#1\endcsname
+ {\nobreak\hfil\nobreak}
+ {\nobreak\hfil\TD@usetocdata\nobreak}
+ {}
+ {}
+ \expandafter\xpatchcmd\csname l@#1\endcsname
+ {\contentspage}
+ {\TD@usetocdata\contentspage}
+ {}
+ {}
+}
-% \begin{macrocode}
+\TD@titletoc@patch{part}
+\@ifundefined{chapter}{}{\TD@titletoc@patch{chapter}}
+\TD@titletoc@patch{section}
+\TD@titletoc@patch{subsection}
+\TD@titletoc@patch{subsubsection}
+\TD@titletoc@patch{paragraph}
+\TD@titletoc@patch{subparagraph}
+\TD@titletoc@patch{figure}
+\TD@titletoc@patch{table}
}% end of titletoc loaded
{% titletoc is not loaded
}% end of \@ifpackageloaded{titletoc}
+}% end of \AtBeginDocument
% \end{macrocode}
% \subsection{\pkg{tocloft} support}
%
% If \pkg{tocloft} is loaded, the following patches are applied:
+% \changes{v2.00}{2019/03/13}{Patches \cs{AtBeginDocument}.}
% \begin{macrocode}
+\AtBeginDocument{
\@ifpackageloaded{tocloft}
{
% \end{macrocode}
-% If the documentclass includes a chapter level:
-% \begin{macrocode}
-\if@cfthaschapter
-% \end{macrocode}
+%
% \DescribeMacro{\cftXleader} A set of commands used by \cs{tocloft} to
-% typeset the leader between the title and the page number.
-% These are patched to print the tocdata just after the leader.
+% typeset the leader between the title and the page number.
+% These are patched to print the tocdata just after the leader.
+%
+% \changes{v2.00}{2019/03/13}{Improved patches for \pkg{tocloft}.}
% \begin{macrocode}
-\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftchapdotsep}\TD@usetocdata}
-\renewcommand{\cftsecleader}{\normalfont\cftdotfill{\cftsecdotsep}\TD@usetocdata}
-\renewcommand{\cftfigleader}{\normalfont\cftdotfill{\cftfigdotsep}\TD@usetocdata}
-\else
+\appto{\cftpartleader}{\TD@usetocdata}
+\if@cfthaschapter
+ \appto{\cftchapleader}{\TD@usetocdata}
+\fi
+\appto{\cftsecleader}{\TD@usetocdata}
+\appto{\cftsubsecleader}{\TD@usetocdata}
+\appto{\cftsubsubsecleader}{\TD@usetocdata}
+\appto{\cftparaleader}{\TD@usetocdata}
+\appto{\cftsubparaleader}{\TD@usetocdata}
+\appto{\cftfigleader}{\TD@usetocdata}
+\appto{\cfttableader}{\TD@usetocdata}
+\appto{\cftsubfigleader}{\TD@usetocdata}
+\appto{\cftsubtableader}{\TD@usetocdata}
% \end{macrocode}
-% If there is no chapter level:
+
% \begin{macrocode}
-\renewcommand{\cftsecleader}{\bfseries\cftdotfill{\cftsecdotsep}\TD@usetocdata}
-\renewcommand{\cftfigleader}{\normalfont\cftdotfill{\cftfigdotsep}\TD@usetocdata}
-\fi
}% end of tocloft patches
{}% tocloft not loaded
+}% \AtBeginDocument
% \end{macrocode}
-
-% It is possible to patch the regular \LaTeX{} code here.
-% Look at |book.cls| and |article.cls|,
-% for the macros \cs{l@chapter} and \cs{l@section}, and look in the \LaTeX{}
-% |source2e.pdf| for \cs{\@dottedtocline}.
%
%
%
@@ -765,7 +926,8 @@ Keywords={LaTeX, tocdata, contents}%
%
% These macros are in addition to the standard sectioning and caption commands,
% adding first and last names for the table of contents and list of figures.
-% For chapters and sections, the author's name with optional prefix and suffix
+% For parts, chapters, sections, and subsections,
+% the author's name with optional prefix and suffix
% are also added below the title.
% For figures, \cs{captionauthor} also prints the figure's artist's
% name with optional prefix and suffix just below the figure.
@@ -792,93 +954,142 @@ Keywords={LaTeX, tocdata, contents}%
% \end{macro}
%
%
-% \begin{macro}{\tocdatachapprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
-% User-redefinable macro to print the author's name underneath the chapter title.
+%
+% \begin{macro}{\tocdatapartprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
+%
+% User-redefinable macro to print the author's name underneath the part title.
%
% \changes{v0.12}{2016/11/29}{Improved spacing.}
+% \changes{v2.00}{2019/03/15}{Added.}
+%
+% \begin{macrocode}
+\newcommand{\tocdatapartprint}[4]
+{%
+ \par\unskip\noindent%
+ {%
+ \normalfont\normalsize%
+ \textit{%
+ \hspace*{4em}--- %
+ \TD@optionalname{#1}\TD@optionalname{#2}#3#4%
+ }%
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tocdatachapterprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
+%
+% User-redefinable macro to print the author's name underneath the chapter title.
+%
+% \changes{v2.00}{2019/03/15}{Renamed from \cs{tocdatachapprint}.}
%
% \begin{macrocode}
\@ifundefined{chapter}
{}% if no chapters
{% only of chapters exists in this documentclass:
-\newcommand{\tocdatachapprint}[4]
-{%
- \newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- %
- \TD@optionalname{#1}\TD@optionalname{#2}#3#4}}%
-}
+ \let\tocdatachapterprint\tocdatapartprint
}% end of chapters-only
% \end{macrocode}
-% To remove the author's name, redefine this as a null function taking four arguments:
-% \begin{sourceverb}
-% \renewcommand{\tocdatachapprint}[4]{}
-% \end{sourceverb}
% \end{macro}
%
-% \begin{macro}{\tocdatasecprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
+%
+% \begin{macro}{\tocdatasectionprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the section title.
%
-% \changes{v0.12}{2016/11/29}{Improved spacing.}
+% \changes{v2.00}{2019/03/15}{Renamed from \cs{tocdatasecprint}.}
%
% \begin{macrocode}
-\newcommand{\tocdatasecprint}[4]
-{%
- \newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- %
- \TD@optionalname{#1}\TD@optionalname{#2}#3#4}%
-}%
-}
+\let\tocdatasectionprint\tocdatapartprint
% \end{macrocode}
-% To remove the author's name, redefine this as a null function taking four arguments:
-% \begin{sourceverb}
-% \renewcommand{\tocdatasecprint}[4]{}
-% \end{sourceverb}
% \end{macro}
%
%
+% \begin{macro}{\tocdatasubsectionprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
-% \begin{macro}{\tocdatafigprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
+% User-redefinable macro to print the author's name underneath the subsection title.
%
-% User-redefinable macro to print the artist's name underneath the figure.
+% \changes{v2.00}{2019/03/15}{Added.}
+% \begin{macrocode}
+\let\tocdatasubsectionprint\tocdatapartprint
+% \end{macrocode}
+% \end{macro}
%
-% \changes{v0.12}{2016/11/29}{Improved spacing.}
-% \changes{v0.12}{2016/11/30}{Added name alignment.}
+%
+% \begin{macro}{\TD@artistauthorprint} \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.}
%
% \begin{macrocode}
-\newcommand{\tocdatafigprint}[4]{%
- \addvspace{2ex}%
+\newcommand{\TD@artistauthorprint}[5]{%
\begin{minipage}{\linewidth}%
- \TD@namealign%
- \footnotesize\textsc{{\TD@optionalname{#1}\TD@optionalname{#2}#3#4}}%
+ \csuse{TD@#1align}%
+ \footnotesize\normalfont%
+ \textsc{{\TD@optionalname{#2}\TD@optionalname{#3}#4#5}}%
\end{minipage}%
\par%
\addvspace{2ex}%
}
% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\tocdataartistprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
+%
+% User-redefinable macro to print the artist's name underneath the figure.
+%
+% \changes{v0.12}{2016/11/29}{Improved spacing.}
+% \changes{v0.12}{2016/11/30}{Added name alignment.}
+% \changes{v2.00}{2019/03/14}{Added.}
+%
+% \begin{macrocode}
+\newcommand{\tocdataartistprint}{%
+ \par\addvspace{\medskipamount}%
+ \TD@artistauthorprint{artist}%
+}
+% \end{macrocode}
% To remove the artist's name, redefine this as a null function taking four arguments:
% \begin{sourceverb}
-% \renewcommand{\tocdatafigprint}[4]{}
+% \renewcommand{\tocdataartistprint}[4]{}
% \end{sourceverb}
% \end{macro}
%
%
+% \begin{macro}{\tocdataauthorprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
-% \begin{macro}{\tocdatafigtextprint} \marg{first} \marg{last}
+% User-redefinable macro to print the author's name underneath the figure.
%
-% User-redefinable macro to print the artist's name underneath the figure.
+% \changes{v2.00}{2019/03/14}{Added.}
%
+% \begin{macrocode}
+\newcommand{\tocdataauthorprint}{%
+ \par\unskip
+ \TD@artistauthorprint{author}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\TD@artistauthortextprint}
+% \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}.}
% \begin{macrocode}
-\newcommand{\tocdatafigtextprint}[1]{%
+\newcommand{\TD@artistauthortextprint}[2]{%
\addvspace{2ex}%
\begin{minipage}{\linewidth}%
- \TD@textalign%
- \footnotesize%
+ \csuse{TD@#1textalign}%
+ \footnotesize\normalfont%
\setlength{\parskip}{1.5ex}%
\setlength{\parindent}{0em}%
- #1%
+ #2%
\end{minipage}%
\par%
\addvspace{2ex}%
@@ -887,208 +1098,331 @@ Keywords={LaTeX, tocdata, contents}%
% \end{macro}
%
%
+% \begin{macro}{\tocdataartisttextprint} \marg{text}
+%
+% User-redefinable macro to print the optional text below the artist's name.
+%
+%
+% \begin{macrocode}
+\newcommand{\tocdataartisttextprint}{\TD@artistauthortextprint{artist}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tocdataauthortextprint} \marg{text}
+%
+% User-redefinable macro to print the optional text below the author's name.
+%
+% \begin{macrocode}
+\newcommand{\tocdataauthortextprint}{\TD@artistauthortextprint{author}}
+% \end{macrocode}
+% \end{macro}
+%
+%
%
% \subsubsection{Chapters and sections}
%
-% \begin{macro}{\chapterauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
-% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
+% \begin{macro}{\TD@sectionauthor}
+% \marg{1: section type}
+% *
+% \oarg{3: \TOC\ entry} \marg{4: title}
+% \oarg{5: prefix} \marg{6: first} \marg{7: last} \oarg{8: suffix}
%
% \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.}
% \begin{macrocode}
-\@ifundefined{chapter}
-{}% if no chapters
-{% only of chapters exists in this documentclass:
-\NewDocumentCommand{\chapterauthor}{s o m O{} m m O{}}{%
+\NewDocumentCommand{\TD@sectionauthor}{m s o m O{} m m O{}}{%
% \end{macrocode}
% The starred version does not create a \acro{TOC} entry,
-% so it is used as-is:
+% so it is simply used as-is:
% \begin{macrocode}
- \IfBooleanTF{#1}%
- {% star:
- \chapter*{#3\tocdatachapprint{#4}{#5}{#6}{#7}}%
- }%
+ \IfBooleanTF{#2}%
+ {% star:
+ \csuse{#1}*{#4\nopagebreak\tocdatasectionprint{#5}{#6}{#7}{#8}}%
+ }%
% \end{macrocode}
% The un-starred version appears in the \acro{TOC}, so add the author's name:
% \begin{macrocode}
- {% no star:
- \tocdata{toc}{#5 #6}%
+ {% no star:
+ \tocdata{toc}{#6 #7}%
% \end{macrocode}
-% Create the chapter depending on the optional name:
+% Create the section depending on the optional name:
% \begin{macrocode}
- \IfValueTF{#2}%
- {\chapter[#2]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}%
- {\chapter[#3]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}%
- }%
+ \IfValueTF{#3}%
+ {\csuse{#1}[#3]{#4\nopagebreak\tocdatasectionprint{#5}{#6}{#7}{#8}}}%
+ {\csuse{#1}[#4]{#4\nopagebreak\tocdatasectionprint{#5}{#6}{#7}{#8}}}%
+ }% no star
% \end{macrocode}
% Create an index entry depending on whether there is a first name:
% \begin{macrocode}
- \ifblank{#5}%
- {\index{#6}}%
- {\index{#6, #5}}%
-}% end of \chapterauthor
-}% end of \@ifundefined{chapter}
+ \ifblank{#6}%
+ {\index{#7}}%
+ {\index{#7, #6}}%
+}
% \end{macrocode}
% \end{macro}
-
-
+%
+%
+% \begin{macro}{\partauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
+% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
+%
+% \changes{v2.00}{2019/03/15}{Added.}
+%
+% \begin{macrocode}
+\newcommand*{\partauthor}{\TD@sectionauthor{part}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{macro}{\chapterauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
+% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
+%
+% \begin{macrocode}
+\@ifundefined{chapter}
+{}% if no chapters
+{% only of chapters exists in this documentclass:
+ \newcommand*{\chapterauthor}{\TD@sectionauthor{chapter}}
+}
+% \end{macrocode}
+% \end{macro}
+%
+%
% \begin{macro}{\sectionauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
%
-% \changes{v0.12}{2016/11/28}{Expands first name before index check.}
% \begin{macrocode}
-\NewDocumentCommand{\sectionauthor}{s o m O{} m m O{}}{%
+\newcommand*{\sectionauthor}{\TD@sectionauthor{section}}
% \end{macrocode}
-% The starred version does not create a \acro{TOC} entry,
-% so it is simply used as-is:
+% \end{macro}
+%
+%
+% \begin{macro}{\subsectionauthor} * \oarg{2: \TOC\ entry} \marg{3: title}
+% \oarg{4: prefix} \marg{5: first} \marg{6: last} \oarg{7: suffix}
+%
+% \changes{v2.00}{2019/03/15}{Added.}
+%
% \begin{macrocode}
- \IfBooleanTF{#1}%
- {% star:
- \section*{#3\tocdatasecprint{#4}{#5}{#6}{#7}}%
- }%
+\newcommand*{\subsectionauthor}{\TD@sectionauthor{subsection}}
% \end{macrocode}
-% The un-starred version appears in the \acro{TOC}, so add the author's name:
+% \end{macro}
+%
+%
+%
+% \subsubsection{Figure artist name alignment}
+%
+% \changes{v2.00}{2019/03/14}{Replaced \cs{tdnameX} with
+% \cs{tdauthorX} and \cs{tdartistX}.}
+%
+% \begin{macro}{\TD@artistalign} Sets text alignment for the artist's name.
% \begin{macrocode}
- {% no star:
- \tocdata{toc}{#5 #6}%
+\newcommand{\TD@artistalign}{\centering}
% \end{macrocode}
-% Create the section depending on the optional name:
+% \end{macro}
+%
+% \begin{macro}{\tdartistjustify} Sets justified text alignment for the artist's name.
+% \changes{v0.12}{2016/11/30}{etc. Added name alignment.}
% \begin{macrocode}
- \IfValueTF{#2}%
- {\section[#2]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}%
- {\section[#3]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}%
- }% no star
+\newcommand{\tdartistjustify}{%
+ \renewcommand{\TD@artistalign}{}%
+}
% \end{macrocode}
-% Create an index entry depending on whether there is a first name:
+% \end{macro}
+%
+% \begin{macro}{\tdartistcenter} Sets centered text alignment for the artist's name.
% \begin{macrocode}
- \ifblank{#5}%
- {\index{#6}}%
- {\index{#6, #5}}%
+\newcommand{\tdartistcenter}{%
+ \renewcommand{\TD@artistalign}{\centering}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tdartistleft} Sets left text alignment for the artist's name.
+% \begin{macrocode}
+\newcommand{\tdartistleft}{%
+ \renewcommand{\TD@artistalign}{\raggedright}%
}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\tdartistright} Sets right text alignment for the artist's name.
+% \begin{macrocode}
+\newcommand{\tdartistright}{%
+ \renewcommand{\TD@artistalign}{\raggedleft}%
+}
+% \end{macrocode}
+% \end{macro}
%
%
-% \subsubsection{Figure name alignment}
+% \subsubsection{Figure author name alignment}
%
-% \begin{macro}{\TD@namealign} Sets text alignment in the optional text.
+% \begin{macro}{\TD@authoralign} Sets text alignment for the author's name.
% \begin{macrocode}
-\newcommand{\TD@namealign}{\centering}
+\newcommand{\TD@authoralign}{\raggedleft}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\tdnamejustify} Sets justified text alignment in the optional text.
+% \begin{macro}{\tdauthorjustify} Sets justified text alignment for the author's name.
% \changes{v0.12}{2016/11/30}{etc. Added name alignment.}
% \begin{macrocode}
-\newcommand{\tdnamejustify}{%
- \renewcommand{\TD@namealign}{}%
+\newcommand{\tdauthorjustify}{%
+ \renewcommand{\TD@authoralign}{}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{tdnamecenter} Sets centered text alignment in the optional text.
+% \begin{macro}{\tdauthorcenter} Sets centered text alignment for the author's name.
% \begin{macrocode}
-\newcommand{\tdnamecenter}{%
- \renewcommand{\TD@namealign}{\centering}%
+\newcommand{\tdauthorcenter}{%
+ \renewcommand{\TD@authoralign}{\centering}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{tdnameleft} Sets left text alignment in the optional text.
+% \begin{macro}{\tdauthorleft} Sets left text alignment for the author's name.
% \begin{macrocode}
-\newcommand{\tdnameleft}{%
- \renewcommand{\TD@namealign}{\raggedright}%
+\newcommand{\tdauthorleft}{%
+ \renewcommand{\TD@authoralign}{\raggedright}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{tdnameright} Sets right text alignment in the optional text.
+% \begin{macro}{\tdauthorright} Sets right text alignment for the author's name.
% \begin{macrocode}
-\newcommand{\tdnameright}{%
- \renewcommand{\TD@namealign}{\raggedleft}%
+\newcommand{\tdauthorright}{%
+ \renewcommand{\TD@authoralign}{\raggedleft}%
}
% \end{macrocode}
% \end{macro}
%
%
-% \subsubsection{Figure text alignment}
+% \subsubsection{Figure artist text alignment}
%
-% \begin{macro}{\TD@textalign} Sets text alignment in the optional text.
+% \begin{macro}{\TD@artisttextalign} Sets text alignment in the optional text.
% \begin{macrocode}
-\newcommand{\TD@textalign}{\centering}
+\newcommand{\TD@artisttextalign}{\centering}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\tdtextjustify} Sets justified text alignment in the optional text.
+% \begin{macro}{\tdartisttextjustify} Sets justified text alignment in the optional text.
% \changes{v0.12}{2016/11/30}{etc. Added text alignment.}
% \begin{macrocode}
-\newcommand{\tdtextjustify}{%
- \renewcommand{\TD@textalign}{}%
+\newcommand{\tdartisttextjustify}{%
+ \renewcommand{\TD@artisttextalign}{}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{tdtextcenter} Sets centered text alignment in the optional text.
+% \begin{macro}{\tdartisttextcenter} Sets centered text alignment in the optional text.
% \begin{macrocode}
-\newcommand{\tdtextcenter}{%
- \renewcommand{\TD@textalign}{\centering}%
+\newcommand{\tdartisttextcenter}{%
+ \renewcommand{\TD@artisttextalign}{\centering}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{tdtextleft} Sets left text alignment in the optional text.
+% \begin{macro}{\tdartisttextleft} Sets left text alignment in the optional text.
% \begin{macrocode}
-\newcommand{\tdtextleft}{%
- \renewcommand{\TD@textalign}{\raggedright}%
+\newcommand{\tdartisttextleft}{%
+ \renewcommand{\TD@artisttextalign}{\raggedright}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{tdtextright} Sets right text alignment in the optional text.
+% \begin{macro}{\tdartisttextright} Sets right text alignment in the optional text.
% \begin{macrocode}
-\newcommand{\tdtextright}{%
- \renewcommand{\TD@textalign}{\raggedleft}%
+\newcommand{\tdartisttextright}{%
+ \renewcommand{\TD@artisttextalign}{\raggedleft}%
}
% \end{macrocode}
% \end{macro}
%
%
+% \subsubsection{Figure author text alignment}
+%
+% \begin{macro}{\TD@authortextalign} Sets text alignment in the optional text.
+% \begin{macrocode}
+\newcommand{\TD@authortextalign}{\centering}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tdauthortextjustify} Sets justified text alignment in the optional text.
+% \changes{v0.12}{2016/11/30}{etc. Added text alignment.}
+% \begin{macrocode}
+\newcommand{\tdauthortextjustify}{%
+ \renewcommand{\TD@authortextalign}{}%
+}
+% \end{macrocode}
+% \end{macro}
%
-% \subsubsection{Figures}
+% \begin{macro}{\tdauthortextcenter} Sets centered text alignment in the optional text.
+% \begin{macrocode}
+\newcommand{\tdauthortextcenter}{%
+ \renewcommand{\TD@authortextalign}{\centering}%
+}
+% \end{macrocode}
+% \end{macro}
%
-% \begin{macro}{\captionartist} * \oarg{2: \LOF\ entry} \marg{3: title}
-% \oarg{4: supplemental text}
-% \oarg{5: prefix} \marg{6: first} \\
-% \marg{7: last} \oarg{8: suffix}
+% \begin{macro}{\tdauthortextleft} Sets left text alignment in the optional text.
+% \begin{macrocode}
+\newcommand{\tdauthortextleft}{%
+ \renewcommand{\TD@authortextalign}{\raggedright}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\tdauthortextright} Sets right text alignment in the optional text.
+% \begin{macrocode}
+\newcommand{\tdauthortextright}{%
+ \renewcommand{\TD@authortextalign}{\raggedleft}%
+}
+% \end{macrocode}
+% \end{macro}
%
-% \changes{v0.12}{2016/11/28}{Allows paragraphs in add'l text.}
-% \changes{v0.12}{2016/11/28}{Expands first name before index check.}
%
-% This macro adds optional supplemental text, which will be printed below the
+%
+% \subsubsection{Figure captions with artists and authors}
+%
+% These macros adds optional supplemental text, which will be printed below the
% artist's name and above the caption, presuming that the caption is generated
% below the figure.
%
% If using the optional prefix, the optional text must also be given, even if it
% \watchout[Optional arguments]
% is empty. For example, use:
-% \begin{sourceverb}
-% \captionartist{Title}|\textcolor{red}{|[]|}|[Sir]{Isaac}{Newton}
-% \end{sourceverb}
+% \begin{sourcedisplay}
+% \cs{captionartist}\{Title\}\textcolor{red}{[]}[Sir]\{Isaac\}\{Newton\}
+% \end{sourcedisplay}
% If only one optional argument is given before the first name, it will be
% interpreted as the optional text, not as the optional prefix.
+%
+%
+% \begin{macro}{\TD@captionartistauthor}
+% \marg{1: "artist" or "author"}
+% *
+% \oarg{3: \LOF\ entry} \marg{4: title}
+% \oarg{5: supplemental text}
+% \oarg{6: prefix} \marg{7: first} \\
+% \marg{8: last} \oarg{9: suffix}
+%
+% Factored from \cs{captionartist} and \cs{captionauthor}, below.
+%
+% \changes{v0.12}{2016/11/28}{Allows paragraphs in add'l text.}
+% \changes{v0.12}{2016/11/28}{Expands first name before index check.}
+% \changes{v2.00}{2019/03/15}{Factored.}
+%
% \begin{macrocode}
-\NewDocumentCommand{\captionartist}{s o m +O{} O{} m m O{}}{%
+\NewDocumentCommand{\TD@captionartistauthor}{m s o m +O{} O{} m m O{}}{%
% \end{macrocode}
+%
% Print the artist's name next to the figure:
% \begin{macrocode}
- \par\addvspace{\medskipamount}%
- \tocdatafigprint{#5}{#6}{#7}{#8}%
+ \csuse{tocdata#1print}{#6}{#7}{#8}{#9}%
% \end{macrocode}
% If supplemental text is provided, print it below the author:
% \begin{macrocode}
- \ifblank{#4}%
+ \ifblank{#5}%
{}%
- {\par\tocdatafigtextprint{#4}}%
+ {\par\csuse{tocdata#1textprint}{#5}}%
% \end{macrocode}
% Remove any existing vertical space and only use \cs{caption}'s built-in spacing:
% \begin{macrocode}
@@ -1097,36 +1431,61 @@ Keywords={LaTeX, tocdata, contents}%
% If starred, there should be no \acro{TOC} entry, so do not add tocdata.
% Use \cs{caption*} from the \pkg{caption} or similar packages.
% \begin{macrocode}
- \IfBooleanTF{#1}%
+ \IfBooleanTF{#2}%
{% starred
- \IfValueTF{#2}{\caption*[#2]{#3}}{\caption*{#3}}%
+ \IfValueTF{#3}{\caption*[#3]{#4}}{\caption*{#4}}%
}% starred
{% not starred
% \end{macrocode}
% No starred, so remember the artist's name for inclusion in the \acro{LOF}:
+% \changes{v2.00}{2019/03/14}{Added support for new float types.}
% \begin{macrocode}
- \tocdata{lof}{#6 #7}%
+ \tocdata{\csuse{ext@\@captype}}{#7 #8}%
% \end{macrocode}
% Create the caption depending on the optional name:
% \begin{macrocode}
- \IfValueTF{#2}{\caption[#2]{#3}}{\caption{#3}}%
+ \IfValueTF{#3}{\caption[#3]{#4}}{\caption{#4}}%
}% not starred
% \end{macrocode}
% Create an index entry depending on whether there is a first name:
% \begin{macrocode}
- \ifblank{#6}%
- {\index{#7}}%
- {\index{#7, #6}}%
+ \ifblank{#7}%
+ {\index{#8}}%
+ {\index{#8, #7}}%
}
% \end{macrocode}
% \end{macro}
%
-% \begin{figure}[hbp]
+%
+% \begin{macro}{\captionartist} * \oarg{2: \LOF\ entry} \marg{3: title}
+% \oarg{4: supplemental text}
+% \oarg{5: prefix} \marg{6: first} \\
+% \marg{7: last} \oarg{8: suffix}
+%
+% \begin{macrocode}
+\newcommand*{\captionartist}{\TD@captionartistauthor{artist}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\captionauthor} * \oarg{2: \LOF\ entry} \marg{3: title}
+% \oarg{4: supplemental text}
+% \oarg{5: prefix} \marg{6: first} \\
+% \marg{7: last} \oarg{8: suffix}
+%
+% \begin{macrocode}
+\newcommand*{\captionauthor}{\TD@captionartistauthor{author}}
+% \end{macrocode}
+% \end{macro}
+%
+%
+% \begin{illustration}
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[width=4in]{lacquer_go_board.jpg}}
% \captionartist{Lacquer Go Board}[From the series \textit{Uma Zukushi}.]{Katsushika}{Hokusai}
-% \end{figure}
+% \end{illustration}
+%
+%
%
%
%