From c863aff30c4781b9f67c22225b3322de7e3f25fa Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 2 Dec 2016 22:57:20 +0000 Subject: tocdata (2dec16) git-svn-id: svn://tug.org/texlive/trunk@42623 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/tocdata/README | 2 +- .../latex/tocdata/images/astronometer_herschel.jpg | Bin 0 -> 33077 bytes .../doc/latex/tocdata/images/diagram_sunbeam.jpg | Bin 0 -> 27831 bytes .../doc/latex/tocdata/images/engineer.jpg | Bin 0 -> 112492 bytes .../doc/latex/tocdata/images/go_problem.png | Bin 0 -> 28722 bytes .../doc/latex/tocdata/images/lacquer_go_board.jpg | Bin 0 -> 145545 bytes .../doc/latex/tocdata/images/newton_astrolabe.jpg | Bin 0 -> 92478 bytes .../texmf-dist/doc/latex/tocdata/images/quail.jpg | Bin 0 -> 196068 bytes .../doc/latex/tocdata/images/symbol_warning.pdf | Bin 0 -> 2271 bytes Master/texmf-dist/doc/latex/tocdata/tocdata.pdf | Bin 1061534 -> 1068702 bytes Master/texmf-dist/source/latex/tocdata/tocdata.dtx | 378 ++++++++++++++++----- Master/texmf-dist/tex/latex/tocdata/tocdata.sty | 129 ++++--- 12 files changed, 387 insertions(+), 122 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/astronometer_herschel.jpg create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/diagram_sunbeam.jpg create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/engineer.jpg create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/go_problem.png create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/lacquer_go_board.jpg create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/newton_astrolabe.jpg create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/quail.jpg create mode 100644 Master/texmf-dist/doc/latex/tocdata/images/symbol_warning.pdf diff --git a/Master/texmf-dist/doc/latex/tocdata/README b/Master/texmf-dist/doc/latex/tocdata/README index 5ee7f492818..c7c4b3b2410 100644 --- a/Master/texmf-dist/doc/latex/tocdata/README +++ b/Master/texmf-dist/doc/latex/tocdata/README @@ -1,7 +1,7 @@ The tocdata package Adds names to table of contents / list of figures entries. -v0.11 — 2016/07/11 +v0.12 — 2016/12/02 Copyright 2016 Brian Dunn — www.BDTechConcepts.com LaTeX Project Public License, version 1.3 diff --git a/Master/texmf-dist/doc/latex/tocdata/images/astronometer_herschel.jpg b/Master/texmf-dist/doc/latex/tocdata/images/astronometer_herschel.jpg new file mode 100644 index 00000000000..b2277547e0d Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/astronometer_herschel.jpg differ diff --git a/Master/texmf-dist/doc/latex/tocdata/images/diagram_sunbeam.jpg b/Master/texmf-dist/doc/latex/tocdata/images/diagram_sunbeam.jpg new file mode 100644 index 00000000000..bf2b07bc6f8 Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/diagram_sunbeam.jpg differ diff --git a/Master/texmf-dist/doc/latex/tocdata/images/engineer.jpg b/Master/texmf-dist/doc/latex/tocdata/images/engineer.jpg new file mode 100644 index 00000000000..7633adf9832 Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/engineer.jpg differ diff --git a/Master/texmf-dist/doc/latex/tocdata/images/go_problem.png b/Master/texmf-dist/doc/latex/tocdata/images/go_problem.png new file mode 100644 index 00000000000..ad1ece2f7c9 Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/go_problem.png differ diff --git a/Master/texmf-dist/doc/latex/tocdata/images/lacquer_go_board.jpg b/Master/texmf-dist/doc/latex/tocdata/images/lacquer_go_board.jpg new file mode 100644 index 00000000000..625e047de13 Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/lacquer_go_board.jpg differ diff --git a/Master/texmf-dist/doc/latex/tocdata/images/newton_astrolabe.jpg b/Master/texmf-dist/doc/latex/tocdata/images/newton_astrolabe.jpg new file mode 100644 index 00000000000..89ce7c23e52 Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/newton_astrolabe.jpg differ diff --git a/Master/texmf-dist/doc/latex/tocdata/images/quail.jpg b/Master/texmf-dist/doc/latex/tocdata/images/quail.jpg new file mode 100644 index 00000000000..db271d2482d Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/quail.jpg differ diff --git a/Master/texmf-dist/doc/latex/tocdata/images/symbol_warning.pdf b/Master/texmf-dist/doc/latex/tocdata/images/symbol_warning.pdf new file mode 100644 index 00000000000..727d185a9dc Binary files /dev/null and b/Master/texmf-dist/doc/latex/tocdata/images/symbol_warning.pdf differ diff --git a/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf b/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf index fc576e5003a..98203ba1cca 100644 Binary files a/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf and b/Master/texmf-dist/doc/latex/tocdata/tocdata.pdf differ diff --git a/Master/texmf-dist/source/latex/tocdata/tocdata.dtx b/Master/texmf-dist/source/latex/tocdata/tocdata.dtx index 1b6fc2a4a97..9093086e20d 100644 --- a/Master/texmf-dist/source/latex/tocdata/tocdata.dtx +++ b/Master/texmf-dist/source/latex/tocdata/tocdata.dtx @@ -15,7 +15,7 @@ % \iffalse %\NeedsTeXFormat{LaTeX2e}[1999/12/01] %\ProvidesPackage{tocdata} -% [2016/07/11 v0.11 Adds author/artist to TOC entries.] +% [2016/12/02 v0.12 Adds author/artist to TOC entries.] % %<*driver> \documentclass{ltxdoc} @@ -60,6 +60,8 @@ of the \acro{TOC}/\acro{LOF}. \usepackage[log-declarations=false]{xparse} +\usepackage{xifthen} + \usepackage[svgnames]{xcolor} \definecolor{myurlcolor}{rgb}{0,0,.7} \definecolor{mylinkcolor}{rgb}{.7,0,0} @@ -126,20 +128,59 @@ Keywords={LaTeX, tocdata, contents}% \usepackage{cleveref} + + \newcommand{\lmacro}[1]{\textbackslash#1} \newcommand{\cmds}[1]{\texttt{#1}} \newcommand{\env}[1]{\texttt{#1}} \newcommand{\pkg}[1]{\textsf{\textbf{#1}}} \newcommand{\acro}[1]{\textsc{\lowercase{#1}}} -\newcommand{\DescType}[1]{\raggedleft{\scriptsize#1}\quad} -\newcommand{\DescribeCommand}[1]{\leavevmode\marginpar{\DescType{Cmd}\bfseries\texttt{#1}}\index{#1 (command)}\ignorespaces} -\newcommand{\DescribeFile}[1]{\leavevmode\marginpar{\DescType{File}\bfseries\texttt{#1}}\index{#1 (file)}\index{files:>#1}\ignorespaces} -\newcommand{\DescribePackage}[1]{\leavevmode\marginpar{\DescType{Pkg}\bfseries\textsf{#1}}\index{#1 (package)}\index{packages:>#1}\ignorespaces} -\newcommand{\DescribeBoolean}[1]{\leavevmode\marginpar{\DescType{Bool}\texttt{#1}}\index{#1 (boolean)}\index{booleans:>#1}\ignorespaces} -\newcommand{\DescribeLength}[1]{\leavevmode\marginpar{\DescType{Len}\cmd{#1}}\index{\cmd{#1} (length)}\index{lengths:>\cmd{#1}}\ignorespaces} -\newcommand{\DescribeCounter}[1]{\leavevmode\marginpar{\DescType{Ctr}\texttt{#1}}\index{#1 (counter)}\index{counters:>#1}\ignorespaces} -\newcommand{\DescribeSimple}[1]{\leavevmode\marginpar{\raggedleft\texttt{#1}}\index{#1}\ignorespaces} + + + +% Indexing improvements: +\makeatletter + +\newcommand*{\Desc@Type}[1]{\raggedleft{\scriptsize#1}\quad} + +% \Describe@Usage{name}{margin tag}{index tag} +\newcommand*{\Describe@Usage}[3]{% +% \@bsphack% +\leavevmode\marginpar{\Desc@Type{#2}\texttt{#1}}% +\index{#1\actualchar{\protect\ttfamily#1} (#3)\encapchar usage}% +\index{#3s:\levelchar#1\actualchar{\protect\ttfamily#1}\encapchar usage}% +% \@esphack% +\ignorespaces% +} + +% \Describe@CmdUsage{name}{margin tag}{index tag} +% where name is a \macro +\newcommand*{\Describe@CmdUsage}[3]{% +% \@bsphack% +\leavevmode\marginpar{\Desc@Type{#2}\cmd{#1}}% +\SpecialIndex@{#1}{ (#3)\encapchar usage}% +\index{#3s:\levelchar\cmd{#1}\encapchar usage}\ignorespaces% +% \@esphack% +\ignorespaces% +} + +\newcommand*{\DescribeCommand}[1]{\Describe@Usage{#1}{Cmd}{command}} +\newcommand*{\DescribeFile}[1]{\Describe@Usage{#1}{File}{file}} +\newcommand*{\DescribePackage}[1]{\Describe@Usage{#1}{Pkg}{package}} +\newcommand*{\DescribeOption}[1]{\Describe@Usage{#1}{Opt}{option}} +\newcommand*{\DescribeArgument}[1]{\Describe@Usage{#1}{Arg}{argument}} +\newcommand*{\DescribeBoolean}[1]{\Describe@Usage{#1}{Bool}{boolean}} +\newcommand*{\DescribeLength}[1]{\Describe@CmdUsage{#1}{Len}{length}} +\newcommand*{\DescribeCounter}[1]{\Describe@Usage{#1}{Ctr}{counter}} +\newcommand*{\DescribeSimple}[1]{\leavevmode\marginpar{\raggedleft\texttt{#1}}\index{#1=\texttt{#1}}\ignorespaces} \renewcommand{\PrintEnvName}[1]{\strut \MacroFont {\scriptsize{}Env\quad}#1\ } +\renewcommand{\PrintDescribeEnv}[1]{\strut \MacroFont {\scriptsize{}Env\quad}#1\ } + +\newcommand*{\DescribeKey}[1]{% +\Describe@Usage{#1}{Key}{key}% +} + +\makeatother \newcommand{\tikz}{Ti\textit{k}z} @@ -208,8 +249,10 @@ Keywords={LaTeX, tocdata, contents}% % Grave accent \` Left brace \{ Vertical bar \| % Right brace \} Tilde \~} -% \changes{v0.10}{2016/05/05}{\ 2016/05/05 Initial version.} -% \changes{v0.11}{2016/07/11}{\ 2016/07/11 Minor docs improvements in spelling, grammar, formatting.} +% \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} @@ -220,9 +263,9 @@ Keywords={LaTeX, tocdata, contents}% % \DoNotIndex{\booltrue,\boolfalse} % \expandafter\DoNotIndex\expandafter{\detokenize{\(,\),\,,\\,\#,\$,\%,\^,\_,\~,\ ,\&,\{,\}}} % -% \renewcommand{\listfigurename}{List of Illustrations} -% \begin{titlepage} -% \centering +% ^^A \renewcommand{\listfigurename}{List of } +% \begin{center} +% \thispagestyle{empty} % \vfill % ^^A \includegraphics[width=.3\linewidth]{\mypackagename_logo.pdf} % \vfill @@ -239,17 +282,6 @@ Keywords={LaTeX, tocdata, contents}% % {\normalsize\textup{\quicksummary}} % % -% \vfill -% -% -% ^^A % \title{The \pkg{lwarp} package\thanks{This document -% ^^A % corresponds to \pkg{lwarp}~\fileversion, -% ^^A % dated \filedate.}} -% ^^A % \author{{\small\copyright{} 2016} Brian Dunn\\ \small \texttt{bd@BDTechConcepts.com}} -% ^^A % \published{} -% ^^A % \subtitle{\textup{\LaTeX{} to HTML5}} -% ^^A % -% ^^A % \maketitle % % \vfill % @@ -265,7 +297,7 @@ Keywords={LaTeX, tocdata, contents}% % \vspace*{\fill} % \vspace*{\fill} % \vspace*{\fill} -% \end{titlepage} +% \end{center} % % \tableofcontents % \clearpage @@ -314,7 +346,7 @@ Keywords={LaTeX, tocdata, contents}% % % \clearpage % -% \sectionauthor[Other Methods]{Other Methods}{Various}{Authors} +% \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 @@ -337,17 +369,15 @@ 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} % \setlength{\fboxsep}{0pt} % \centering % \fbox{\includegraphics[height=3in]{engineer.jpg}} % \captionartist % [The Crazy Engineer] -% {The Crazy Engineer}[Illustration from \textit{The Crazy Engineer} \\ \textit{McGuffey's Fifth Eclectic Reader}]{H. F.}{Farny} +% {The Crazy Engineer}[Illustration from \textit{The Crazy Engineer} \par \textit{McGuffey's Fifth Eclectic Reader}]{H. F.}{Farny} % \end{figure} % -% % \clearpage % % \begin{figure} @@ -372,11 +402,11 @@ Keywords={LaTeX, tocdata, contents}% % \cs{tocdatafont} is also provided to control the appearance of this data in the \acro{TOC}/\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 for both. +% along with supplemental information for figures, and automatic index entries. % \end{itemize} % % -% \subsection{Basic Setup} +% \subsection{Basic setup} % % % @@ -532,6 +562,27 @@ Keywords={LaTeX, tocdata, contents}% % 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. +% All following figures use the selected justification +% until it is changed to another. +% +% % \StopEventually{\PrintChanges % \PrintIndex % @@ -548,7 +599,7 @@ Keywords={LaTeX, tocdata, contents}% % \centering % \fbox{\includegraphics[width=3in]{quail.jpg}} % \captionartist{Quail\label{fig:quail}} -% [Illustration from \textit{About Quail} \\ \textit{McGuffey's Fifth Eclectic Reader}] +% [Illustration from \textit{About Quail} \par \textit{McGuffey's Fifth Eclectic Reader}] % {Alexander}{Pope} % \end{figure} % @@ -561,7 +612,7 @@ Keywords={LaTeX, tocdata, contents}% % \centering % \includegraphics[width=3in]{diagram_sunbeam.jpg} % \captionartist -% {Diagram Of A Sunbeam}[] +% {Diagram of a Sunbeam}[] % [Sir]{Isaac}{Newton} % \end{figure} % @@ -576,9 +627,13 @@ Keywords={LaTeX, tocdata, contents}% % % % \subsection{Requirements} +% +% \changes{v0.12}{2016/12/02}{Added requirement for \pkg{xifthen}.} +% % \begin{macrocode} \RequirePackage{xparse} \RequirePackage{etoolbox} +\RequirePackage{xifthen} % \end{macrocode} @@ -678,7 +733,7 @@ Keywords={LaTeX, tocdata, contents}% % \begin{macrocode} \TD@usetocdata% <-- newly added for the tocdata package % -\contentspage}[\vspace{-.5ex}] +\contentspage}[\vspace{-.5ex}]% } % \end{macrocode} % Likewise for sections: @@ -687,7 +742,7 @@ Keywords={LaTeX, tocdata, contents}% % \dotfill \titlerule*[.75pc]{.}% \TD@usetocdata% -\contentspage}[\vspace{-.5ex}] +\contentspage}[\vspace{-.5ex}]% % \end{macrocode} % Likewise for figures: % \begin{macrocode} @@ -695,7 +750,7 @@ Keywords={LaTeX, tocdata, contents}% % \dotfill \titlerule*[1pc]{.}% \TD@usetocdata% -\contentspage}[\vspace{-.5ex}] +\contentspage}[\vspace{-.5ex}]% % \end{macrocode} % \begin{macrocode} @@ -767,16 +822,39 @@ Keywords={LaTeX, tocdata, contents}% % which does not have an author/artist name. % % +% \subsubsection{User customization} +% +% +% \begin{macro}{\TD@optionalname} \marg{name} +% +% Adds optional artist's name and the following space. +% +% \begin{macrocode} +\newcommand{\TD@optionalname}[1] +{% +\ifthenelse{\equal{#1}{}}% +{}% +{#1~}% +} +% \end{macrocode} +% \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. % +% \changes{v0.12}{2016/11/29}{Improved spacing.} +% % \begin{macrocode} \@ifundefined{chapter} {}% if no chapters {% only of chapters exists in this documentclass: \newcommand{\tocdatachapprint}[4] -{\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- #1 #2 #3#4}}} +{% +\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- % +\TD@optionalname{#1}\TD@optionalname{#2}#3#4}}% +} }% end of chapters-only % \end{macrocode} % To remove the author's name, redefine this as a null function taking four arguments: @@ -789,9 +867,15 @@ Keywords={LaTeX, tocdata, contents}% % % User-redefinable macro to print the author's name underneath the section title. % +% \changes{v0.12}{2016/11/29}{Improved spacing.} +% % \begin{macrocode} \newcommand{\tocdatasecprint}[4] -{\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- #1 #2 #3#4}}} +{% +\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- % +\TD@optionalname{#1}\TD@optionalname{#2}#3#4}% +}% +} % \end{macrocode} % To remove the author's name, redefine this as a null function taking four arguments: % \begin{docsidebar} @@ -799,8 +883,68 @@ Keywords={LaTeX, tocdata, contents}% % \end{docsidebar} % \end{macro} % +% +% +% \begin{macro}{\tocdatafigprint} \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.} +% +% \begin{macrocode} +\newcommand{\tocdatafigprint}[4]{% +\addvspace{2ex}% +% \addvspace{\medskipamount}% +\begin{minipage}{\linewidth}% +\TD@namealign% +\footnotesize\textsc{{\TD@optionalname{#1}\TD@optionalname{#2}#3#4}}% +\end{minipage}% +\par% +\addvspace{2ex}% +% \addvspace{\medskipamount}% +} +% \end{macrocode} +% To remove the artist's name, redefine this as a null function taking four arguments: +% \begin{docsidebar} +% |\renewcommand{\tocdatafigprint}[4]{}| +% \end{docsidebar} +% \end{macro} +% +% +% +% \begin{macro}{\tocdatafigtextprint} \marg{first} \marg{last} +% +% 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/29}{Added text alignment.} +% +% \begin{macrocode} +\newcommand{\tocdatafigtextprint}[1]{% +\addvspace{2ex}% +\begin{minipage}{\linewidth}% +\TD@textalign% +\footnotesize% +\setlength{\parskip}{1.5ex}% +\setlength{\parindent}{0em}% +#1% +\end{minipage}% +\par% +\addvspace{2ex}% +% \addvspace{\medskipamount}% +} +% \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} +% +% \changes{v0.12}{2016/11/28}{Expands first name before index check.} % \begin{macrocode} \@ifundefined{chapter} {}% if no chapters @@ -811,25 +955,25 @@ Keywords={LaTeX, tocdata, contents}% % so it is used as-is: % \begin{macrocode} \IfBooleanTF{#1}% star: -{\chapter*{#3\tocdatachapprint{#4}{#5}{#6}{#7}}} +{\chapter*{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}% % \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} +\tocdata{toc}{#5 #6}% % \end{macrocode} % Create the chapter 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{#2}% +{\chapter[#2]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}% +{\chapter[#3]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}% +}% % \end{macrocode} % Create an index entry depending on whether there is a first name: % \begin{macrocode} -\ifblank{#5} -{\index{#6}} -{\index{#6, #5}} +\ifthenelse{\equal{#5}{}}% +{\index{#6}}% +{\index{#6, #5}}% }% end of \chapterauthor }% end of \@ifundefined{chapter} % \end{macrocode} @@ -838,6 +982,8 @@ Keywords={LaTeX, tocdata, contents}% % \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{}}{% % \end{macrocode} @@ -845,71 +991,132 @@ Keywords={LaTeX, tocdata, contents}% % so it is simply used as-is: % \begin{macrocode} \IfBooleanTF{#1}% star: -{\section*{#3\tocdatasecprint{#4}{#5}{#6}{#7}}} +{\section*{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}% % \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} +\tocdata{toc}{#5 #6}% % \end{macrocode} % Create the section depending on the optional name: % \begin{macrocode} -\IfValueTF{#2} -{\section[#2]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}} -{\section[#3]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}} -} +\IfValueTF{#2}% +{\section[#2]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}% +{\section[#3]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}% +}% 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}} +\ifthenelse{\equal{#5}{}}% +{\index{#6}}% +{\index{#6, #5}}% } % \end{macrocode} % \end{macro} - - -% \begin{macro}{\tocdatafigprint} \marg{prefix} \marg{first} \marg{last} \marg{suffix} % -% User-redefinable macro to print the artist's name underneath the figure. % % +% \subsubsection{Figure name alignment} +% +% \begin{macro}{\TD@namealign} Sets text alignment in the optional text. % \begin{macrocode} -\newcommand{\tocdatafigprint}[4]{% -\addvspace{1ex}% -{\centering\footnotesize\textsc{{#1 #2 #3#4}}\par}% +\newcommand{\TD@namealign}{\centering} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tdnamejustify} Sets justified text alignment in the optional text. +% \changes{v0.12}{2016/11/30}{etc. Added name alignment.} +% \begin{macrocode} +\newcommand{\tdnamejustify}{% +\renewcommand{\TD@namealign}{}% } % \end{macrocode} -% To remove the artist's name, redefine this as a null function taking four arguments: -% \begin{docsidebar} -% |\renewcommand{\tocdatafigprint}[4]{}| -% \end{docsidebar} % \end{macro} % +% \begin{macro}{tdnamecenter} Sets centered text alignment in the optional text. +% \begin{macrocode} +\newcommand{\tdnamecenter}{% +\renewcommand{\TD@namealign}{\centering}% +} +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\tocdatafigtextprint} \marg{first} \marg{last} +% \begin{macro}{tdnameleft} Sets left text alignment in the optional text. +% \begin{macrocode} +\newcommand{\tdnameleft}{% +\renewcommand{\TD@namealign}{\raggedright}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{tdnameright} Sets right text alignment in the optional text. +% \begin{macrocode} +\newcommand{\tdnameright}{% +\renewcommand{\TD@namealign}{\raggedleft}% +} +% \end{macrocode} +% \end{macro} % -% User-redefinable macro to print the artist's name underneath the figure. % +% \subsubsection{Figure text alignment} +% +% \begin{macro}{\TD@textalign} Sets text alignment in the optional text. % \begin{macrocode} -\newcommand{\tocdatafigtextprint}[1]{% -\addvspace{1ex}% -{\centering\footnotesize#1\par}% +\newcommand{\TD@textalign}{\centering} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\tdtextjustify} 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}{}% } % \end{macrocode} % \end{macro} - +% +% \begin{macro}{tdtextcenter} Sets centered text alignment in the optional text. +% \begin{macrocode} +\newcommand{\tdtextcenter}{% +\renewcommand{\TD@textalign}{\centering}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{tdtextleft} Sets left text alignment in the optional text. +% \begin{macrocode} +\newcommand{\tdtextleft}{% +\renewcommand{\TD@textalign}{\raggedright}% +} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{tdtextright} Sets right text alignment in the optional text. +% \begin{macrocode} +\newcommand{\tdtextright}{% +\renewcommand{\TD@textalign}{\raggedleft}% +} +% \end{macrocode} +% \end{macro} +% +% +% +% \subsubsection{Figures} +% % \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} % +% \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 % 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 -% is empty. For example, use: % \watchout[Optional arguments] +% is empty. For example, use: % \begin{docsidebar} % |\captionartist{Title}|\textcolor{red}{|[]|}|[Sir]{Isaac}{Newton}| % @@ -919,15 +1126,20 @@ Keywords={LaTeX, tocdata, contents}% % interpreted as the optional text, not as the optional prefix.) % \end{docsidebar} % \begin{macrocode} -\NewDocumentCommand{\captionartist}{s o m O{} O{} m m O{}}{% +\NewDocumentCommand{\captionartist}{s o m +O{} O{} m m O{}}{% % \end{macrocode} % Print the artist's name next to the figure: % \begin{macrocode} -\par\tocdatafigprint{#5}{#6}{#7}{#8} +\par\addvspace{\medskipamount}% +\tocdatafigprint{#5}{#6}{#7}{#8}% % \end{macrocode} % If supplemental text is provided, print it below the author: % \begin{macrocode} -\ifblank{#4}{}{\par\tocdatafigtextprint{#4}} +\ifthenelse{\equal{#4}{}}{}{\par\tocdatafigtextprint{#4}}% +% \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. @@ -935,8 +1147,8 @@ Keywords={LaTeX, tocdata, contents}% \IfBooleanTF{#1}% {% starred \IfValueTF{#2}{\caption*[#2]{#3}}{\caption*{#3}}% -}% -{% no starred +}% starred +{% not starred % \end{macrocode} % No starred, so remember the artist's name for inclusion in the \acro{LOF}: % \begin{macrocode} @@ -945,11 +1157,11 @@ Keywords={LaTeX, tocdata, contents}% % Create the caption depending on the optional name: % \begin{macrocode} \IfValueTF{#2}{\caption[#2]{#3}}{\caption{#3}}% -} +}% not starred % \end{macrocode} % Create an index entry depending on whether there is a first name: % \begin{macrocode} -\ifblank{#6}% +\ifthenelse{\equal{#6}{}}% {\index{#7}}% {\index{#7, #6}}% } @@ -960,7 +1172,7 @@ Keywords={LaTeX, tocdata, contents}% % \setlength{\fboxsep}{0pt} % \centering % \fbox{\includegraphics[width=4in]{lacquer_go_board.jpg}} -% \captionartist{Lacquer Go Board}[From the series, \textit{Uma Zukushi}.]{Katsushika}{Hokusai} +% \captionartist{Lacquer Go Board}[From the series \textit{Uma Zukushi}.]{Katsushika}{Hokusai} % \end{figure} % % diff --git a/Master/texmf-dist/tex/latex/tocdata/tocdata.sty b/Master/texmf-dist/tex/latex/tocdata/tocdata.sty index 97ac015d5e0..9a277e0bcf4 100644 --- a/Master/texmf-dist/tex/latex/tocdata/tocdata.sty +++ b/Master/texmf-dist/tex/latex/tocdata/tocdata.sty @@ -17,12 +17,13 @@ %% version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{tocdata} - [2016/07/11 v0.11 Adds author/artist to TOC entries.] + [2016/12/02 v0.12 Adds author/artist to TOC entries.] \RequirePackage{xparse} \RequirePackage{etoolbox} +\RequirePackage{xifthen} \newcommand{\TD@thistocdata}{} @@ -45,16 +46,16 @@ \titlecontents{chapter}[0em]{}{\contentslabel{2.5em}}{}{% \titlerule*[.75pc]{.}% \TD@usetocdata% <-- newly added for the tocdata package -\contentspage}[\vspace{-.5ex}] +\contentspage}[\vspace{-.5ex}]% } \titlecontents{section}[2.5em]{}{\contentslabel{2.5em}}{}{% \titlerule*[.75pc]{.}% \TD@usetocdata% -\contentspage}[\vspace{-.5ex}] +\contentspage}[\vspace{-.5ex}]% \titlecontents{figure}[0em]{}{\contentslabel{3em}}{}{% \titlerule*[1pc]{.}% \TD@usetocdata% -\contentspage}[\vspace{-.5ex}] +\contentspage}[\vspace{-.5ex}]% }% end of titletoc loaded {% titletoc is not loaded @@ -73,67 +74,119 @@ }% end of tocloft patches {}% tocloft not loaded +\newcommand{\TD@optionalname}[1] +{% +\ifthenelse{\equal{#1}{}}% +{}% +{#1~}% +} \@ifundefined{chapter} {}% if no chapters {% only of chapters exists in this documentclass: \newcommand{\tocdatachapprint}[4] -{\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- #1 #2 #3#4}}} +{% +\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- % +\TD@optionalname{#1}\TD@optionalname{#2}#3#4}}% +} }% end of chapters-only \newcommand{\tocdatasecprint}[4] -{\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- #1 #2 #3#4}}} +{% +\newline\noindent{\normalfont\normalsize\textit{\hspace*{2em}--- % +\TD@optionalname{#1}\TD@optionalname{#2}#3#4}% +}% +} +\newcommand{\tocdatafigprint}[4]{% +\addvspace{2ex}% +\begin{minipage}{\linewidth}% +\TD@namealign% +\footnotesize\textsc{{\TD@optionalname{#1}\TD@optionalname{#2}#3#4}}% +\end{minipage}% +\par% +\addvspace{2ex}% +} +\newcommand{\tocdatafigtextprint}[1]{% +\addvspace{2ex}% +\begin{minipage}{\linewidth}% +\TD@textalign% +\footnotesize% +\setlength{\parskip}{1.5ex}% +\setlength{\parindent}{0em}% +#1% +\end{minipage}% +\par% +\addvspace{2ex}% +} \@ifundefined{chapter} {}% if no chapters {% only of chapters exists in this documentclass: \NewDocumentCommand{\chapterauthor}{s o m O{} m m O{}}{% \IfBooleanTF{#1}% star: -{\chapter*{#3\tocdatachapprint{#4}{#5}{#6}{#7}}} +{\chapter*{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}% {% no star: -\tocdata{toc}{#5 #6} -\IfValueTF{#2} -{\chapter[#2]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}} -{\chapter[#3]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}} -} -\ifblank{#5} -{\index{#6}} -{\index{#6, #5}} +\tocdata{toc}{#5 #6}% +\IfValueTF{#2}% +{\chapter[#2]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}% +{\chapter[#3]{#3\tocdatachapprint{#4}{#5}{#6}{#7}}}% +}% +\ifthenelse{\equal{#5}{}}% +{\index{#6}}% +{\index{#6, #5}}% }% end of \chapterauthor }% end of \@ifundefined{chapter} \NewDocumentCommand{\sectionauthor}{s o m O{} m m O{}}{% \IfBooleanTF{#1}% star: -{\section*{#3\tocdatasecprint{#4}{#5}{#6}{#7}}} +{\section*{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}% {% no star: -\tocdata{toc}{#5 #6} -\IfValueTF{#2} -{\section[#2]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}} -{\section[#3]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}} +\tocdata{toc}{#5 #6}% +\IfValueTF{#2}% +{\section[#2]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}% +{\section[#3]{#3\tocdatasecprint{#4}{#5}{#6}{#7}}}% +}% no star +\ifthenelse{\equal{#5}{}}% +{\index{#6}}% +{\index{#6, #5}}% } -\ifblank{#5} -{\index{#6}} -{\index{#6, #5}} +\newcommand{\TD@namealign}{\centering} +\newcommand{\tdnamejustify}{% +\renewcommand{\TD@namealign}{}% } - -\newcommand{\tocdatafigprint}[4]{% -\addvspace{1ex}% -{\centering\footnotesize\textsc{{#1 #2 #3#4}}\par}% +\newcommand{\tdnamecenter}{% +\renewcommand{\TD@namealign}{\centering}% } -\newcommand{\tocdatafigtextprint}[1]{% -\addvspace{1ex}% -{\centering\footnotesize#1\par}% +\newcommand{\tdnameleft}{% +\renewcommand{\TD@namealign}{\raggedright}% } - -\NewDocumentCommand{\captionartist}{s o m O{} O{} m m O{}}{% -\par\tocdatafigprint{#5}{#6}{#7}{#8} -\ifblank{#4}{}{\par\tocdatafigtextprint{#4}} +\newcommand{\tdnameright}{% +\renewcommand{\TD@namealign}{\raggedleft}% +} +\newcommand{\TD@textalign}{\centering} +\newcommand{\tdtextjustify}{% +\renewcommand{\TD@textalign}{}% +} +\newcommand{\tdtextcenter}{% +\renewcommand{\TD@textalign}{\centering}% +} +\newcommand{\tdtextleft}{% +\renewcommand{\TD@textalign}{\raggedright}% +} +\newcommand{\tdtextright}{% +\renewcommand{\TD@textalign}{\raggedleft}% +} +\NewDocumentCommand{\captionartist}{s o m +O{} O{} m m O{}}{% +\par\addvspace{\medskipamount}% +\tocdatafigprint{#5}{#6}{#7}{#8}% +\ifthenelse{\equal{#4}{}}{}{\par\tocdatafigtextprint{#4}}% +\unskip% \IfBooleanTF{#1}% {% starred \IfValueTF{#2}{\caption*[#2]{#3}}{\caption*{#3}}% -}% -{% no starred +}% starred +{% not starred \tocdata{lof}{#6 #7}% \IfValueTF{#2}{\caption[#2]{#3}}{\caption{#3}}% -} -\ifblank{#6}% +}% not starred +\ifthenelse{\equal{#6}{}}% {\index{#7}}% {\index{#7, #6}}% } -- cgit v1.2.3