<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse meta-comment
%
% Copyright 2016--2024 Brian Dunn
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse
%&lt;package&gt;\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%&lt;package&gt;\ProvidesPackage{tocdata}
%&lt;package&gt;    [2024/01/20 v2.07 Adds author/artist to TOC entries.]
%
%&lt;*driver&gt;
\documentclass{ltxdoc}


\newcommand{\mypackagename}{tocdata}

\newcommand{\quicksummary}{%
Optionally prints author, artist, or other data on a line
of the \acro{TOC}\Slash\acro{LOF}.
}


% \usepackage{lmodern}
\usepackage{erewhon}
\usepackage{cabin}
\usepackage{inconsolata}
% \usepackage{libertine}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}	% provides \degree, \textquotesingle, \textmu
\usepackage{textgreek}

\usepackage{newunicodechar}
\newunicodechar{���}{ff}
\newunicodechar{���}{fi}
\newunicodechar{���}{fl}
\newunicodechar{���}{ffi}
\newunicodechar{���}{ffl}
% \newunicodechar{��}{\degree}
\newunicodechar{��}{\ensuremath{\rho}}
\newunicodechar{���}{\texttimes}
\newunicodechar{���}{\textfractionsolidus}
% \newunicodechar{��}{\textregistered}
% \newunicodechar{��}{\textcopyright}
\newunicodechar{���}{---}
\newunicodechar{���}{--}
% \newunicodechar{���}{''}
% \newunicodechar{���}{``}
% \newunicodechar{��}{\S}
% \newunicodechar{��}{\P}
% \newunicodechar{���}{\dag}
\newunicodechar{���}{\ddag}

\usepackage{metalogo}
\makeatletter
\@ifpackageloaded{erewhon}{
\setlogokern{Te}{-.08em}
\setlogokern{eX}{-0.04em}
\setlogokern{La}{-.25em}
\setlogokern{aT}{-.08em}
\setlogokern{Xe}{-.04em}
\setlogokern{eL}{-.06em}
\setlogodrop{0.27ex}
}{}
\makeatother

\usepackage{microtype}

\usepackage{etoolbox}

\usepackage[log-declarations=false]{xparse}

\usepackage[svgnames]{xcolor}
\definecolor{myurlcolor}{rgb}{0,0,.7}
\definecolor{mylinkcolor}{rgb}{.7,0,0}
\definecolor{codecolor}{rgb}{0,.4,.2}
\definecolor{overviewcolor}{rgb}{0,.2,.4}

\usepackage{dtxdescribe}[2023/01/03]

\usepackage{graphicx}
\graphicspath{{images/}}

\usepackage{enumitem}

\usepackage{array}
\usepackage{longtable}
\usepackage{booktabs}

\usepackage[all,defaultlines=2]{nowidow}

\usepackage[normalem]{ulem}

\usepackage{fancyvrb}


\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}



\usepackage{titletoc}
% \usepackage{tocloft}


\usepackage{titleps}

\newpagestyle{pageheadfoot}{
	\headrule
	\sethead{\pkg{\mypackagename}}{}{\thepage}
% 	\renewcommand{\makefootrule}{\rule[2.5ex]{\linewidth}{.4pt}}
	\setfoot{}{}{}
}

\pagestyle{pageheadfoot}

\usepackage{needspace}



\AtBeginDocument{
\hypersetup{%
pdfinfo={%
Title={LaTeX \mypackagename{} package},%
Author={Brian Dunn},%
Subject={LaTeX tocdata package},%
Keywords={LaTeX, tocdata, contents},%
},%
colorlinks,%
linkcolor=mylinkcolor,%
urlcolor=myurlcolor,%
pageanchor=true,
}

\pdfstringdefDisableCommands{
\def\quad{ }
\def\\{ }
\def\pkg#1{#1}
\def\cs#1{\textbackslash#1}
\def\env#1{#1}
\def\,{ }
\def\prog#1{#1}
\def\LuaLaTeX{LuaLaTeX}
\def\XeLaTeX{XeLaTeX}
\def\TeX{TeX}
\def\LaTeX{LaTeX}
\def\Dash{ --- }
\def\dash{ -- }
\def\element#1{#1}
\def\attribute#1{#1}
}

}% AtBeginDocument

