From 7d06555d716ec0133a2db80ab371fefcc09e0292 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 12 Jan 2019 22:55:13 +0000 Subject: tocdata (12jan19) git-svn-id: svn://tug.org/texlive/trunk@49678 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/tocdata/tocdata.sty | 169 +++++++++++++----------- 1 file changed, 95 insertions(+), 74 deletions(-) (limited to 'Master/texmf-dist/tex/latex/tocdata') diff --git a/Master/texmf-dist/tex/latex/tocdata/tocdata.sty b/Master/texmf-dist/tex/latex/tocdata/tocdata.sty index 9a277e0bcf4..64c2fa95129 100644 --- a/Master/texmf-dist/tex/latex/tocdata/tocdata.sty +++ b/Master/texmf-dist/tex/latex/tocdata/tocdata.sty @@ -17,25 +17,40 @@ %% version 2005/12/01 or later. \NeedsTeXFormat{LaTeX2e}[1999/12/01] \ProvidesPackage{tocdata} - [2016/12/02 v0.12 Adds author/artist to TOC entries.] + [2019/01/12 v1.00 Adds author/artist to TOC entries.] \RequirePackage{xparse} \RequirePackage{etoolbox} -\RequirePackage{xifthen} + +\@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% + } + {Load either, then load tocdata next.} + } +} \newcommand{\TD@thistocdata}{} \newcommand{\settocdata}[1]{\renewcommand{\TD@thistocdata}{#1}} \newcommand{\tocdata}[2]{% -\@bsphack\addtocontents{#1}{\protect\settocdata{#2}}\@esphack% + \@bsphack\addtocontents{#1}{\protect\settocdata{#2}}\@esphack% } \newcommand{\tocdatafont}[1]{{\normalfont\textit{\small#1}}} \newcommand{\TD@usetocdata}{% -\tocdatafont{\TD@thistocdata}% -\global\def\TD@thistocdata{}% + \tocdatafont{\TD@thistocdata}% + \global\def\TD@thistocdata{}% } \@ifpackageloaded{titletoc}{ @@ -76,119 +91,125 @@ \newcommand{\TD@optionalname}[1] {% -\ifthenelse{\equal{#1}{}}% -{}% -{#1~}% + \ifblank{#1}% + {}% + {#1~}% } \@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}}% + \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}--- % -\TD@optionalname{#1}\TD@optionalname{#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}% + \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}% + \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}}}% -{% no star: -\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}}% + \IfBooleanTF{#1}% + {% star: + \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}}% }% 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}}}% -{% no star: -\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}}% + \IfBooleanTF{#1}% + {% star: + \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}}}% + }% no star + \ifblank{#5}% + {\index{#6}}% + {\index{#6, #5}}% } \newcommand{\TD@namealign}{\centering} \newcommand{\tdnamejustify}{% -\renewcommand{\TD@namealign}{}% + \renewcommand{\TD@namealign}{}% } \newcommand{\tdnamecenter}{% -\renewcommand{\TD@namealign}{\centering}% + \renewcommand{\TD@namealign}{\centering}% } \newcommand{\tdnameleft}{% -\renewcommand{\TD@namealign}{\raggedright}% + \renewcommand{\TD@namealign}{\raggedright}% } \newcommand{\tdnameright}{% -\renewcommand{\TD@namealign}{\raggedleft}% + \renewcommand{\TD@namealign}{\raggedleft}% } \newcommand{\TD@textalign}{\centering} \newcommand{\tdtextjustify}{% -\renewcommand{\TD@textalign}{}% + \renewcommand{\TD@textalign}{}% } \newcommand{\tdtextcenter}{% -\renewcommand{\TD@textalign}{\centering}% + \renewcommand{\TD@textalign}{\centering}% } \newcommand{\tdtextleft}{% -\renewcommand{\TD@textalign}{\raggedright}% + \renewcommand{\TD@textalign}{\raggedright}% } \newcommand{\tdtextright}{% -\renewcommand{\TD@textalign}{\raggedleft}% + \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}}% -}% starred -{% not starred -\tocdata{lof}{#6 #7}% -\IfValueTF{#2}{\caption[#2]{#3}}{\caption{#3}}% -}% not starred -\ifthenelse{\equal{#6}{}}% -{\index{#7}}% -{\index{#7, #6}}% + \par\addvspace{\medskipamount}% + \tocdatafigprint{#5}{#6}{#7}{#8}% + \ifblank{#4}% + {}% + {\par\tocdatafigtextprint{#4}}% + \unskip% + \IfBooleanTF{#1}% + {% starred + \IfValueTF{#2}{\caption*[#2]{#3}}{\caption*{#3}}% + }% starred + {% not starred + \tocdata{lof}{#6 #7}% + \IfValueTF{#2}{\caption[#2]{#3}}{\caption{#3}}% + }% not starred + \ifblank{#6}% + {\index{#7}}% + {\index{#7, #6}}% } \endinput %% -- cgit v1.2.3