\AddToHook{begindocument/before}{% Before .aux file is loaded.
  \usepackage{cleveref}%                  If needed.
}


% from dtxdescribe:
\setlength{\marginparsep}{1em}
\setlength{\marginparpush}{.7ex}



\setlength{\parindent}{2em}
\setlength{\parskip}{0ex}

\setlength{\IndexMin}{40ex}



\setcounter{IndexColumns}{2}
\setcounter{GlossaryColumns}{1}

\DisableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{\mypackagename.dtx}
\end{document}
%&lt;/driver&gt;
% \fi
%

% \changes{v0.10}{2016/05/05}{\ 2016/05/05 Initial ver.}
% \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/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}
% \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}
% \changes{v2.04}{2020/07/15}{\ 2020/07/15}
% \changes{v2.05}{2023/01/03}{Docs updated for \pkg{dtxdescribe}.}
% \changes{v2.05}{2023/01/03}{\ 2023/01/03}
% \changes{v2.06}{2024/01/12}{\ 2024/01/12}
% \changes{v2.06}{2024/01/12}{Changed contact info.}
% \changes{v2.07}{2024/01/18}{Docs: Improved TOC change log and index entries.}
% \changes{v2.07}{2024/01/20}{Docs: Removed extra spaces.}
% \changes{v2.07}{2024/01/20}{2024/01/20}



% \GetFileInfo{\mypackagename.sty}
%
% \DoNotIndex{\newcommand,\renewcommand,\addtocounter,\begin,\end,\begingroup,\endgroup}
% \DoNotIndex{\global,\ifbool,\ifthenelse,\isequivalentto,\let}
% \DoNotIndex{\booltrue,\boolfalse}
% \expandafter\DoNotIndex\expandafter{\detokenize{\(,\),\,,\\,\#,\$,\%,\^,\_,\~,\ ,\&amp;,\{,\}}}
%
% ^^A \renewcommand{\listfigurename}{List of }
% \begin{center}
% \thispagestyle{empty}
% \vfill
% ^^A \includegraphics[width=.3\linewidth]{\mypackagename_logo.pdf}
% \vfill
% {\Huge The \pkg{\mypackagename} package}
% \bigskip
%
% \fileversion{} --- \filedate
%
% \bigskip
%
% {\small\textcopyright{} 2016--2024} Brian Dunn\\ \small \url{https://github.com/bdtc/tocdata}
%
% \vspace{.5in}
%
% {\normalsize\textup{\quicksummary}}
%
%
%
% \vfill
%
% \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 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.
%
% \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}
% \vspace*{\fill}
% \vspace*{\fill}
% \end{center}
%
% \clearpage
%
% \tableofcontents
% ^^A \clearpage
% \listoffigures
% ^^A \listoftables

% \needspace{6\baselineskip}
% \listofillustrations

% \listofaquotes
%
%
% \thispagestyle{pageheadfoot}
%
% \clearpage
%
% \sectionauthor{Introduction}{Brian}{Dunn}
%
% \begin{figure}
% \setlength{\fboxsep}{0pt}
% \centering
% \fbox{\includegraphics[width=2in]{go_problem.png}}
% \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.
%
% Many commonly-recommended methods for doing this with \LaTeX, such as those linked to in
% section \ref{sec:othermethods}, place the author above or below the title and
% page number, but seldom on the same line.
%
% 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 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 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 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}
%
% For other methods which place the author on a separate line from the title, see the
% following.
%
% Note that these methods will be preferable if a larger amount of information
% is to be placed for each title, such that it usually would not all fit on one line
% \watchout[Too much text!]
% in the table of contents.
%
% \href
%	{http://tex.stackexchange.com/questions/47554/add-authors-name-automatically-while-building-toc}
%	{http://tex.stackexchange.com/questions/ \\ \hspace*{1in} 47554/add-authors-name-automatically-while-building-toc}
%
% \href
%	{http://tex.stackexchange.com/questions/110218/add-author-before-chapter-title-in-toc}
%	{http://tex.stackexchange.com/questions/ \\ \hspace*{1in} 110218/add-author-before-chapter-title-in-toc}
%
% \href
%	{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{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{illustration}
%
% \clearpage
%
% \begin{figure}
% \centering
% \includegraphics[width=3in]{astronometer_herschel.jpg}
% \captionartist
%	{Astronometer\label{fig:astronometer}}
%	[Astronometer made to compare the light of certain stars by the intervention of the moon.]
%	[Sir]{John}{Herschel}[, 1st Baronet KH FRS]
% \end{figure}
%
% \sectionauthor{How to use \pkg{tocdata}}{Brian}{Dunn}
%
% This section shows how to use the \pkg{tocdata} package.
%
% There are several layers of macros:
% \begin{itemize}
% \item The lowest level provides the basic infrastructure for inserting information
% 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{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.
% \end{itemize}
%
%
% \subsection{Basic setup}
%
%
%
% \subsubsection{Preamble}
%
% \pkg{tocdata} may be used with either the \pkg{tocloft} or \pkg{titletoc} package,
% or neither.
%
% In the preamble, use:
%	\begin{sourceverb}
%   \usepackage{tocdata}
%   \usepackage{titletoc}% optional
%   \usepackage{tocloft}% optional
%	\end{sourceverb}
%
%
% \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{\tocdataformat} \marg{text}
%
% To control the font and formatting used for the author on the table-of-contents line,
% the default is:
%	\begin{sourceverb}
%	\newcommand{\tocdataformat}[1]{{\normalfont\textit{\small#1}}}
%	\end{sourceverb}
%
%	You may change to other font options, add parenetheses, etc.:
%	\begin{sourceverb}
%   \renewcommand{\tocdataformat}[1]{%
%       \normalfont\textsc{\footnotesize\qquad --- (#1)}%
%   }
%	\end{sourceverb}
%
%
% \subsubsection{Adding \acro{TOC} data per section}
%
% \DescribeMacro{\tocdata} \marg{list extension} \marg{text}
%
% Before each \cs{chapter} or \cs{section} which is to have an author or other data:
%
%	\begin{sourceverb}
%	\tocdata{toc}{Author's Name}
%	\chapter{Chapter Title}    -or-    \section{Section Title}
%	\end{sourceverb}
%
%
% \subsubsection{Adding \acro{LOF} data per figure}
% Before each \cs{caption} which is to have an artist or author:
%
%	\begin{sourceverb}
%	\tocdata{lof}{Artist's/Author's Name}
%	\caption{Figure Title}
%	\end{sourceverb}
%
%	You may wish to print the artist's name in the figure as well.
%
%
% \subsection{High-level user macros}
%
% Additional macros are given in section \ref{sec:usermacros}.
% 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 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}),
% and these will be printed at the section heading or caption, but not
% in the \acro{TOC}\Slash\acro{LOF} or in the index.
%
% These macros may be ignored or modified as needed.
%
% \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{part}:
% \begin{sourceverb}
% \partauthor[list entry]{Title}[Prefix]{First}{Last}[Suffix]
% \end{sourceverb}
% Likewise for chapters, sections, and subsections.
%
%
%
% \subsubsection{Figure captions with author \Slash artist names and additional text}
%
% \DescribeMacro{\captionartist}
% \DescribeMacro{\captionauthor}
% For figures, in the place of \cs{caption}, use:
%
% \begin{sourceverb}
% \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{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*} 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*} 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:\\
% \hspace*{1em} |\usepackage{caption}|
%
% \subsubsection{Formatting in sections and figures}
%
% \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{\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}
%
% \changes{v2.02}{2019/03/20}{Docs: Fix macro names.}
% \DescribeMacro{\tdartistjustify}
% \DescribeMacro{\tdartistcenter}
% \DescribeMacro{\tdartistleft}
% \DescribeMacro{\tdartistright}
% \DescribeMacro{\tdartisttextjustify}
% \DescribeMacro{\tdartisttextcenter}
% \DescribeMacro{\tdartisttextleft}
% \DescribeMacro{\tdartisttextright}
% \DescribeMacro{\tdauthorjustify}
% \DescribeMacro{\tdauthorcenter}
% \DescribeMacro{\tdauthorleft}
% \DescribeMacro{\tdauthorright}
% \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.
%
%
% \StopEventually{
% \appendix
% \GlossaryPrologue{\section{Change History}}
% \PrintChanges
% \IndexPrologue{\section{Index}}
% \tocdata{toc}{\prog{makeindex}}
% \PrintIndex
%
% \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}{Greek}{Alphabet}
% \end{figure}
%
%}
%
% \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{illustration}
%
% 
% \clearpage
%
% \sectionauthor{Code}{Brian}{Dunn}
%
% \begin{figure}
% \centering
% \includegraphics[width=3in]{diagram_sunbeam.jpg}
% \captionartist
%	{Diagram of a Sunbeam}[]
%	[Sir]{Isaac}{Newton}
% \end{figure}
%
% Below, the \pkg{tocdata} code section contains the low-level code used to
% 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 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.
%
%
% \subsection{Requirements}
%
% \changes{v0.12}{2016/12/02}{Added requirement for \pkg{xifthen}.}
% \changes{v1.00}{2019/01/08}{Remove \pkg{xifthen} dependency.}
%
%    \begin{macrocode}
\RequirePackage{xparse}
\RequirePackage{etoolbox}
\RequirePackage{xpatch}
%    \end{macrocode}


% 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}.}
% \changes{v2.03}{2019/07/04}{Added support for \pkg{memoir}.}
%    \begin{macrocode}
\@ifpackageloaded{titletoc}{
    \PackageError{tocdata}
        {%
            Load titletoc after tocdata%
        }
        {%
            Move \protect\usepackage{titletoc} after \protect\usepackage{tocdata}.%
        }
}{}

\@ifclassloaded{memoir}
{}% memoir
{% not memoir

\@ifpackageloaded{tocloft}{
    \PackageError{tocdata}
        {%
            Load tocloft after tocdata%
        }
        {%
            Move \protect\usepackage{tocloft} after \protect\usepackage{tocdata}.%
        }
}{}

}% not memoir
%    \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.\MessageBreak
                Load only one%
            }
            {%
                The tocdata package may use the default LaTeX formatting,\MessageBreak
                or either one of titletoc or tocloft.
            }
    }{}
}{}
}
%    \end{macrocode}



% \subsection{\pkg{tocdata} code}
% \begin{macro}{\TD@thistocdata}
% Storage for the data to be added to the end of the \acro{TOC} entry:
%    \begin{macrocode}
\newcommand{\TD@thistocdata}{}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\settocdata}
% Written to the |.toc| or |.lof| file, assigns \cs{TD@thistocdata}:
%    \begin{macrocode}
\newcommand{\settocdata}[1]{\renewcommand{\TD@thistocdata}{#1}}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\tocdata} \marg{|toc| or |lof|} \marg{text}
%
% To be called by a higher-level macro to assign data to a |.toc| or |.lof| file:
%    \begin{macrocode}
\newcommand{\tocdata}[2]{%
    \@bsphack\addtocontents{#1}{\protect\settocdata{#2}}\@esphack%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdatafont} \marg{text} \qquad
% Provided for compatibility with older documents.
% Instead, use and redefine \cs{tocdataformat} for newer documents.
% \watchout[deprecated]
%
%    \begin{macrocode}
\newcommand{\tocdatafont}[1]{{\normalfont\textit{\small#1}}}
%    \end{macrocode}
% \end{macro}
%
%
% \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}
\def\tocdataformat{\tocdatafont}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\TD@usetocdata}
%
% To be inserted into low-level \acro{TOC}-generation code where the data should appear.
%
% 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}{%
    \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}
\xpatchcmd{\@dottedtocline}
    {\hfill\nobreak}
    {\hfill\TD@usetocdata\nobreak}
    {}%
    {%
        \PackageWarningNoLine{tocdata}{%
            Could not patch LaTeX core \protect\@dottedtocline.\MessageBreak
            Authors may not appear in TOC, LOF}
    }%
%    \end{macrocode}
% \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}
    {}%
    {%
        \PackageWarningNoLine{tocdata}{%
            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}
\@ifclassloaded{memoir}{}{%
\@ifpackageloaded{tocbasic}{}{%
\@ifundefined{chapter}{}{%
\xpatchcmd{\l@chapter}
    {\hfil\nobreak}
    {\hfil\TD@usetocdata\nobreak}
    {}%
    {%
        \PackageWarningNoLine{tocdata}{%
            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}
    {}%
    {%
        \PackageWarningNoLine{tocdata}{%
            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}
%
% \begin{figure}
% \centering
% \setlength{\fboxsep}{2ex}
%
% {\fontsize{140}{160}\selectfont$\pi$}
% \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}.}
%    \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 \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
% redefined by the user.
%
% 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}.}
%
%    \begin{macrocode}
\newcommand*{\TD@titletoc@patch}[1]{%
    \expandafter\xpatchcmd\csname ttl@savel@#1\endcsname
        {\nobreak\hfil\nobreak}
        {\nobreak\hfil\TD@usetocdata\nobreak}
        {}
        {%
            \PackageWarningNoLine{tocdata}{%
                Could not patch titletoc ttl@savel@#1.\MessageBreak
                Authors may not appear in TOC, LOF}
        }
    \expandafter\xpatchcmd\csname l@#1\endcsname
        {\contentspage}
        {\TD@usetocdata\contentspage}
        {}
        {%
            \PackageWarningNoLine{tocdata}{%
                Could not patch titletoc l@#1.\MessageBreak
                Authors may not appear in TOC, LOF}
        }
}

\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} and \pkg{memoir} support}
%
% 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}
%
% \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.
%
% \changes{v2.00}{2019/03/13}{Improved patches for \pkg{tocloft}.}
%    \begin{macrocode}
\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}

%    \begin{macrocode}
}% end of tocloft patches
{}% tocloft not loaded
}% not memoir
}% \AtBeginDocument
%    \end{macrocode}
%
%
%
% \subsection{Koma-script \pkg{tocbasic} support}
%
% There is no easy way to patch this\dots
% \cs{TD@usetocdata} is inserted near the end of the following:
%
% \changes{v2.03}{2019/07/06}{Added support for \pkg{tocbasic}.}
% \changes{v2.04}{2020/07/15}{Updated for \pkg{tocbasic} v3.30.}
%
%    \begin{macrocode}
\AtBeginDocument{

\@ifpackageloaded{tocbasic}{
\xpatchcmd{\scr@dte@tocline}
    {%
        \nobreak
        \expandafter\let\expandafter\scr@dte@pagenumberwidth
    }
    {%
        \TD@usetocdata%     tocdata
        \nobreak
        \expandafter\let\expandafter\scr@dte@pagenumberwidth
    }
    {}
    {%
        \PackageWarningNoLine{tocdata}{%
            Could not patch tocbasic \protect\scr@dte@tocline.\MessageBreak
            Authors may not appear in TOC, LOF}
    }
}{}
}
%    \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
%
% \subsection{User-level macros}
% \label{sec:usermacros}
%
% \begin{figure}
% \centering
% \includegraphics[width=3in]{newton_astrolabe.jpg}
% \captionartist{Sir Isaac Newton's Astrolabe}[][Sir]{Isaac}{Newton}
% \end{figure}
%
%
% Example user-level macros follow.
%
% 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 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.
%
% The regular sectioning and caption commands may still be used for anything
% which does not have an author/artist name.
%
%
% \subsubsection{User customization}
%
%
% \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{\TDoptionalnameprint}[1]
{%
    \ifblank{#1}%
    {}%
    {#1~}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
%
% \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.}
% \changes{v2.03}{2019/07/04}{Removed \cs{unskip}.}
%
%    \begin{macrocode}
\newcommand{\tocdatapartprint}[4]
{%
    \par\noindent%
    {%
        \normalfont\normalsize%
        \textit{%
            \hspace*{4em}--- %
            \TDoptionalnameprint{#1}\TDoptionalnameprint{#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:
    \let\tocdatachapterprint\tocdatapartprint
}% end of chapters-only
%    \end{macrocode}
% \end{macro}
%
%
% \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{v2.00}{2019/03/15}{Renamed from \cs{tocdatasecprint}.}
%
%    \begin{macrocode}
\let\tocdatasectionprint\tocdatapartprint
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdatasubsectionprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the subsection title.
%
% \changes{v2.00}{2019/03/15}{Added.}
%    \begin{macrocode}
\let\tocdatasubsectionprint\tocdatapartprint
%    \end{macrocode}
% \end{macro}
%
%
% \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{\TDartistauthorprint}[5]{%
    \begin{minipage}{\linewidth}%
    \csuse{TD@#1align}%
    \footnotesize\normalfont%
    \textsc{{\TDoptionalnameprint{#2}\TDoptionalnameprint{#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.}
% \changes{v2.02}{2019/03/20}{Improved spacing.}
%
%    \begin{macrocode}
\newcommand{\tocdataartistprint}{%
    \par\smallskip%
    \TDartistauthorprint{artist}%
}
%    \end{macrocode}
% To remove the artist's name, redefine this as a null function taking four arguments:
% \begin{sourceverb}
% \renewcommand{\tocdataartistprint}[4]{}
% \end{sourceverb}
% \end{macro}
%
%
% \begin{macro}{\tocdataauthorprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix}
%
% User-redefinable macro to print the author's name underneath the figure.
%
% \changes{v2.00}{2019/03/14}{Added.}
% \changes{v2.02}{2019/03/20}{Improved spacing.}
%
%    \begin{macrocode}
\newcommand{\tocdataauthorprint}{%
    \par\smallskip%
    \TDartistauthorprint{author}%
}
%    \end{macrocode}
% \end{macro}
%
%
%
% \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{\TDartistauthortextprint}[2]{%
    \addvspace{2ex}%
    \begin{minipage}{\linewidth}%
    \csuse{TD@#1textalign}%
    \footnotesize\normalfont%
    \setlength{\parskip}{1.5ex}%
    \setlength{\parindent}{0em}%
    #2%
    \end{minipage}%
    \par%
    \addvspace{2ex}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \begin{macro}{\tocdataartisttextprint} \marg{text}
%
% User-redefinable macro to print the optional text below the artist's name.
%
%
%    \begin{macrocode}
\newcommand{\tocdataartisttextprint}{\TDartistauthortextprint{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}{\TDartistauthortextprint{author}}
%    \end{macrocode}
% \end{macro}
%
%
%
% \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}
%   *
%   \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.}
% \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}
% The starred version does not create a \acro{TOC} entry,
% so it is simply used as-is:
%    \begin{macrocode}
    \IfBooleanTF{#2}%
    {% star:
        \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:
%    \begin{macrocode}
    {% no star:
        \tocdata{toc}{#6 #7}%
%    \end{macrocode}
% Create the section depending on the optional name:
%    \begin{macrocode}
        \IfValueTF{#3}%
            {\csuse{#1}[#3]{#4\nopagebreak\csuse{tocdata#1print}{#5}{#6}{#7}{#8}}}%
            {\csuse{#1}[#4]{#4\nopagebreak\csuse{tocdata#1print}{#5}{#6}{#7}{#8}}}%
    }% no star
%    \end{macrocode}
% Create an index entry depending on whether there is a first name:
%    \begin{macrocode}
    \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}
%
%    \begin{macrocode}
\newcommand*{\sectionauthor}{\TD@sectionauthor{section}}
%    \end{macrocode}
% \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}
\newcommand*{\subsectionauthor}{\TD@sectionauthor{subsection}}
%    \end{macrocode}
% \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}
\newcommand{\TD@artistalign}{\centering}
%    \end{macrocode}
% \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}
\newcommand{\tdartistjustify}{%
    \renewcommand{\TD@artistalign}{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartistcenter} Sets centered text alignment for the artist's name.
%    \begin{macrocode}
\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 author name alignment}
%
% \begin{macro}{\TD@authoralign} Sets text alignment for the author's name.
%    \begin{macrocode}
\newcommand{\TD@authoralign}{\raggedleft}
%    \end{macrocode}
% \end{macro}
%
% \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{\tdauthorjustify}{%
    \renewcommand{\TD@authoralign}{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthorcenter} Sets centered text alignment for the author's name.
%    \begin{macrocode}
\newcommand{\tdauthorcenter}{%
    \renewcommand{\TD@authoralign}{\centering}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthorleft} Sets left text alignment for the author's name.
%    \begin{macrocode}
\newcommand{\tdauthorleft}{%
    \renewcommand{\TD@authoralign}{\raggedright}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdauthorright} Sets right text alignment for the author's name.
%    \begin{macrocode}
\newcommand{\tdauthorright}{%
    \renewcommand{\TD@authoralign}{\raggedleft}%
}
%    \end{macrocode}
% \end{macro}
%
%
% \subsubsection{Figure artist text alignment}
%
% \begin{macro}{\TD@artisttextalign} Sets text alignment in the optional text.
%    \begin{macrocode}
\newcommand{\TD@artisttextalign}{\centering}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextjustify} Sets justified text alignment in the optional text.
% \changes{v0.12}{2016/11/30}{etc. Added text alignment.}
%    \begin{macrocode}
\newcommand{\tdartisttextjustify}{%
    \renewcommand{\TD@artisttextalign}{}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextcenter} Sets centered text alignment in the optional text.
%    \begin{macrocode}
\newcommand{\tdartisttextcenter}{%
    \renewcommand{\TD@artisttextalign}{\centering}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextleft} Sets left text alignment in the optional text.
%    \begin{macrocode}
\newcommand{\tdartisttextleft}{%
    \renewcommand{\TD@artisttextalign}{\raggedright}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tdartisttextright} Sets right text alignment in the optional text.
%    \begin{macrocode}
\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}
%
% \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}{\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}
%
%
%
% \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{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{\TD@captionartistauthor}{m s o m +O{} O{} m m O{}}{%
%    \end{macrocode}
%
% Print the artist's name next to the figure:
%    \begin{macrocode}
    \csuse{tocdata#1print}{#6}{#7}{#8}{#9}%
%    \end{macrocode}
% If supplemental text is provided, print it below the author:
%    \begin{macrocode}
    \ifblank{#5}%
        {}%
        {\par\csuse{tocdata#1textprint}{#5}}%
%    \end{macrocode}
% Remove any existing vertical space and only use \cs{caption}'s built-in spacing:
%    \begin{macrocode}
    \unskip%
%    \end{macrocode}
% 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{#2}%
        {% starred
            \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{\csuse{ext@\@captype}}{#7 #8}%
%    \end{macrocode}
% Create the caption depending on the optional name:
%    \begin{macrocode}
            \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{#7}%
        {\index{#8}}%
        {\index{#8, #7}}%
}
%    \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{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{illustration}
%
%
%
%
%
%
% ^^A At end:
%
% \clearpage
% ^^A \pagestyle{plain}
%
% \pagestyle{plain}
%
% \Finale
\endinput
</pre></body></html>