From e6b754ddd8bdcc1242d8acf0517fa8a694a960c5 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 25 Sep 2018 08:30:26 +0900 Subject: aeb-minitoc (new) --- texmf-dist/doc/latex/aeb-minitoc/README.md | 16 + texmf-dist/doc/latex/aeb-minitoc/aeb-minitoc.pdf | Bin 0 -> 113430 bytes texmf-dist/doc/latex/aeb-minitoc/aebminitocman.pdf | Bin 0 -> 272326 bytes texmf-dist/doc/latex/aeb-minitoc/aebminitocman.tex | 1284 ++++++++++++++++++++ .../aeb-minitoc/examples/manual-exmpls-bullets.tex | 296 +++++ .../aeb-minitoc/examples/manual-exmpls-default.tex | 268 ++++ .../aeb-minitoc/examples/minitoc-art-star.tex | 139 +++ .../doc/latex/aeb-minitoc/examples/minitoc-art.pdf | Bin 0 -> 108828 bytes .../doc/latex/aeb-minitoc/examples/minitoc-art.tex | 169 +++ .../doc/latex/aeb-minitoc/examples/minitoc-bk.tex | 236 ++++ .../aeb-minitoc/examples/minitoc-bullets-para.tex | 211 ++++ .../source/latex/aeb-minitoc/aeb-minitoc.dtx | 723 +++++++++++ .../source/latex/aeb-minitoc/aeb-minitoc.ins | 60 + texmf-dist/tex/latex/aeb-minitoc/aeb-minitoc.sty | 256 ++++ 14 files changed, 3658 insertions(+) create mode 100644 texmf-dist/doc/latex/aeb-minitoc/README.md create mode 100644 texmf-dist/doc/latex/aeb-minitoc/aeb-minitoc.pdf create mode 100644 texmf-dist/doc/latex/aeb-minitoc/aebminitocman.pdf create mode 100644 texmf-dist/doc/latex/aeb-minitoc/aebminitocman.tex create mode 100644 texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-bullets.tex create mode 100644 texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-default.tex create mode 100644 texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art-star.tex create mode 100644 texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.pdf create mode 100644 texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.tex create mode 100644 texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bk.tex create mode 100644 texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bullets-para.tex create mode 100644 texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.dtx create mode 100644 texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.ins create mode 100644 texmf-dist/tex/latex/aeb-minitoc/aeb-minitoc.sty (limited to 'texmf-dist') diff --git a/texmf-dist/doc/latex/aeb-minitoc/README.md b/texmf-dist/doc/latex/aeb-minitoc/README.md new file mode 100644 index 00000000..bbd169e3 --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/README.md @@ -0,0 +1,16 @@ +The aeb-minitoc package +Author: D. P. Story +Dated: 2018-09-21 + +This package creates mini-TOCs through the use of the \insertminitoc command. +The system is powerful and flexible and allows for some amount of logic. + +The package works for a the usual workflows + + +D. P. Story +www.acrotex.net +blog.acrotex.net +dpstory@uakron.edu +dpstory@acrotex.net + diff --git a/texmf-dist/doc/latex/aeb-minitoc/aeb-minitoc.pdf b/texmf-dist/doc/latex/aeb-minitoc/aeb-minitoc.pdf new file mode 100644 index 00000000..91d37912 Binary files /dev/null and b/texmf-dist/doc/latex/aeb-minitoc/aeb-minitoc.pdf differ diff --git a/texmf-dist/doc/latex/aeb-minitoc/aebminitocman.pdf b/texmf-dist/doc/latex/aeb-minitoc/aebminitocman.pdf new file mode 100644 index 00000000..d033cbb0 Binary files /dev/null and b/texmf-dist/doc/latex/aeb-minitoc/aebminitocman.pdf differ diff --git a/texmf-dist/doc/latex/aeb-minitoc/aebminitocman.tex b/texmf-dist/doc/latex/aeb-minitoc/aebminitocman.tex new file mode 100644 index 00000000..f3feb993 --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/aebminitocman.tex @@ -0,0 +1,1284 @@ +% +% Need some discussion on workflow +% +% makeindex < aebpro_man.idx > aebpro_man.ind +\documentclass[10pt]{article} +\usepackage[fleqn]{amsmath} +%\usepackage{hyperref} +\usepackage[ + web={centertitlepage,designv,forcolorpaper,latextoc,pro,addtoHyOpts={pagebackref=false}}, + eforms, +% linktoattachments, + aebxmp +]{aeb_pro} +\usepackage{booktabs} +\usepackage{aeb_mlink} +\usepackage{aeb-minitoc} +\usepackage{graphicx,array} +\usepackage{ifthen} +%\usepackage{myriadpro} +%\usepackage{calibri} + +\usepackage[altbullet]{lucidbry} + +\usepackage{xbmks} +\DeclareInitView{layoutmag={navitab:UseOutlines}} +\xbmksetup{colors={int=red},styles={intbf}} + +\addtolength{\marginparwidth}{20pt} + +%\previewtrue +%\usepackage{makeidx} +%\makeindex +\usepackage{acroman} +\usepackage[active]{srcltx} + +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{5} +\makeatletter +\renewcommand*{\thesubsubsection}{\texorpdfstring{$\bullet$}{\textbullet}} +\renewcommand*{\theparagraph}{\texorpdfstring{\protect\P}{\textparagraph}} +\renewcommand*{\thesubparagraph}{\texorpdfstring{\protect\P\protect\P}{\textparagraph\textparagraph}} +\renewcommand{\paragraph} + {\renewcommand{\@seccntformat}[1]{\theparagraph\space}% + \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}} +\renewcommand*\l@paragraph{\@dottedtocline{4}{5.0em}{1em}} %{7.0em}{4.1em}} +\renewcommand{\subparagraph} + {\renewcommand{\@seccntformat}[1]{\thesubparagraph\space}% + \@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}{\bfseries}} + +\def\chgCurrLblName#1{\def\@currentlabelname{#1}} +\def\echgCurrLblName#1{\edef\@currentlabelname{#1}} +\let\db\@gobble +\makeatother + +%\getDimsFromGraphic{graphics/dpsweb}{\dpswebW}{\dpswebH} + + +%\urlstyle{rm} +\urlstyle{sf} +\let\uif\textsf +\let\app\textsf +\def\psf#1{\textbf{\textsf{#1}}} +%\let\amtIndent\leftmargini +\edef\amtIndent{\the\parindent} + +\renewcommand*\descriptionlabel[1]{\hspace\labelsep + \normalfont #1} + + +\DeclareDocInfo +{ + university={Acro\negthinspace\TeX.Net}, + title={The \textsf{aeb-minitoc} package\texorpdfstring{\\}{: } Inserting TOCs within a section}, + author={D. P. Story}, + email={dpstory@acrotex.net}, + subject={Documentation for the aeb-minitoc package from AcroTeX: Inserting TOCs within a section}, + talksite={\url{www.acrotex.net}}, + version={1.6, 2018/09/21}, + Keywords={AcroTeX, mini-toc}, + copyrightStatus=True, + copyrightNotice={Copyright (C) \the\year, D. P. Story}, + copyrightInfoURL={http://www.acrotex.net} +} + +\def\dps{$\hbox{$\mathfrak D$\kern-.3em\hbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\universityLayout{fontsize=Large} +\titleLayout{fontsize=LARGE} +\authorLayout{fontsize=Large} +\tocLayout{fontsize=Large,color=aeb} +\sectionLayout{indent=-62.5pt,fontsize=large,color=aeb} +\subsectionLayout{indent=-31.25pt,color=aeb} +\subsubsectionLayout{indent=0pt,color=aeb} +\subsubDefaultDing{\texorpdfstring{$\bullet$}{\textbullet}} + +\widestNumber{0.00.} +%\pagestyle{empty} +%\parindent0pt\parskip\medskipamount + +\def\dps{$\mbox{$\mathfrak D$\kern-.3em\mbox{$\mathfrak P$}% + \kern-.6em \hbox{$\mathcal S$}}$} + +\newcount\fldCnt \fldCnt=0 +\def\incFldCnt{\global\advance\fldCnt1\relax} + +\BTMLevel{subsubsection} + +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmti} +\@A{\def\@linkcolor{red}\@PW{1.5em}}% +\declaretocfmt{subsection}{\@R{1.55em\@plus 2em}\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtii} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}\@N{\textbf}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtvii} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}\@F{\bfseries}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}\@F{\color{blue}}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtiv} +\@A{\FmtTOCEntry} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtv} +\declaretocfmt{paragraph}{\@W{1em}\@D{0em}\@R{1.55em plus 2em}} +\declaretocfmt{subparagraph}{\@W{1.5em}\@D{1em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtvi} +\@A{\@PW{1em}} +\declaretocfmt{subsection}{\@W{2em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em} + \@R{1.55em plus 2em}\leftskip2em\relax + \rightskip\@tocrmarg\relax{#1},\nobreak{ #2}\enspace\allowbreak} %\allowbreak +\end{minitocfmt} + +\newcommand{\insMinitoci}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + Contents of Section~\ref*{CandM}: \nameref*{CandM} + \par\kern2pt + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}{c}\toprule + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}\\ \bottomrule + \end{tabular} + \end{center} +} + +\newcommand{\insMinitocfbox}[2][]{% + \begin{center}#2 + \fbox{\begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}} + \end{center} +} + +\def\MP#1{\marginpar{\raggedleft\small\itshape #1}} +\frenchspacing + +\chngDocObjectTo{\newDO}{doc} +\begin{docassembly} +var titleOfManual="The aeb-minitoc package MANUAL"; +var manualfilename="Manual_BG_Print_minitoc.pdf"; +var manualtemplate="Manual_BG_Brown.pdf"; // Blue, Green, Brown +var _pathToBlank="C:/Users/Public/Documents/ManualBGs/"+manualtemplate; +var doc; +var buildIt=false; +if ( buildIt ) { + console.println("Creating new " + manualfilename + " file."); + doc = \appopenDoc({cPath: _pathToBlank, bHidden: true}); + var _path=this.path; + var pos=_path.lastIndexOf("/"); + _path=_path.substring(0,pos)+"/"+manualfilename; + \docSaveAs\newDO ({ cPath: _path }); + doc.closeDoc(); + doc = \appopenDoc({cPath: manualfilename, oDoc:this, bHidden: true}); + f=doc.getField("ManualTitle"); + f.value=titleOfManual; + doc.flattenPages(); + \docSaveAs\newDO({ cPath: manualfilename }); + doc.closeDoc(); +} else { + console.println("Using the current "+manualfilename+" file."); +} +var _path=this.path; +var pos=_path.lastIndexOf("/"); +_path=_path.substring(0,pos)+"/"+manualfilename; +\addWatermarkFromFile({ + bOnTop:false, + bOnPrint:false, + cDIPath:_path +}); +\executeSave(); +\end{docassembly} + +\begin{document} + +\maketitle + +\pdfbookmarkx[1]{Title Page}[action={\Named{FirstPage}}]{TitlePage} +\pdfbookmarkx[1]{Links to AcroTeX.Net}[action={/S/GoTo/D(undefined)},% + color=magenta,style={bf}]{acrotex} +\belowpdfbookmarkx{http://www.acrotex.net}[action={\URI{http://www.acrotex.net}},% + color=magenta,style={bf}]{home} +\belowpdfbookmarkx{http://blog.acrotex.net}[action={\URI{http://blog.acrotex.net}},% + color=magenta,style={bf}]{blog} + + +\selectColors{linkColor=black} +\bgroup +\value{secnumdepth}=3 +\value{tocdepth}=3 +\tableofcontents +\egroup +\selectColors{linkColor=webgreen} + +\def\AcroT{Acro\!\TeX}\def\cAcroT{\textcolor{blue}{\AcroT}} +\def\AcroEB{\AcroT{} eDucation Bundle}\def\cAcroEB{\textcolor{blue}{\AcroEB}} +\def\AcroB{\AcroT{} Bundle}\def\cAcroB{\textcolor{blue}{\AcroB}} +\def\bUrl{http://www.math.uakron.edu/~dpstory} + +\hypersetup{linktocpage} + +\section{Introduction} + +I was asked by a friend to write a small package to insert a ``mini-toc'' into +the document body, and this is the result of that favor. + +%\begin{center}\minitocFmtvi +%\begin{minipage}[c]{.8\linewidth} +%\TOCLevels{section}{subsubsection} +%\insertminitoc[3]\relax +%\end{minipage} +%\end{center} + + +\section{Required packages and options} + +This package has been tested for the \texttt{book}, \texttt{report}, and \texttt{article} classes. It uses +the {\LaTeX} core commands for building a table of contents---with or without \pkg{hyperref}. One requirement +is that if \pkg{hyperref} is used, it must be loaded \textit{before} this package, so it can be detected. + +There are only two options for this package: +\begin{aebDescript} + \item[\opt{nomintocs}] If this options is in effect, no mini-tocs are + created. Useful during document development. The \pkg{aeb-minitoc} + package reads the \cs{jobname.toc} file each time it encounters the + \cs{insertminitoc}; using this option reduces compile time. The + Boolean switch \cs{ifMiniTocListings} is set to false.\footnote{Refer + to the sample file \texttt{minitoc-art.tex} to see how this switch + might be used.} + \item[\opt{!nominitocs}] The negation of the previous option, when + \opt{!nominitocs} is in effect, mini-tocs are created. This is a + convenience option to make it simple to switch between mini-tocs and + no mini-tocs. +\end{aebDescript} +When no option is passed, mini-tocs are created. + +\newtopic\noindent\llap{\textcolor{red}{{\small\textit{Warning! }}\ding{042}}\enspace}% +This package modifies the entries in the \cs{jobname.toc} file. For this +package to work as designed, it must be loaded after any other package that +modifies the TOC file. + +\section{Commands and methods}\mtoclabel{CandM} + +The few commands this package defines, as well as the discussion of various +methods necessary to design your own mini-toc, are presented in this section. + +\insMinitoci{\minitocFmt} + +\subsection[\protect\miniorfulltoc{\protect\textbf}{Setting the top and bottom levels}]{Setting the top and bottom levels} +%\subsection[\protect\miniorfulltoc{Setting the \protect\emph{top} and \protect\emph{bottom} levels\protect\GOBBLE}{Setting the top and bottom levels}]{Setting the top and bottom levels} + +%\subsection{Setting the top and bottom levels} + +The section title refers to establishing what section entries are to appear in your mini-toc. This can be done +automatically or manually. What is meant by the top and bottom levels? +\begin{itemize} + \item The \emph{top level} is a section name (chapter, part, section, + subsection, paragraph, subparagraph) that you want to list the + subsections of. For example, this document employs article + class, the top most level has been automatically set to section. + Thus, within each section (\cs{section}), a mini-toc can be inserted to list the + titles entries for all subsections, subsubsections, paragraphs, and subparagraphs. + Section~\ref{CandM} is a \cs{section}, and I've inserted a mini-toc just + after the introductory paragraph. + \item The \emph{bottom level} is a section name that is the lowest + section (in the hierarchy) that is to be included in the mini-toc. + In the table above, the bottom level for an article class + is subsubsection. +\end{itemize} + +\subsubsection{Automatically setting the levels} + +The table below displays the automatic default levels. +\begin{quote} +\begin{tabular}{lll} +\bfseries class & \bfseries top-level & \bfseries bottom-level\\\hline +book & chapter & subsection\\ +report & chapter & subsection\\ +article & section & subsubsection +\end{tabular} +\end{quote} + +\subsubsection{Manually setting the levels} + +The top and bottom levels may be set with the commands \cs{TOPLevel\darg{\ameta{top-level}}} and +\cs{BTMLevel\darg{\ameta{btm-level}}}, respectively. For example, declaring +\begin{Verbatim}[xleftmargin=\amtIndent,commandchars=!()] +\TOPLevel{section} +\BTMLevel{paragraph} +%!normalfont( or alternatively) +\TOCLevels{section}{paragraph} +\end{Verbatim} +in an article class document will include any \cs{paragraph} title entries as well, provided +the \texttt{tocdepth} counter is at least 4. + +\cs{TOCLevels\darg{\ameta{top-level}}\darg{\ameta{btm-level}}} combines the +above two commands; the first argument is passed to \cs{TOPLevel} and the +second to \cs{BTMLevel}. If an argument in any of the commands mentioned here +are empty, that level goes unchanged from the current level setting (for the +bottom or top level). + + + +\subsection{The \texorpdfstring{\protect\mlcs{insertminitoc}}{\textbackslash{insertminitoc}} command}\mtoclabel{insertminitoc} + +The main command of this package is, +% +\bVerb\takeMeasure{\string\insertminitoc[\ameta{label-name}]}% +\setlength{\dimen0}{\wd\webtempboxi+2\fboxsep+2\fboxrule}% +\def\1{\rlap{\mbox{\sffamily\hskip\dimen0 (OK to use \texttt{@} in environment)}}} +\begin{dCmd}[commandchars=!()]{\bxSize} +\insertminitoc[!ameta(label-name)] +\end{dCmd} +\eVerb When expanded without its optional argument, it defaults to a reference +to the most recent section. When the optional argument is used, \ameta{label-name} +is the name of a label set by the special \cs{mtoclabel} command, described in +the paragraph \textbf{\mlnameref{para:mtocRef}} on page~\pageref*{para:mtocRef}. + +The \cs{insertminitoc[\ameta{label-name}} expands to a mini-toc that displays the subsections +(subsections here also includes subsubsections, paragraphs, and +subsubparagraphs) of that top-level section down to (and including) the +subsection declared as the bottom level in the \cs{BTMLevel} (or +\cs{TOCLevels}) command. The top-level section is not listed in the mini-toc. + + +\paragraph*{Placement of the command} \leavevmode +\begin{itemize} + \item (The ideal or usual placement) Place \cs{insertminitoc} inside the top-level + section and above any other section heading. In this case, no optional parameter is + needed. For example, assuming the top-level is `section', +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars={!()}] +\section{My cool topics} +... +\insertminitoc\relax %!sffamily( !cs(relax) stops !LaTeX!space from looking for optional argument) +... +\subsection{The very next heading} +... +\end{Verbatim} + \item (Moving the command elsewhere) There may be a need to place a + mini-toc in a less than ideal location. In this case, use the + \cs{mtoclabel\darg{\ameta{label-name}}} command to mark the section + and pass the \ameta{label-name} as the optional argument. To illustrate, + again assume `section' is the top-level for a mini-toc. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars={!@^}] +... +\insertminitoc[myCT] +... +\section{My cool topics}!bfseries\mtoclabel{myCT} +... +!textsf@(Other content, including various section headings)^ +... +\insertminitoc[!textbf@myCT^] +... +\end{Verbatim} +In the above code, a mini-toc is place twice, once before the top-level +section and once well below it. These techniques are illustrated many times +throughout this manual. +\end{itemize} + +\paragraph*{Referencing the top-level section.}\label{para:mtocRef} As mentioned +in the previous paragraph, you can mark section commands (chapter, part, +section, subsection, subsubsection, paragraph, and subparagraph) using a +special label command (\cs{mtoclabel\darg{\ameta{label-name}}}) defined by +\pkg{aeb-minitoc}. For example, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\section{My cool topics}\mtoclabel{myCT} +\end{Verbatim} +The \cs{mtoclabel} command also emits the \cs{label} +command,\footnote{\cs{label} is emitted with the same \ameta{label-name}} +thus, you can both reference the above section in the usual manner +(\verb|Section~\ref{myCT}|) and reference the section in the optional +argument of \cs{insertminitoc} (\cs{insertminitoc[myCT]}). \emph{Do not +pass}\MP{Warning!} a label name to the optional argument of +\cs{insertminitoc} \emph{that has not been declared} using \cs{mtoclabel}. + + + + +\subsubsection{The \texttt{minitocfmt} environment} + +This environment is used to declare the formatting for the mini-toc entries created by +\cs{insertminitoc}. +\bVerb\takeMeasure{... \%\sffamily{ additional \texttt{\string\declaretocfmt} statements}}% +\setlength{\dimen0}{\wd\webtempboxi+2\fboxsep+2\fboxrule}% +\def\1{\rlap{\mbox{\sffamily\hskip\dimen0 (OK to use \texttt{@} in environment)}}} +\begin{dCmd}[commandchars=!()]{\bxSize} +\begin{minitocfmt}{\!ameta(cmdName)} +\@A{!ameta(various)} %!sffamily( optional) +!1\declaretocfmt{!ameta(sec-name)}{!ameta(various)} +\declaretocfmt{!ameta(sec-name)*}{!ameta(various)} +... %!sffamily( additional !texttt(\declaretocfmt) statements) +\end{minitocfmt} +\end{dCmd} +\eVerb The purpose of this environment is to define formatting for a mini-toc. The formatting +commands are saved in the body of the macro \cs{\ameta{cmdName}}; expand this macro prior to +\cs{insertminitoc} to get the formatting declared within the environment. + +The content of the environment takes two types of commands: +\begin{description} + \item[\cs{@A\darg{\ameta{various}}}]\hskip-.5em\relax\space is a command that is not used very + often, but is available when needed. The argument \ameta{various} is + various commands to support the min-toc being generated. For example, + Assuming \pkg{hyperref} is loaded and you want to change the color of + the page links. What you can do is + \cs{@A\darg{\string\def\string\@linkcolor\darg{blue}}}; this defines the link color that + \pkg{hyperref} will use to color the link. It is done in a group, so + it does not affect content outside the environment. +\begin{description} + \item[\cs{@PW\darg{\ameta{length}}}] Within\MP{pg num box width} the argument of + \cs{@A}, you can insert \cs{@PW\darg{\ameta{length}}} to set + the width of the box that contains the page number + (\cs{@pnumwidth}). The value set by {\LaTeX} is + \texttt{1.55em}. + \item[\cs{@DS\darg{\ameta{num}}}] The \ameta{num}\MP{dots separation} determines the + separation between dots for a TOC entry that uses a dotted rule + line. This command is only recognized within the argument of + \cs{@A}. The default is 4.5. + \item[\cs{@R\darg{\ameta{length}}}]\hskip-.5em\space is a\MP{right margin of title} + convenience command, it takes its argument and defines the + {\LaTeX} command \cs{@tocrmarg}, which sets the right margin + for the sec-title. The length set by {\LaTeX} is + \texttt{2.55em}. The \ameta{length} of \cs{@R} should be \emph{larger + than} the \ameta{length} set by \cs{@PW}. +\end{description} + \item[\cs{declaretocfmt\darg{\ameta{sec-name}}\darg{\ameta{various}}}] + This command formats all \ameta{sec-name} (section, subsection, etc.) entries. + + A `typical' table of contents entry has the form: +\begin{quote}\ttfamily +\ameta{sec-num}\:\ameta{title-heading}\dotfill\ameta{pg-num} +\end{quote} +Should you include sections in your document that have no section number +(either by setting \cs{setcounter\darg{secnumdepth}} to a smaller number or +by manually placing a \texttt{*}-section into the table of contents), the +\ameta{sec-num} does not appear. For these types of entries, use a +\texttt{*}-declaration +\cs{declaretocfmt\darg{\ameta{sec-name}*}\allowbreak\darg{\ameta{various}}}.\footnote{Refer to +sample file \texttt{minitoc-art-star.tex} for an example of this.} + +Within the \ameta{various} argument, there are a number of commands that +are recognized: +\begin{description} + \item[\cs{@W\darg{\ameta{length}}}]\hskip-.5em\relax\space is\MP{sec + num box width} the width of the box that encloses + \ameta{sec-num}. Normally, all lengths are measured in + \texttt{em} units (\cs{@W\darg{\ameta{num}em}}). The default + length is \texttt{2.5em} + \item[\cs{@D\darg{\ameta{length}}}]\hskip-.5em\relax\space is\MP{use dots} the + amount to indent prior to \ameta{sec-num}. Again, \texttt{em} + units preferred (\cs{@D\darg{\ameta{num}em}}). When the \cs{@D} + command is present in the argument, a dotted line is + to be used for the entry (this is the norm). If \cs{@D} not + present, there is an opportunity within the \ameta{various} + argument to create a custom entry. See the example + \textbf{\nameref{subpara:Custom}} on + page~\pageref*{subpara:Custom} for more information. + \item[\cs{@B\darg{\ameta{length}}}] Same as \cs{@D}\MP{no dots}, but no dotted leaders are created. + \item[\cs{@N\darg{\ameta{fmt}}}]\hskip-.5em\relax\space is\MP{fmt sec num} the + formatting for \ameta{sec-num}. You can pass a command with one + argument that will operate on the section number; for example, + \cs{@N\darg{\cs{textbf}}}, \cs{@N\darg{\cs{color\darg{blue}}}}, + or \cs{@N\darg{\cs{color\darg{blue}}\cs{textbf}}}. Note that + changing the style to bold might require a corresponding change + in \cs{@W}. + \item[\cs{@F\darg{\ameta{fmt}}}]\hskip-.5em\relax\space is\MP{fmt title} the formatting + for the title heading of the current section; for example, \cs{@F\darg{\string\bfseries}} + turns all heading, for this \ameta{sec-name}, bold. + \item[\cs{@P\darg{\ameta{fmt}}}]\hskip-.5em\relax\space is the\MP{fmt pg num} + formatting for the page number (\ameta{pg-num}). You can pass a + command with one argument that will operate on the page number + When \pkg{hyperref} is loaded with the \opt{colorlinks} option, + we cannot change the color of the page number (see the discussion + of \cs{@A} above), but \cs{@P\darg{\string\textit}} changes the + numbers to italics. If \pkg{hyperref} is not loaded, + \cs{@P\darg{\string\color\darg{red}\string\textit}} changes page + numbers to a red italic. + \item[\cs{@R\darg{\ameta{length}}}]\hskip-.5em\space is\MP{right margin of title} a convenience + command, it takes its argument and defined the {\LaTeX} command + \cs{@tocrmarg}, which sets the right margin for the sec-title. + The length set by {\LaTeX} is \texttt{2.55em}. Setting \cs{@R} + within the \ameta{various} argument of \cs{declaretocfmt} affects + the current section level as well as all lower section levels. If + you want to make this `local' change, you need to put \cs{@R} + back to its default of \texttt{2.55em} locally for other + declarations. + \item[\cs{@E}] Within\MP{TOC number} the \env{minitocfmt} environment, the command + \cs{@E} expands to the current TOC entry number of the TOC entry + being read in. Read the discussion in + \hyperref[MPW]{Section~\ref*{MPW}}, page~\pageref*{MPW}, for more + information. The paragraph \textbf{\mlnameref{subpara:@E}} on + page~\pageref*{subpara:@E} discusses one possible use of this + command. + \item[\cs{@L}] This\MP{link anchor} macro expands to the \pkg{hyperref} anchor of the + page entry reference, it is empty if \pkg{hyperref} is not + loaded. + \item[\cs{@Pg}] This\MP{pg number} macro expands to the page number this entry + references. + \end{description} +\end{description} +A useful macro, as we shall see in the subsequent examples, is +\cs{mtocgobble}\MP{\cs{mtocgobble} described}, defined by \pkg{aeb-minitoc}. The macro absorbs (gobbles) the next token. +For those unfamiliar with such a macro, here is a simple example: My name is +\verb~D. P. Stor\mtocgobble{e}y~, this code expands to ``D. P. Stor\mtocgobble{e}y''. Not so impressive, +but the argument of \cs{mtocgobble} is oftentimes another macro or an expression grouped by braces (\texttt{\{\}}). +For example, \verb~\def\dps{ there}Don says `Hi\mtocgobble\dps!'~, which expands to +\def\dps{ there}``Don says `Hi\mtocgobble\dps!''' See the paragraph \textbf{\nameref{spara:LPg}} on page~\pageref*{spara:LPg} +for an example of use. The macro is also used in some of the example files. + +\subsubsection{Some examples that illuminate}\mtoclabel{SExmpls} + +Having introduced the basic command structure for \pkg{aeb-minitoc}, let's +now do some examples. For your convenience, we present a mini-toc of the examples of this section. + +\begin{center}\minitocFmtv +\TOCLevels{subsubsection}{subparagraph} +\begin{minipage}[c]{0.8\linewidth} +\insertminitoc\relax +\end{minipage} +\end{center} + + +\paragraph[Some basic examples]{Some basic examples.} We present some examples that illustrate +the special commands described above, these are \cs{@W}, \cs{@D}, \cs{@N}, and \cs{@F}. + +\subparagraph{First Example.} We begin with the mini-toc on +page~\pageref{CandM}.\medskip \bVerb\TOCLevels{section}{subsubsection} +\noindent\hskip-62.5pt\begin{minipage}{\linewidth+62.5pt} +\begin{minipage}[c]{.5\linewidth-5pt}\small\kern0pt +\minitocFmt\insertminitoc[CandM] +\end{minipage}\hfill +\begin{minipage}[c]{.5\linewidth-5pt}\kern0pt +\begin{Verbatim}[fontsize=\small] +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{subsectn + {\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}} +\end{minitocfmt} +... +\begin{center}\minitocFmt +\begin{minipage}[c]{0.8\linewidth} +\insertminitoc[CandM] +\end{minipage} +\end{center} +\end{Verbatim} +\end{minipage} +\end{minipage} +\medskip\eVerb \textbf{Important Rule:} The value of \cs{@D} for one level is +(usually) the sum of the values of \cs{@W} and \cs{@D} from the one level higher up; +thus, for \texttt{subsubsection}, I put \cs{@D\darg{2.5em}}, \texttt{2.5em} is the sum +of \texttt{2.5em} and \texttt{0em}, in the \texttt{subsection} declarations. + +\subparagraph{The TOC listing on page~\pageref*{SExmpls}.} Within the +\cs{subsubsection}, titled `\mlnameref{SExmpls}', place another +\cs{insertminitoc} after we define a new \env{minitocfmt} environment and +reset the TOC levels. +\medskip +\bVerb\TOCLevels{section}{subsubsection} +\noindent\hskip-62.5pt\begin{minipage}{\linewidth+62.5pt} +\begin{minipage}[c]{.5\linewidth-5pt}\kern0pt +\TOCLevels{subsubsection}{subparagraph}\small +\minitocFmtv\insertminitoc[SExmpls] +\end{minipage}\hfill +\begin{minipage}[c]{.5\linewidth-5pt}\kern0pt +\begin{Verbatim}[fontsize=\small] +\TOCLevels{subsubsection}{subparagraph} +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{paragraph} + {\@W{1em}\@D{0em}\@R{1.55em plus 2em}} +\declaretocfmt{subparagraph} + {\@W{1.5em}\@D{1em}} +\end{minitocfmt} +... +\begin{center}\minitocFmt +\begin{minipage}[c]{0.8\linewidth} +\insertminitoc[SExmpls] +\end{minipage} +\end{center} +\end{Verbatim} +\end{minipage} +\end{minipage} +\medskip\eVerb + +\noindent\llap{\textcolor{red}{\ding{042}}\enspace}% +At this point onward, we will not display the part of the verbatim code containing \cs{insertminitoc} as they are +all similar to the two examples above. + + +\subparagraph[Color the page numbers]{Color the page numbers.} We use the +command \cs{@A} to color the pages. Because \pkg{hyperref} is used in this +document, we pass a redefinition of the link color through \cs{@A}. +\medskip \bVerb\par +\TOCLevels{section}{subsubsection} +\noindent\hskip-62.5pt\begin{minipage}{\linewidth+62.5pt}% +\begin{minipage}[c]{.5\linewidth-5pt}\hfuzz2pt\small\kern0pt +\minitocFmti\insertminitoc[CandM]% +\end{minipage}\hfill +\begin{minipage}[c]{.5\linewidth-5pt}\kern0pt +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmt} +!textbf(\@A{\def\@linkcolor{red}}) +\declaretocfmt{subsection} + {\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}} +\end{minitocfmt} +\end{Verbatim} +\end{minipage} +\end{minipage} +\medskip\eVerb Notice the second line in the right column, highlighted in bold. + +%... +%\begin{center}\minitocFmt +%\begin{minipage}[c]{0.8\linewidth} +%\insertminitoc[CandM] +%\end{minipage} +%\end{center} + +\subparagraph[Make section numbers bold]{Make section numbers bold.} The \cs{@N} command is used. +\medskip \bVerb +\TOCLevels{section}{subsubsection} +\noindent\hskip-62.5pt\begin{minipage}{\linewidth+62.5pt} +\begin{minipage}[c]{.5\linewidth-5pt}\small\kern0pt +\minitocFmtii\insertminitoc[CandM] +\end{minipage}\hfill +\begin{minipage}[c]{.5\linewidth-5pt}\kern0pt +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{subsection} + {\@W{2.5em}\@D{0em}!textbf(\@N{\textbf})} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\end{Verbatim} +\end{minipage} +\end{minipage} +\eVerb + +%... +%\begin{center}\minitocFmt +%\begin{minipage}[c]{0.8\linewidth} +%\insertminitoc[CandM] +%\end{minipage} +%\end{center} + + +\subparagraph[Make section headings some bold, some blue] + {Make section headings some bold, some blue.} The \cs{@F} command is used. +\medskip \bVerb +\TOCLevels{section}{subsubsection} +\noindent\hskip-62.5pt\begin{minipage}{\linewidth+62.5pt} +\begin{minipage}[c]{.5\linewidth-5pt}\small\kern0pt +\minitocFmtvii +\insertminitoc[CandM] +\end{minipage}\hfill +\begin{minipage}[c]{.5\linewidth-5pt}\kern0pt +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{subsection} + {\@W{2.5em}\@D{0em}!textbf(\@F{\bfseries})} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}!textbf(\@F{\color{blue}})} +\end{minitocfmt} +\end{Verbatim} +\end{minipage} +\end{minipage} +\eVerb + +%... +%\begin{center}\minitocFmt +%\begin{minipage}[c]{0.8\linewidth} +%\insertminitoc[CandM] +%\end{minipage} +%\end{center} + + +\paragraph[Some more advanced examples]{Some more advanced examples.} +Now for some trickier examples. These are increasing in complexity. + +\subparagraph[Formatting sections with no section number]{Formatting sections +with no section number.}\label{spara:noNums} Again, by `section', all sections are referred to +(chapter, part, section, subsection, subsubsection, paragraph, and +subparagraph). In section~\ref{myRetirement}, I've created a subsection using +\cs{subsection*}. Such a section heading has no section number and is written +to the TOC file, by default. First, we need to get it into the TOC file (\cs{jobname.toc}); this +is done as follows: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\section{My retirement}\mtoclabel{myRetirement} + +\subsection*{Time to get back to it, \dps} +\addcontentsline{toc}{subsection}{Time to get back to it, + \texorpdfstring{\protect\dps}{dps}} +\end{Verbatim} +We mark it with \cs{mtoclabel}. Now we create a \env{minitocfmt} environment: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmtstar} +!textbf(\declaretocfmt{subsection*}){\@W{0em}\@D{0em}} %!sffamily( declare a star-section fmt) +\end{minitocfmt} +\insMinitoctab[myRetirement] %!textsf( !cs(nsMinitoctab) discussed beginning on page !pageref(ss:AltPresent)) + {\TOCLevels{section}{subsection}\minitocFmtstar} +\end{Verbatim} +\begin{minitocfmt}{\minitocFmtstar} +\declaretocfmt{subsection*}{\@W{0em}\@D{0em}} +\end{minitocfmt} +\insMinitoctab[myRetirement]{\TOCLevels{section}{subsection}\minitocFmtstar} +\newtopic\indent Any section that does not have a number (more technically, +a \cs{numberline} command its entry in the TOC file), \pkg{aeb-minitoc} considers +a star-section. Formatting for star-section is done by declaring +\cs{declaretocfmt\darg{\ameta{sec-name}*}}, as above. + + +\subparagraph[Formatting individual title headings]{Formatting individual +title headings.} Suppose we wanted to put the section title for section 3.1 +in bold font \emph{only}. After some experimentation, I determined the best +course for doing this is through the optional argument of the section +commands.\footnote{The same effects can be done, perhaps, more simply, by +using the techniques of \textbf{\mlnameref{subpara:@E}}, +page~\pageref*{subpara:@E}; however, this technique can make custom changes +that \cs{@E} cannot; refer to the \textbf{\textcolor{red}{Question}} on the +next page.} \medbreak \bVerb The section command for that section is, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +\subsection[\protect!textbf(\miniorfulltoc){\protect\textbf} + {Setting the top and bottom levels}]{Setting the top and bottom levels} +\end{Verbatim} +\par\medskip +\TOCLevels{section}{subsubsection} +\noindent\hskip-62.5pt\begin{minipage}{\linewidth+62.5pt} +\begin{minipage}[c]{.5\linewidth-5pt}\small\kern0pt +\minitocFmtiv\insertminitoc[CandM] +\end{minipage}\hfill +\begin{minipage}[c]{.5\linewidth-5pt}\kern0pt +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmt} +!textbf(\@A{\FmtTOCEntry}) +\declaretocfmt{subsection} + {\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}} +\end{minitocfmt} +\end{Verbatim} +\end{minipage} +\end{minipage} +\medskip\eVerb \cs{miniorfulltoc\darg{\ameta{fmt}}\darg{\ameta{toc-sec-heading}}}, when inserted into +the optional argument, will form the toc-entry. When read in by \cs{insertminitoc}, +\begin{quote}\cs{miniorfulltoc\darg{\ameta{fmt}}\darg{\ameta{toc-sec-heading}}}\end{quote} expands to +\texttt{\darg{\ameta{fmt}\darg{\ameta{toc-sec-heading}}}} when the command +\cs{FmtTOCEntry} is in effect (see next paragraph); when read outside the +expansion of \cs{insertminitoc} (that is, when \cs{tableofcontents} is +read), it expands to \texttt{\ameta{toc-sec-heading}}, the usual expression. + +%... +%\begin{center}\minitocFmt +%\begin{minipage}[c]{0.8\linewidth} +%\insertminitoc[CandM] +%\end{minipage} +%\end{center} + + +The special formatting declared with the \cs{miniorfulltoc} is activated by +a special command \cs{FmtTOCEntry}\MP{\cs{FmtTOCEntry}}, passed through the \cs{@A} command. +Refer to the verbatim listing of the last example; shown in bold is +\cs{@A\darg{\cs{FmtTOCEntry}}} and causes this alternate formatting to take +effect; this is a command not mentioned earlier.\footnote{In addition to +\cs{FmtTOCEntry} there is also \cs{NoFmtTOCEntry}.} Actually, +\cs{FmtTOCEntry} (and \cs{NoFmtTOCEntry}) can be used outside the +\env{minitocfmt} environment to turn on or off the special formatting. + +\newtopic\noindent\textcolor{red}{\textbf{Question:}} How would you modify, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\subsection[\protect\miniorfulltoc{\protect\textbf} + {Setting the top and bottom levels}]{Setting the top and bottom levels} +\end{Verbatim} +so that `Setting the \emph{top} and \emph{bottom} levels' appears in a mini-toc, \emph{without} +this same formatted entry appearing in the main table of contents? + +See the sample \texttt{minitoc-art.tex} for examples of the use of \cs{miniorfulltoc}. + +%\subsection[\protect\miniorfulltoc{Setting the \protect\emph{top} and \protect\emph{bottom} levels\protect\mtocgobble}{Setting the top and bottom levels}]{Setting the top and bottom levels} + + +\subparagraph[A custom entry for \protect\mlcs{subsubsection}]{A custom entry for +\texorpdfstring{\protect\mlcs{subsubsection}}{\textbackslash{subsubsection}}.}\label{subpara:Custom} For the subsubsection level, +this document uses a bullet (\textbullet) instead of a section number. For this example, we present an alternate +TOC, consistent with the style the \pkg{web} package has used for years. + +\begin{center}\minitocFmtvi +\TOCLevels{section}{subsubsection}% +\begin{minipage}[c]{.8\linewidth} +\insertminitoc[CandM] +\end{minipage} +\end{center} +The verbatim listing is given below. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\begin{minitocfmt}{\minitocFmt}\@A{\@PW{1em}} +\declaretocfmt{subsection}{\@W{2em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\@R{1.55em plus 2em}% + \leftskip2em\rightskip\@tocrmarg {#1},\nobreak{ #2}\allowbreak} +\end{minitocfmt} +\end{Verbatim} +\noindent When neither \cs{@D} nor \cs{@B} appears in the +\ameta{various} argument of \cs{declaretocfmt}, the formatting for the +entry must be created using low-level methods. That is what is done in the +declaration of \texttt{subsubsection}: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\declaretocfmt{subsubsection}{\@W{1em}\@R{1.55em plus 2em}% + \leftskip2em\rightskip\@tocrmarg {#1},\nobreak{ #2}\enspace\allowbreak} +\end{Verbatim} +\textbf{Important Point:} When \cs{@D} and \cs{@B} \emph{do not appear}, +\texttt{\#1} is the sec-num (in a box) followed by the sec-title; +\texttt{\#2} is the page number. + +%... +%\begin{center}\minitocFmt +%\begin{minipage}[c]{0.8\linewidth} +%\insertminitoc[CandM] +%\end{minipage} +%\end{center} + + +\newtopic\noindent\textbf{Comments on listing.} We reduce this width of the +box containing \ameta{page-num} by passing \cs{@PW\darg{1em}} through the +argument of \cs{@A}. We set the box width for the section number (a symbol in +this case) with \cs{@W\darg{1em}}. \cs{@R} takes it argument and defines +\cs{@tocrmarg}, which sets the right margin of the section-title; here, we +place a little rubber glue so the title can warp around in a narrow column +much better. We set the left and right margins with \cs{leftskip2em} and +\cs{rightskip\cs{@tocrmarg}}; \texttt{2em} is used for \cs{leftskip}, since +that is the sum of the \cs{@W} and \cs{@D} values for the level immediately +above it. Next comes \texttt{\darg{\#1}}, which is the sec-num (a +`\verb~$\bullet$~' in a box of width \texttt{1em}) followed by the sec-title. +We then insert a comma followed by the page number \texttt{\darg{~\#2}}, followed +in turn by a small space and \cs{allowbreak}. + +\subparagraph[Using \texorpdfstring{{\protect\mlcs{@E}}}{\textbackslash{@E}} for greater formatting control]% + {Using \cs{@E} for greater formatting control.}\label{subpara:@E} The \cs{@E} command can be used + for finer control over the format of a mini-toc, in fact, it allows some logic to be applied. Suppose + we want to highlight Section~3.2 and all of its subsections. + +\begin{minitocfmt}{\minitocFmtF} +\declaretocfmt{subsection} + {\@W{2.5em}\@D{0em} + \ifthenelse{\@E=\mtocref{insertminitoc}}{\@F{\bfseries}}{}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em} + \ifthenelse{\@E > \mtocref{insertminitoc}\and\@E < \mtocref{MPW}} + {\@F{\color{blue}}}{}} +\end{minitocfmt} +\begin{center} +\begin{minipage}[c]{.8\linewidth} +\TOCLevels{section}{subsubsection} +\minitocFmtF\insertminitoc[CandM]{\minitocFmtF} +\end{minipage} +\end{center} +The verbatim listing for the \env{minitocfmt} environment used is listed below. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmtF} +\declaretocfmt{subsection} + {\@W{2.5em}\@D{0em} + \ifthenelse + {\@E=\mtocref{insertminitoc}} %!sffamily( if this entry is the one we want) + {\@F{\bfseries}} %!sffamily( apply bold font) + {}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em} + \ifthenelse %!sffamily( if after !texttt(insertminitoc) and before !texttt(MPW)) + {\@E > \mtocref{insertminitoc}\and\@E < \mtocref{MPW}} + {\@F{\color{blue}}} %!sffamily( apply blue color) + {}} +\end{minitocfmt} +\end{Verbatim} +The sample file \texttt{minitoc-art.tex} has similar shenanigans. + + +\subparagraph[No leaders using \texorpdfstring{\protect\mlcs{@B}}{\textbackslash{@B}}]{No leaders using \cs{@B}.} We create +a mini-toc in the manner of the main TOC, where no dotted leaders are generated +for the top-most section heading. + +\begin{center} +\begin{minitocfmt}{\minitocFmtB} +\declaretocfmt{subsection} + {\vspace{6pt}\@W{2.5em}\@B{0em}\@F{\bfseries}\@N{\bfseries}\@P{\bfseries}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}} +\end{minitocfmt} +\begin{minipage}[c]{.8\linewidth}\vskip-6pt +\TOCLevels{section}{subsubsection} +\minitocFmtB\insertminitoc[CandM] +\end{minipage} +\end{center} +The verbatim listing is of the \env{minitocfmt} environment used is, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmtB} +\declaretocfmt{subsection} + {\vspace{6pt}\@W{2.5em}!textbf(\@B{0em}) %!sffamily( no dotted leaders) + \@F{\bfseries}\@N{\bfseries}\@P{\bfseries}} %!sffamily( all elements in bold) +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}} +\end{minitocfmt} +\end{Verbatim} +A \cs{vspace} is used to insert some vertical space above a subsection, \cs{@F} is used to make the +section heading entry bold, \cs{@N} makes the section number in bold, and \cs{@P} puts the page number +in bold. + +\subparagraph[Using the + \texorpdfstring{\protect\mlcs{@L} and \protect\mlcs{@Pg}}{\textbackslash{@L} + and \textbackslash{@Pg}} commands] {Using the \cs{@L} and \cs{@Pg} + commands.}\label{spara:LPg} These two commands can be used to, for example, modify the + representation of the page number. Suppose for an entry in the mini-toc + on the same page as the mini-toc, we wanted to typeset `this page' + rather than the page number. + +\begin{center} +\begin{minitocfmt}{\minitocFmtPara} % Para +\@A{\@PW{2.5em}\@R{3.8em}} +\declaretocfmt{paragraph} + { + \@W{1em}\@D{0em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}} + {} + } +\declaretocfmt{subparagraph} + { + \@W{1.5em}\@D{1em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}} + {} + } +\end{minitocfmt} +\minitocFmtPara +\TOCLevels{subsubsection}{subparagraph} +\begin{minipage}[c]{0.8\linewidth}\hfuzz15pt +\insertminitoc[SExmpls] +\end{minipage} +\end{center} +The listing for this \env{minitocfmt} environment is, +The verbatim listing is, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +\begin{minitocfmt}{\minitocFmt} +\@A{\@PW{2.5em}\@R{3.8em}} %!sffamily( adj.! width of page number box and right margin of title) +\declaretocfmt{paragraph}{\@W{1em}\@D{0em} + \ifthenelse{\arabic{page}=\@Pg} %!sffamily( if this page = !cs(@Pg) create a new link) + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}}{}} %!sffamily( else do nothing) +\declaretocfmt{subparagraph}{\@W{1.5em}\@D{1em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}}{}} +\end{minitocfmt} +\end{Verbatim} +Here, we use a \pkg{aeb-minitoc} command: \cs{mtocgobble} is a public +version of the core {\LaTeX} command \cs{@gobble}; it simply absorbs +(gobbles) its argument. What \cs{mtocgobble} is doing in the above code is +gobbling up, what turns out to be, \pkg{hyperref}'s hyperlink code to the +page number. We replace it with our custom code. The anchor is \cs{@L}. +Seems to work. + +\paragraph[Using \texorpdfstring{{\protect\env{minitocfmt}} with the full TOC ({\protect\mlcs{tableofcontents}})} + {Using minitocfmt with the full TOC (\textbackslash{tableofcontents})}]% + {Using \env{minitocfmt} with the full TOC (\cs{tableofcontents}).}\label{para:toc} You will note that + the table of contents for this document goes down to the + \texttt{subsubsection} level, but not \texttt{paragrah} or below. Yet, + for the mini-toc on page~\pageref{SExmpls} contains paragraph and + subparagraph entries. How is this possible? In the preamble of this document, + we have, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\setcounter{tocdepth}{5} \setcounter{secnumdepth}{5} +\end{Verbatim} +Setting \texttt{tocdepth} to 5 causes {\LaTeX} to write table of contents lists to the subsubparagraph +level. \cs{setcounter\darg{secnumdepth}\darg{5}} says that we are to have numbers (or identifiers) +for sections through the subsubparagraph level. When we expand the command \cs{tableofcontents} it under +the following conditions: +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\setcounter{secnumdepth}{3}\setcounter{tocdepth}{3} +\tableofcontents +\end{Verbatim} +You can use \cs{minitocfmt} to design how the main TOC entries are displayed. +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small,commandchars=!()] +\bgroup % !sffamily(make these changes local) +\value{secnumdepth}=3 % !sffamily(!cs(setcounter) is global, this is local) +\value{tocdepth}=3 +\minitocMain +\tableofcontents +\egroup +\end{Verbatim} +where \cs{minitocMain} is defined through a \env{minitocfmt} environment. + + +\subsubsection{Alternate presentations of the mini-toc}\label{ss:AltPresent} + +In all the examples of this manual, a pretty generic presentation of the +mini-tocs was used. In this section, some other presentation styles, or +just use the class style. + +\paragraph[Predefined presentations]{Predefined presentations.} This document defines and uses +several predefined styles, two of which are given below. +\medskip\bVerb +\begin{minipage}[c]{.5\linewidth-5pt} +\begin{Verbatim}[fontsize=\small] +\newcommand{\insMinitocfbox}[2][]{% + \begin{center}#2 + \fbox{% + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}} + \end{center} +} +\end{Verbatim} +\end{minipage}\hfill +\begin{minipage}[c]{.5\linewidth-5pt} +\begin{Verbatim}[fontsize=\small] +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}{c}\toprule + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}\\\bottomrule + \end{tabular} + \end{center} +} +\end{Verbatim} +\end{minipage} +\eVerb Each command takes two arguments, one of which is optional. The +optional argument is passed to the optional argument of \cs{insertmintoc}, +the required argument enters within a group, making its effects local. The +required argument is used to pass a (formatting) command defined by one of +the \env{minitocfmt} environments. + +The definition on the left encloses the mini-toc in an \cs{fbox} while the +one on the right uses a tabular approach. These two are illustrated in the +next two paragraphs. + +\subparagraph{Enclose the mini-toc in an \mlcs{fbox}} + +\insMinitocfbox[CandM]{\TOCLevels{section}{subsubsection}\minitocFmt} + +\noindent The verbatim listing is, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\insMinitocfbox[CandM] + {\TOCLevels{section}{subsubsection}\minitocFmt} +\end{Verbatim} +The \cs{TOCLevels} information is not really needed until just prior to the +expansion of the command \cs{insertminitoc}. A good strategy, therefore, is +to pass it in the argument of \cs{insMinitocfbox}. + +\goodbreak +\subparagraph{Enclose the mini-toc in a ruled tabular environment} + +\insMinitoctab[CandM]{\minitocFmt} + +\noindent +The verbatim listing is, +\begin{Verbatim}[xleftmargin=\amtIndent,fontsize=\small] +\insMinitoctab[CandM] + {\TOCLevels{section}{subsubsection}\minitocFmt} +\end{Verbatim} +The display uses \cs{toprule} and \cs{bottomrule}, defined in the +\pkg{booktabs} package. + +\section{Counters of importance} + +There are two counters that affect the creation of a table of contents: +\begin{description} + \item[\texttt{tocdepth}] The \texttt{tocdepth} counter determines the + depth of the table of contents. To include paragraphs or + subparagraphs, eclare \cs{setcounter\darg{tocdepth}\darg{4}} for + paragraph or \cs{setcounter\darg{tocdepth}\darg{5}} for + subparagraphs in the preamble. For more information, read my + discussion \textbf{\mlnameref{para:toc}} on page~\pageref*{para:toc}. + \item[\texttt{secnumdepth}]\hskip-.5em\relax\space determines the depth of the sections + that will be numbered. If a section is not numbered and in a mini-toc, it is considered + a star-section must be formatted by a \cs{declaretocfmt\darg{\ameta{sec-name}*}\darg{\ameta{various}}} statement. + Read the discussion in the paragraph \textbf{\nameref{spara:noNums}} on page~\pageref*{spara:noNums}. +\end{description} + +\section{Methodology}\mtoclabel{MPW} + +%For the purpose of this discussion, assume \cs{TopLevel\darg{subsubsection}} is in force. + +Each time an \cs{insertminitoc} command is expanded, the \cs{jobname.toc} +file is read in. Any TOC entry prior to the current \ameta{top-level} are +discarded, \footnote{The \ameta{top-level} entry itself is not displayed.} +all TOC entries are displayed that are within the specified range +\cs{TOCLevels\darg{\ameta{top-level}}\darg{\ameta{btm-level}}},\footnote{The +\ameta{btm-level} entry is displayed.} and all entries beginning at the +\emph{next} \ameta{top-level} section are discarded.\footnote{Actually, all +entries beginning at the next entry in the TOC that has a section level +equal to or higher than the \ameta{top-level} are discarded.} + +If you look at the TOC file for your document (when it uses \pkg{aeb-minitoc}), +the entries in that file have this form (for a \pkg{hyperref} document): +\begin{Verbatim}[fontsize=\small,commandchars=!()] +\mtocCL {\contentsline {section} + {\numberline {1}Introduction}{3}{section.1}}{!ameta(entry-cnt)} +\end{Verbatim} +\pkg{aeb-minitoc} encloses each entry as the argument of \cs{mtocCL} (a +macro taking two arguments). When expanding the command +\cs{tableofcontents}, \cs{mtocCL} does nothing.\footnote{It leaves the +first argument (the TOC entry) and gobbles the second argument.} When +expanding the command \cs{insertminitoc}, \cs{mtocCL} removes any entry +that does not contain \cs{contentsline} and does not display any entry that +is not within the \ameta{top-level} to \ameta{btm-level} range; it also +repositions the \ameta{entry-cnt} argument for later use. +Because\MP{Warning!} of the importance of +\cs{mtocCL}, any package that changes the \cs{jobname.toc} file should be +\emph{loaded prior to} \pkg{aeb-minitoc}. + +When you use \cs{mtoclabel\darg{\ameta{label-name}}}, that command acquires +the most recently defined \ameta{entry-cnt}, and save that value as a +macro. (The value can be retrieved by +\cs{mtocref\darg{\ameta{label-name}}}; the use of this macro is normally +not needed.) When \ameta{label-name} is passed to the optional argument of +the \cs{insertminitoc} command, internally +\cs{mtocref\darg{\ameta{label-name}}} is expanded, and this value is used +to (uniquely) identify the desired top-level section. As an example, we +have used \texttt{CandM} a number of times, this is the \ameta{label-name} +created by \cs{mtoclabel} for Section~\ref*{CandM}; the expansion of +\cs{mtocref\darg{CandM}} is `\texttt{\mtocref{CandM}}'.\footnote{This `\texttt{\mtocref{CandM}}' +does not refer to Section~3, but means this is the third TOC entry in the file \cs{jobname.toc}.} In this way, each +item in the table of contents has a unique designator. + +%The system works well when the \ameta{top-level} section generates a unique +%section number. This unique section number is used to detect when the +%\ameta{top-level} begins and when it ends (by the detection of the +%\textit{next} \ameta{top-level}. + +\begin{comment} +\subsection{The \texorpdfstring{{\protect\ameta{top-level}}}{} + uses a unique section number}\mtoclabel{s:toplevelRef} + +This is the most frequently case. The only problem is when the \cs{insertminitoc} command +is placed outside scope of the \ameta{top-level}. There are two courses of action: +\begin{enumerate} + \item Pass the unique \ameta{top-level} section number to the optional argument of + the command \cs{insertminitoc}; below we expand \verb|\insMinitoctab[CandM]{\minitocFmt}|: + + \TOCLevels{section}{subsubsection} + \insMinitoctab[CandM]{\minitocFmt} + + We obtain the Section~3 listing even though we are in Section~4. + + \item A problem occurs with method~1 when an additional section is + inserted above Section~3, so, Section~3 becomes Section~4, and the + above code would get the listing of the new Section~3, which is not + what we want. + + To solve this problem, \pkg{aeb-minitoc} defines two commands: + \cs{mtoclabel\darg{\ameta{name}}} and \cs{mtocref\darg{\ameta{name}}}, analogous \cs{label} + and \cs{ref}. To avoid duplication of effort, \cs{mtoclabel\darg{\ameta{name}}} also + expands \cs{label{\darg{\ameta{name}}}}. \cs{mtoclabel} saves its unique section number, and + can then be retrieved by \cs{mtocref} and passed to the optional first argument of + \cs{insertminitoc}. The listing below is the expansion of + \verb|\insMinitoctab[CandM]{\minitocFmt}|: + + \insMinitoctab[CandM]{\minitocFmt} + + Where Section~\ref*{CandM} is labeled as + \cs{mtoclabel\darg{CandM}}. Use the \cs{mtoclabel} command at a + \ameta{top-level} section in which a mini-toc is built, or if a + mini-toc is built outside the scope of that section. +\end{enumerate} + + +\subsection{The \texorpdfstring{\protect\ameta{top-level}}{} + does not use a unique section number} + + What if the \ameta{top-level} section does not generate a unique number? + To illustrate this problem we use the \cs{subsubsection} named + `\mlnameref{SExmpls}' on page~\pageref*{SExmpls}. You'll note that + at the \cs{subsubsection} level, a bullet ($\bullet$) as the section + identifier. This creates problem with detecting when the section + (sub-sub-section) begins, and most importantly end. + + \subsubsection{\texorpdfstring{\protect\pkg{hyperref}}{hyperref} loaded} + + Even though \cs{subsubsection} does not have a unique section number, + \pkg{hyperref} provides it in the file \cs{jobname.toc}. +\begin{Verbatim}[fontsize=\small] +\mtocCL{\contentsline {subsubsection} + {\numberline {{$\bullet $}}Some examples that + illuminate}{6}{subsubsection.3.2.2}} +\end{Verbatim} +Where, the entry is wrapped around. \pkg{hyperref} adds an argument to the +end of the classic {\LaTeX} \cs{contentsline}; in this case it is +\texttt{\darg{subsubsection.3.2.2}}. \pkg{aeb-minitoc} uses this number as +its required unique section identifier. As a result, nothing special is needed. +To list the TOC structure of the section titled `\nameref{SExmpls}', we simple +expand \verb!\insMinitoctab[SExmpls]{\minitocFmt}! to get: + +\insMinitoctab[SExmpls]{\TOCLevels{subsubsection}{subparagraph}\minitocFmt} + +Cool! + + + \subsubsection{\texorpdfstring{\protect\pkg{hyperref}}{hyperref} not loaded} + + This is the problem child. The TOC entry + in \cs{jobname.toc} would look like this: +\begin{Verbatim}[fontsize=\small] +\mtocCL{\contentsline {subsubsection} + {\numberline {{$\bullet $}}Some examples that illuminate}{6}} +\end{Verbatim} +No unique section identifier is found. In this case, we have to create one using +a special command \cs{mtocSecFmt\darg{\ameta{sec-name}}\darg{\ameta{sec-identifier}}}. +\begin{Verbatim}[fontsize=\small] +\renewcommand*{\thesubsubsection}{\mtocSecFmt{subsubsection}{$\bullet$}} +%\renewcommand*{\thesubsubsection} +% {\texorpdfstring{\mtocSecFmt{subsubsection}{$\bullet$}}{\textbullet}} +\end{Verbatim} +The second one (commented out) is how the definition is made for \pkg{hyperref}, though +for a \pkg{hyperref} document, such a redefinition is not needed. + +With the above redefinition made for a non-\pkg{hyperref} document, an +\texttt{subsubsection} entry in \cs{jobname.toc} has the following form: +\begin{Verbatim}[fontsize=\small] +\mtocCL{\contentsline {subsubsection} + {\numberline {\mtocsecfmt {$\bullet $}{3.2.2}Some examples + that illuminate}{6}} +\end{Verbatim} +\pkg{aeb-minitoc} then picks off and uses the section identifier. +\cs{mtoclabel} uses the section identifier so you can pass +\cs{mtocref\darg{\ameta{name}}} to the optional argument of the command +\cs{insertminitoc}. + +\end{comment} + +\section{Sample files} The demonstration files are found in the \texttt{examples} folder. + + All examples given in this manual can be found in +\texttt{manual-exmpls-bullets.tex} and \texttt{manual-exmpls-default.tex}. + +%The \pkg{xcolor} package is used, otherwise, the packages used are minimal. +%The spelling of the \ameta{sec-name} must be exact, to repeat, the names +%are chapter, part, section, subsection, paragraph, and subparagraph. Not +%all names are defined for all classes. + +\section{My retirement}\mtoclabel{myRetirement} + +\subsection*{Time to get back to it, \dps} +\addcontentsline{toc}{subsection}{Time to get back to it, \texorpdfstring{\protect\dps}{dps}} + + +\end{document} diff --git a/texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-bullets.tex b/texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-bullets.tex new file mode 100644 index 00000000..755253d8 --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-bullets.tex @@ -0,0 +1,296 @@ +\documentclass{article} +\usepackage{xcolor} +\usepackage[linktocpage,colorlinks,bookmarksnumbered]{hyperref} +\usepackage{booktabs} +\usepackage[!nominitocs]{aeb-minitoc} +\usepackage{ifthen} + +\let\db\mtocgobble + +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{5} + + +\makeatletter +% redefinitions necessitated by the special bullet glyph for the subsubsection level +% see the file manual-exmpls-nobullets.tex to see this file using normal numbering +\renewcommand*{\thesubsubsection}{\texorpdfstring{$\bullet$}{\textbullet}} +\renewcommand*{\theparagraph}{\texorpdfstring{\protect\P}{\textparagraph}} +\renewcommand*{\thesubparagraph}{\texorpdfstring{\protect\P\protect\P}{\textparagraph\textparagraph}} +\let\section@mtocSAVE\section +\renewcommand\section{\renewcommand{\@seccntformat}[1]{\thesection\space}% + \section@mtocSAVE} +\let\subsection@mtocSAVE\subsection +\renewcommand\subsection{\renewcommand{\@seccntformat}[1]{\thesubsection\space}% + \subsection@mtocSAVE} +\let\subsubsection@mtocSAVE\subsubsection +\renewcommand\subsubsection{\renewcommand{\@seccntformat}[1]{\thesubsubsection\space}% + \subsubsection@mtocSAVE} +\renewcommand{\paragraph} + {\renewcommand{\@seccntformat}[1]{\theparagraph\space}% + \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}} +\renewcommand*\l@paragraph{\@dottedtocline{4}{5.0em}{1em}} %{7.0em}{4.1em}} +\renewcommand{\subparagraph} + {\renewcommand{\@seccntformat}[1]{\thesubparagraph\space}% + \@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}{\bfseries}} +\def\cs#1{\texttt{\@backslashchar#1}} +\makeatother + +\title{Examples from the aeb-minitoc manual} +\author{D. P. Story} + +\begin{minitocfmt}{\minitocFmtFullToc} +% we can declare toc fmtting for section level, but +% in the main toc, sections have special formatting, we leave it alone. +\declaretocfmt{subsection}{\@W{2em}\@D{1.55em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{3.55em}} +\end{minitocfmt} + + +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmti} +\@A{\def\@linkcolor{blue}\@PW{1.5em}}% +\declaretocfmt{subsection}{\@R{1.55em\@plus 2em}\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtii} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}\@N{\textbf}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtvii} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}\@F{\bfseries}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}\@F{\color{blue}}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtiv} +\@A{\FmtTOCEntry} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtv} +\declaretocfmt{paragraph}{\@W{1em}\@D{0em}} +\declaretocfmt{subparagraph}{\@W{1.5em}\@D{1em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtvi} +\@A{\@PW{1em}} +\declaretocfmt{subsection}{\@W{2em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em} + \@R{1.55em plus 2em}\leftskip2em\relax + \rightskip\@tocrmarg\relax{#1},\nobreak{ #2}\enspace\allowbreak} %\allowbreak +\end{minitocfmt} + +\newcommand{\insMinitoc}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoci}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + Contents of Section~\ref*{CandM}: \nameref*{CandM} + \par\kern2pt + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}{c}\toprule + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}\\ \bottomrule + \end{tabular} + \end{center} +} + +\newcommand{\insMinitocfbox}[2][]{% + \begin{center}#2 + \fbox{\begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}} + \end{center} +} + + + +\begin{document} + +\maketitle + +\bgroup +\value{secnumdepth}=3 +\value{tocdepth}=3 +\minitocFmtFullToc +\tableofcontents +\egroup + +\newpage + +\section{Introduction} + +Content removed + +\section{Required packages and options} + +Content removed + +\section{Commands and methods}\mtoclabel{CandM} + +\insMinitoci{\minitocFmt} + +\subsection[\protect\miniorfulltoc{\protect\textbf}{Setting the top and bottom levels}]{Setting the top and bottom levels} + +Content removed + +\subsubsection{Automatically setting the levels} + +Content removed + +\subsubsection{Manually setting the levels} + +Content removed + +\subsection{The \texorpdfstring{\protect\cs{insertminitoc}}{\textbackslash{insertminitoc}} command}\mtoclabel{insertminitoc} + +Content removed + +\subsubsection{The \texttt{minitocfmt} environment} + +Content removed + +\subsubsection{Some examples that illuminate}\mtoclabel{SExmpls} + +Content removed + +\goodbreak + +\paragraph{Some basic examples} \leavevmode + +\subparagraph{First Example} \leavevmode + +\insMinitoc[CandM]\minitocFmt + +\subparagraph{The TOC listing on page~\pageref*{SExmpls}} \leavevmode + +\insMinitoc[SExmpls]{\TOCLevels{subsubsection}{subparagraph}\minitocFmtv} + +\subparagraph{Color the page numbers} \leavevmode + +\insMinitoc[CandM]\minitocFmti + +\subparagraph{Make section numbers bold} \leavevmode + +\insMinitoc[CandM]\minitocFmtii + +\subparagraph{Make section headings some bold, some blue} \leavevmode + +\insMinitoc[CandM]\minitocFmtvii + +\paragraph{Some more advanced examples} \leavevmode + +\subparagraph{Formatting sections with no section number} \leavevmode + +\begin{minitocfmt}{\minitocFmtstar} +\declaretocfmt{subsection*}{\@W{0em}\@D{0em}} +\end{minitocfmt} +\insMinitoctab[myRetirement]{\TOCLevels{section}{subsection}\minitocFmtstar} + +\subparagraph{Formatting individual title headings} \leavevmode + +\insMinitoc[CandM]\minitocFmtiv + + +\subparagraph{A custom entry for \protect\cs{subsubsection}} \leavevmode + +\insMinitoc[CandM]\minitocFmtvi + +\subparagraph{Using \texorpdfstring{\protect\cs{@E}}{\textbackslash{@E}} for greater formatting control} \leavevmode + +\begin{minitocfmt}{\minitocFmtF} +\declaretocfmt{subsection} + {\@W{2.5em}\@D{0em} + \ifthenelse{\@E=\mtocref{insertminitoc}}{\@F{\bfseries}}{}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em} + \ifthenelse{\@E > \mtocref{insertminitoc}\and\@E < \mtocref{MPW}} + {\@F{\color{blue}}}{}} +\end{minitocfmt} +\insMinitoc[CandM]{\TOCLevels{section}{subsubsection}\minitocFmtF} + +\subparagraph{No leaders using \texorpdfstring{\protect\cs{@B}}{\textbackslash{@B}}} \leavevmode + +\begin{minitocfmt}{\minitocFmtB} +\declaretocfmt{subsection} + {\vspace{6pt}\@W{2.5em}\@B{0em}\@F{\bfseries}\@N{\bfseries}\@P{\bfseries}} +\declaretocfmt{subsubsection} + {\@W{1em}\@D{2.5em}} +\end{minitocfmt} + +\insMinitoc[CandM]\minitocFmtB + +\subparagraph{Using the + \texorpdfstring{\protect\cs{@L} and \protect\cs{@Pg}}{\textbackslash{@L} + and \textbackslash{@Pg}} commands} \leavevmode + +\begin{minitocfmt}{\minitocFmtPara} % Para +\@A{\@PW{2.5em}\@R{3.8em}} +\declaretocfmt{paragraph} + { + \@W{1em}\@D{0em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}} + {} + } +\declaretocfmt{subparagraph} + { + \@W{1.5em}\@D{1em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}} + {} + } +\end{minitocfmt} + +\insMinitoc[SExmpls]{\TOCLevels{subsubsection}{subparagraph}\minitocFmtPara} + +\paragraph{Using \texorpdfstring{\texttt{minitocfmt} with \protect\cs{tableofcontents}} + {minitocfmt with \textbackslash{tableofcontents}}}\leavevmode + +\subsubsection{Alternate presentations of the mini-toc} + +Content removed + +\paragraph{Predefined presentations} \leavevmode + +Defined in preamble + +\subparagraph{Enclose the mini-toc in an \cs{fbox}} \leavevmode + +\insMinitocfbox[CandM]{\TOCLevels{section}{subsubsection}\minitocFmt} + +\subparagraph{Enclose the mini-toc in a ruled tabular environment} \leavevmode + +\insMinitoctab[CandM]{\minitocFmt} + + +\section{Methodology}\mtoclabel{MPW} + +Content removed + +\section{My retirement}\mtoclabel{myRetirement} + +\subsection*{Time to get back to it, dps} +\addcontentsline{toc}{subsection}{Time to get back to it, dps} + +\end{document} \ No newline at end of file diff --git a/texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-default.tex b/texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-default.tex new file mode 100644 index 00000000..1a9d08ca --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/examples/manual-exmpls-default.tex @@ -0,0 +1,268 @@ +\documentclass{article} +\usepackage[linktocpage,colorlinks,bookmarksnumbered]{hyperref} +\usepackage{booktabs} +\usepackage[!nominitocs]{aeb-minitoc} +\usepackage{ifthen} + +\let\db\mtocgobble + +% Same as manual-exmpls, but with numbers at all levels. Numerous adjustments +% to the mini-toc entries were necessary. + +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{5} + +\makeatletter +\def\cs#1{\texttt{\@backslashchar#1}} +\makeatother + +\title{Examples from the aeb-minitoc manual} +\author{D. P. Story} + +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{subsection}{\@W{1.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{2.5em}\@D{1.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmti} +\@A{\def\@linkcolor{blue}\@PW{1.5em}}% +\declaretocfmt{subsection}{\@W{1.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{2.5em}\@D{1.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtii} +\declaretocfmt{subsection}{\@W{1.7em}\@D{0em}\@N{\textbf}} +\declaretocfmt{subsubsection}{\@W{2.5em}\@D{1.7em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtvii} +\declaretocfmt{subsection}{\@W{1.7em}\@D{0em}\@F{\bfseries}} +\declaretocfmt{subsubsection}{\@W{2.5em}\@D{1.7em}\@F{\color{blue}}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtiv} +\@A{\FmtTOCEntry} +\declaretocfmt{subsection}{\@W{1.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{2.5em}\@D{1.5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtv} +\declaretocfmt{paragraph}{\@W{3.3em}\@D{0em}} +\declaretocfmt{subparagraph}{\@W{4em}\@D{3.3em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtvi} +\@A{\@PW{1em}} +\declaretocfmt{subsection}{\@W{2em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{2.3em} + \@R{1.55em plus 2em}\leftskip2em\relax + \rightskip\@tocrmarg\relax{#1},\nobreak{ #2}\enspace\allowbreak} +\end{minitocfmt} + +\newcommand{\insMinitoc}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoci}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + Contents of Section~\ref*{CandM}: \nameref*{CandM} + \par\kern2pt + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}{c}\toprule + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}\\ \bottomrule + \end{tabular} + \end{center} +} + +\newcommand{\insMinitocfbox}[2][]{% + \begin{center}#2 + \fbox{\begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}} + \end{center} +} + + + +\begin{document} + +\maketitle + +\bgroup +\value{secnumdepth}=3 +\value{tocdepth}=3 +\tableofcontents +\egroup + +\newpage + +\section{Introduction} + +Content removed + +\section{Required packages and options} + +Content removed + +\section{Commands and methods}\mtoclabel{CandM} + +\insMinitoci{\minitocFmt} + +\subsection[\protect\miniorfulltoc{\protect\textbf}{Setting the top and bottom levels}]{Setting the top and bottom levels} + +Content removed + +\subsubsection{Automatically setting the levels} + +Content removed + +\subsubsection{Manually setting the levels} + +Content removed + +\subsection{The \texorpdfstring{\protect\cs{insertminitoc}}{\textbackslash{insertminitoc}} command}\mtoclabel{insertminitoc} + +Content removed + +\subsubsection{The \texttt{minitocfmt} environment} + +Content removed + +\subsubsection{Some examples that illuminate}\mtoclabel{SExmpls} + +Content removed + +\goodbreak + +\paragraph{Some basic examples} \leavevmode + +\subparagraph{First Example} \leavevmode + +\insMinitoc[CandM]\minitocFmt + +\subparagraph{The TOC listing on page~\pageref*{SExmpls}} \leavevmode + +\insMinitoc[SExmpls]{\TOCLevels{subsubsection}{subparagraph}\minitocFmtv} + +\subparagraph{Color the page numbers} \leavevmode + +\insMinitoc[CandM]\minitocFmti + +\subparagraph{Make section numbers bold} \leavevmode + +\insMinitoc[CandM]\minitocFmtii + +\subparagraph{Make section headings some bold, some blue} \leavevmode + +\insMinitoc[CandM]\minitocFmtvii + +\paragraph{Some more advanced examples} \leavevmode + +\subparagraph{Formatting sections with no section number} \leavevmode + +\begin{minitocfmt}{\minitocFmtstar} +\declaretocfmt{subsection*}{\@W{0em}\@D{0em}} +\end{minitocfmt} +\insMinitoctab[myRetirement]{\TOCLevels{section}{subsection}\minitocFmtstar} + +\subparagraph{Formatting individual title headings} \leavevmode + +\insMinitoc[CandM]\minitocFmtiv + + +\subparagraph{A custom entry for \protect\cs{subsubsection}} \leavevmode + +\insMinitoc[CandM]\minitocFmtvi + +\subparagraph{Using \texorpdfstring{\protect\cs{@E}}{\textbackslash{@E}} for greater formatting control} \leavevmode + +\begin{minitocfmt}{\minitocFmtF} +\declaretocfmt{subsection} + {\@W{2em}\@D{0em} + \ifthenelse{\@E=\mtocref{insertminitoc}}{\@F{\bfseries}}{}} +\declaretocfmt{subsubsection} + {\@W{2.5em}\@D{2em} + \ifthenelse{\@E > \mtocref{insertminitoc}\and\@E < \mtocref{MPW}} + {\@F{\color{blue}}}{}} +\end{minitocfmt} +\insMinitoc[CandM]{\TOCLevels{section}{subsubsection}\minitocFmtF} + +\subparagraph{No leaders using \texorpdfstring{\protect\cs{@B}}{\textbackslash{@B}}} \leavevmode + +\begin{minitocfmt}{\minitocFmtB} +\declaretocfmt{subsection} + {\vspace{6pt}\@W{2em}\@B{0em}\@F{\bfseries}\@N{\bfseries}\@P{\bfseries}} +\declaretocfmt{subsubsection} + {\@W{2.5em}\@D{2em}} +\end{minitocfmt} + +\insMinitoc[CandM]\minitocFmtB + +\subparagraph{Using the + \texorpdfstring{\protect\cs{@L} and \protect\cs{@Pg}}{\textbackslash{@L} + and \textbackslash{@Pg}} commands} \leavevmode + +\begin{minitocfmt}{\minitocFmtPara} % Para +\@A{\@PW{2.5em}\@R{7em}} +\declaretocfmt{paragraph} + {% + \@W{3.2em}\@D{0em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}} + {} + } +\declaretocfmt{subparagraph} + {% + \@W{4.1em}\@D{3.2em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\small\hyperlink{\@L}{this page}\mtocgobble}} + {} + } +\end{minitocfmt} + +\hfuzz12pt +\insMinitoc[SExmpls]{\TOCLevels{subsubsection}{subparagraph}\minitocFmtPara} + +\paragraph{Using \texorpdfstring{\texttt{minitocfmt} with \protect\cs{tableofcontents}} + {minitocfmt with \textbackslash{tableofcontents}}}\leavevmode + +\subsubsection{Alternate presentations of the mini-toc} + +Content removed + +\paragraph{Predefined presentations} \leavevmode + +Defined in preamble + +\subparagraph{Enclose the mini-toc in an \texorpdfstring{\protect\cs{fbox}}{\textbackslash{fbox}}} \leavevmode + +\insMinitocfbox[CandM]{\TOCLevels{section}{subsubsection}\minitocFmt} + +\subparagraph{Enclose the mini-toc in a ruled tabular environment} \leavevmode + +\insMinitoctab[CandM]{\minitocFmt} + + +\section{Methodology}\mtoclabel{MPW} + +Content removed + +\section{My retirement}\mtoclabel{myRetirement} + +\subsection*{Time to get back to it, dps} +\addcontentsline{toc}{subsection}{Time to get back to it, dps} + +\end{document} \ No newline at end of file diff --git a/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art-star.tex b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art-star.tex new file mode 100644 index 00000000..ce1dd321 --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art-star.tex @@ -0,0 +1,139 @@ +\documentclass{article} + +%\usepackage{xcolor} +\usepackage[linktocpage,colorlinks]{hyperref} +\usepackage{booktabs} +\usepackage[!nominitocs]{aeb-minitoc} + +\setcounter{secnumdepth}{3} + +\begin{minitocfmt}{\minitocFmt} +\declaretocfmt{subsection}{\@W{1.55em}\@D{0em}\@F{\bfseries}} +\declaretocfmt{subsection*}{\@W{0em}\@D{1.55em}\@F{\bfseries}} +\declaretocfmt{subsubsection}{\@W{2.5em}\@D{1.55em}\@P{\color{red}}\@F{\color{blue}}} +\declaretocfmt{subsubsection*}{\@W{0em}\@D{4.05em}\@F{\color{blue}}} +%\declaretocfmt{subsubsection*}{\@W{0em}\@D{4.05em}\@P{\color{red}}\@F{\color{blue}}} +\end{minitocfmt} + +\newcommand{\insMinitoc}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}{c}\toprule + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}\\ \bottomrule + \end{tabular} + \end{center} +} + + +\begin{document} + +\tableofcontents + +\newpage + + +\section{First of Many} + +The topic headings of this section are listed below. + +\insMinitoctab{\minitocFmt} + +For long section headings, for them to wrap around, we need to take the hyperref option +\texttt{linktocpage}, unless pdflatex or xelatex are used. + +\subsection{Now is the time for all good men to come to the aid of their country, so it has been said} + +\addtocontents{toc}{\protect\vspace{1em}\hfill + Vertical Space\hfill\protect\vspace{1em}} + +\subsection{For all good men} + +Content + +\subsubsection{A subsubsection, let's make it a long subsection to wrap around} + +Content + +\subsubsection{Another one} + +Content + +\subsection{To come to the aid} + +Content + +\subsubsection{A third subsubsection} + +Content + +\subsubsection{A fourth} + +Content + +\subsection{Of their country} + +Content + + +\addcontentsline{toc}{subsection}{Hello world! (subsection*)} %\protect\numberline{} +\subsection*{Hello world! (section*)} + +\addcontentsline{toc}{subsubsection}{Hello world! (subsubsection*)} %\protect\numberline{} +\subsubsection*{Hello world! (subsubsection*)} + + +\newpage + +\section{Second to None} + +\insMinitoctab{\minitocFmt} + + +Content + +\subsection{Peter Piper} + +Content + +\subsubsection{A subsubsection} + +Content + +\subsubsection{Another one} + +Content + +\subsection{Picked a peck} + +Content + +\subsection{Of pickled peppers} + +Content + +\subsubsection{A third subsubsection} + +Content + +\subsubsection{A fourth} + +Content + +\subsection[How many pecks]{How many pecks of pickled peppers} + +Content + +\subsection{Did Peter Piper pick?} + +Content + +\end{document} diff --git a/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.pdf b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.pdf new file mode 100644 index 00000000..ec8542e6 Binary files /dev/null and b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.pdf differ diff --git a/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.tex b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.tex new file mode 100644 index 00000000..d3dd0df1 --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-art.tex @@ -0,0 +1,169 @@ +\documentclass{article} +\usepackage{xcolor} +\usepackage[linktocpage,colorlinks]{hyperref} +\usepackage{booktabs} +\usepackage[!nominitocs]{aeb-minitoc} % try compiling with the nominitocs option +\usepackage{ifthen} + +% Try uncommenting the next line, change subsection to subsection* +% and subsubsection to subsubsection* in the minitocfmt below. What other +% changes are needed to get a good looking mini-toc? +% \setcounter{secnumdepth}{0} + +\begin{minitocfmt}{\minitocFmt} %{tctta} +\@A{\FmtTOCEntry}% +\declaretocfmt{subsection}{\vspace{3pt}% + \@W{1.55em}\@D{0em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\hyperlink{\@L}{\mbox{\strut--}}\mtocgobble}} + {}% +} +\declaretocfmt{subsubsection}{% + \ifthenelse{\mtocref{TST}=\@E} + {\@F{\color{blue}}} + {\ifthenelse{\@E<\mtocref{StoNone}} + {\sffamily}{}}% + \@W{2.5em}\@D{1.5em} + \ifthenelse{\arabic{page}=\@Pg} + {\@P{\hyperlink{\@L}{\mbox{\strut--}}\mtocgobble}} + {} +} +\end{minitocfmt} + +\newcommand{\insMinitoc}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + \ifMiniTocListings + \insertminitoc[#1]\else + \fcolorbox{blue}{yellow}{\makebox[\linewidth][c]{\textbf{A mini-toc goes here}}}\fi + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}{c}\toprule + \begin{minipage}[c]{0.8\linewidth} + \ifMiniTocListings + \insertminitoc[#1]\else + \centering\textbf{A mini-toc goes here}\fi + \end{minipage}\\ \bottomrule + \end{tabular} + \end{center} +} + +\begin{document} + +\tableofcontents + +\newpage + +\section{First of Many} + +The topic headings of this section are listed below. + + +\insMinitoc{\minitocFmt} + + +For long section headings, for them to wrap around, we need to take the hyperref option +\texttt{linktocpage}, unless pdflatex or xelatex are used. + +\subsection{Now is the time for all good men to come to the aid of their country, so it has been said} + +\addtocontents{toc}{\protect\vspace{1em}\hfill + Vertical Space\hfill\protect\vspace{1em}} + +Content + +% Here is a non-tricky example of the \miniorfulltoc usage +\subsection[\protect\miniorfulltoc{\protect\textbf}{For all good men}]{For all good men} + +Content + +\subsubsection{A subsubsection, let's make it a long subsection, shall we}\mtoclabel{TST} + +Content + +\subsubsection{Another one} + +Content + + + +\vfill Page break induced +\newpage + +\subsection{To come to the aid} + +Content + +\subsubsection{A third subsubsection} + +Content + +\subsubsection{A fourth} + +Content + +\subsection{Of their country} + +Content + + +\newpage + +\section{Second to None}\mtoclabel{StoNone} + +\insMinitoctab{\minitocFmt} + + +Content + +\subsection{Peter Piper} + +Content + +\subsubsection{A subsubsection} + +Content + +\subsubsection{Another one} + +Content + +\vfill Page break induced +\newpage + + +\subsection{Picked a peck} + +Content + +\subsection{Of pickled peppers} + +Content + +% Here is the answer to the question posed in the manual. \mtocgobble is a public version of the \@gobble of latex +% These changes do not appear in the table of contents as displayed by \tableofcontents. +\subsubsection[\protect\miniorfulltoc{A \protect\emph{third} sub\protect\textcolor{blue}{sub}section \protect\textcolor{red}{$\Leftarrow$}\protect\mtocgobble}{}]{A third subsubsection} + +Content + +\subsubsection{A fourth} + +Content + +\vfill Page break induced +\newpage + + +\subsection[How many pecks]{How many pecks of pickled peppers} + +Content + +\subsection{Did Peter Piper pick?} + +Content + +\end{document} diff --git a/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bk.tex b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bk.tex new file mode 100644 index 00000000..02f04f02 --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bk.tex @@ -0,0 +1,236 @@ +\documentclass{book} + +% If you remove hyperref, uncomment xcolor +%\usepackage{xcolor} +\usepackage[linktocpage,colorlinks,bookmarksnumbered]{hyperref} + +\usepackage{booktabs} +\usepackage{aeb-minitoc} +\usepackage{multicol} + +\TOPLevel{chapter}\BTMLevel{subsection} +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{5} + +\begin{minitocfmt}{\minitocFmtColor} +\@A{\def\@linkcolor{blue}} +\declaretocfmt{section}{\@W{2.5em}\@D{0em}} +\declaretocfmt{subsection}{\@W{2.5em}\@D{2.5em}\@N{\color{blue}}\@P{\bfseries\textsl}} +\declaretocfmt{subsubsection}{\@W{3.1em}\@D{5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmtColoriiCols} +\@A{\def\@linkcolor{blue}\@DS{2}\@PW{1em}\NoFmtTOCEntry} +\declaretocfmt{section}{\@W{1.6em}\@D{0em}} +\declaretocfmt{subsection}{\@R{1.55em\@plus 2em}\@W{2.6em}\@D{1.5em}\@N{\color{blue}}\@P{\bfseries\textsl} +} +\declaretocfmt{subsubsection}{\@W{3.1em}\@D{5em}} +\end{minitocfmt} + +\begin{minitocfmt}{\minitocFmti} +\declaretocfmt{section}{\@W{2.5em}\@D{0em}} +\declaretocfmt{subsection}{\@W{2.5em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{3.1em}\@D{2.5em}} +\end{minitocfmt} + +\newcommand{\insMinitoc}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}\toprule + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}\\\bottomrule + \end{tabular} + \end{center} +} + +\newcommand{\insMinitociiCols}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{.9\linewidth} +\begin{multicols}{2} + \insertminitoc[#1] +\end{multicols} + \end{minipage} + \end{center} +} + +\let\env\texttt +\let\pkg\textsf +\def\cs#1{\texttt{\char`\\#1}} + + +\begin{document} + +\tableofcontents + +\listoffigures + +\listoftables + +\newpage + +\chapter{My first chapter} + +The topics of this section are listed below. + +\insMinitoc{\TOPLevel{chapter}\BTMLevel{subsection}\small\minitocFmtColor} + +Now let's try a two column format using the \pkg{multicol} package. + +\insMinitociiCols{\TOPLevel{chapter}\BTMLevel{subsection}\small\minitocFmtColoriiCols} + +\noindent We've set the \cs{linewidth} of the \env{minipage} environment to +\texttt{.9\cs{linewidth}} and set the font size to \cs{small}. + +%\newpage + +\section{First of Many} + +\subsection[\protect\miniorfulltoc{\textbf}{Now is the time for all good men to come to the aid of their country, so it has been said}]{Now is the time for all good men to come to the aid of their country, so it has been said} + +Content + +\addtocontents{toc}{\protect\vspace{1em}\hfill + Vertical Space\hfill\protect\vspace{1em}} + +\subsection{For all good men} + +Let's insert a table in this section. + +\begin{table}[htb] +\begin{center} +Hello world 1! +\end{center} +\caption{Cool Table 1} +\end{table} + + +\subsubsection{A subsubsection} + +Content + +\subsubsection{Another one} + +Content + +\subsection{To come to the aid} + +Content + +\begin{table}[htb] +\begin{center} +Hello world 2! +\end{center} +\caption{Cool Table 2} +\end{table} + +\subsubsection{A third subsubsection} + +Content + +\subsubsection{A fourth} + +Content + +\subsection{Of their country} + +Content + + +\newpage + +\section{Second to None} + + +\insMinitoc{\TOPLevel{section}\BTMLevel{subsubsection}\small\minitocFmti} + +\subsection{Peter Piper} + +Content + +\subsubsection{A subsubsection} + +Content + +\subsubsection{Another one} + +Content + +\begin{figure}[htb] +\begin{center} +Hello world 1! +\end{center} +\caption{Cool Figure 1} +\end{figure} + + +\subsection{Picked a peck} + +Content + +\subsection{Of pickled peppers} + +Content + +\subsubsection{A third subsubsection} + +Content + +\subsubsection{A fourth} + +Content + +\subsection[How many pecks]{How many pecks of pickled peppers} + +Content + +\subsection{Did Peter Piper pick?} + +\chapter{Second Chapter} + +Content + +\section{First of Second Chapter} + +\insMinitoc{\TOCLevels{section}{subsubsection}\minitocFmti} + +Content + +\subsection{First: A subsection} + +Content + +\subsubsection{First: A sub-subsection, and let's make it a long one} + +Content + +\subsection{First: Another one} + +Content + +\section{Second Section of Second Chapter} + +\insMinitoc{\TOCLevels{section}{subsubsection}\minitocFmti} + +Content + +\subsection{Second: A subsection} + +Content + +\subsection{Second: Another one} + +Content + +\subsubsection{Second: Another subsub, bub} + + + +\end{document} diff --git a/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bullets-para.tex b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bullets-para.tex new file mode 100644 index 00000000..1a989b6c --- /dev/null +++ b/texmf-dist/doc/latex/aeb-minitoc/examples/minitoc-bullets-para.tex @@ -0,0 +1,211 @@ +\documentclass{article} + +% Use the nameref package to use the \Nameref command +\usepackage{nameref} +% if you use hyperref, nameref is automatically loaded +%\usepackage[linktocpage,colorlinks,bookmarksnumbered]{hyperref} + +\usepackage{booktabs} +\usepackage{aeb-minitoc} + +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{5} +\BTMLevel{subsubsection} + +\renewcommand*{\thesubsubsection}{$\bullet$} +%\renewcommand*{\thesubsubsection}{\texorpdfstring{$\bullet$}{\textbullet}} +\renewcommand*{\theparagraph}{\protect\P} +\renewcommand*{\thesubparagraph}{\protect\P\protect\P} +% definitions for main toc +\makeatletter +\renewcommand\l@paragraph{\@dottedtocline{\sl@paragraph}{5.0em}{1em}} %{7.0em}{4.1em}} +\renewcommand\l@subparagraph{\@dottedtocline{\sl@paragraph}{6.0em}{1.5em}} %{7.0em}{4.1em}} +\renewcommand\@pnumwidth{.55em} + +\renewcommand{\paragraph}{% + \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}} +%\renewcommand*\l@paragraph{\@dottedtocline{4}{5.0em}{1em}} %{7.0em}{4.1em}} +\renewcommand{\subparagraph}{% + \@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}{\bfseries}} +\def\@seccntformat#1{\csname the#1\endcsname\ } +\makeatother + +\begin{minitocfmt}{\fulltocFmt} +\declaretocfmt{subsection}{\@W{1.5em}\@D{1.5em}} +\declaretocfmt{subsubsection}{\@W{1em}\@D{3em}} +\declaretocfmt{paragraph}{\@W{1em}\@D{4em}} +\declaretocfmt{subparagraph}{\@W{1.5em}\@D{5em}} +\end{minitocfmt} + +%\TOCLevels{section}{subsubsubsection} +\begin{minitocfmt}{\minitocFmti} +\declaretocfmt{subsection}{\@W{2em}\@D{0em}} +\declaretocfmt{subsubsection}{\@W{1em}\def\@tocrmarg{1.55em\@plus 2em}\leftskip2em + \rightskip\@tocrmarg {#1},\nobreak{ #2}\enspace\allowbreak} +\end{minitocfmt} + + +%\TOCLevels{subsubsection}{subparagraph} +\begin{minitocfmt}{\minitocFmtii} +\declaretocfmt{paragraph}{\@W{1em}\@D{0em}} +\declaretocfmt{subparagraph}{\@W{1.5em}\@D{1em}} +\end{minitocfmt} + + +\newcommand{\insMinitoc}[2][]{% + \begin{center}#2 + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage} + \end{center} +} + +\newcommand{\insMinitoctab}[2][]{% + \begin{center}#2 + \begin{tabular}{c}\toprule + \begin{minipage}[c]{0.8\linewidth} + \insertminitoc[#1] + \end{minipage}\\ \bottomrule + \end{tabular} + \end{center} +} + + +\begin{document} + +\fulltocFmt + +\tableofcontents + +\newpage + +\section{First of Many} + +Let's introduce a paragraph listing TOC in this section. + +\insMinitoc{\TOCLevels{section}{subsubsection}\minitocFmti} + +As an exercise in referencing a mini-toc outside its natural scope, we list +the paragraphs and subparagraphs of the section titled \Nameref{ss:fourth}. + +\insMinitoctab[ss:fourth]{\TOCLevels{subsubsection}{subparagraph}\minitocFmtii} + + +\subsection{A subsection} + +Content + +\subsubsection{A subsubsection} + +Content + +\subsubsection{Another one, but let us make it a much longer entry} + +Content + +\subsection{To come to the aid} + +Content + + +\subsubsection{A third subsubsection} + +Content + +\subsubsection{A fourth subsubsection}\mtoclabel{ss:fourth} + +We list the named paragraphs and subparagraphs. + + +\insMinitoctab{\TOCLevels{subsubsection}{subparagraph}\minitocFmtii} + + +\paragraph{A paragraph} This is filler sentence, long enough to wrap around to the next line. + + +\subparagraph{A sub-paragraph} + +Content + +\subparagraph{A sub-paragraph} + +Content + +\subsubsection{A fifth subsub} + +Content + + +\paragraph{A paragraph} + +Content + +\subsection{Of their country} + +Content + +\newpage + +\section{Second to None} + +\insMinitoc{\TOCLevels{section}{subsubsection}\minitocFmti} + +\noindent +Content + +\subsection{Peter Piper} + +Content + +\subsubsection{A subsubsection on the second page} + +\insMinitoctab{\TOCLevels{subsubsection}{subparagraph}\minitocFmtii} + +\noindent +Content + +\paragraph{A paragraph of second section} \leavevmode\medskip + +\noindent +Content + +\subparagraph{A sub-paragraph of second section} \leavevmode\medskip + +\noindent +Content + +\paragraph{A paragraph of second section} \leavevmode\medskip + +\noindent +Content + +\subsubsection{Another one} + +Content + +\subsection{Picked a peck} + +Content + +\subsection{Of pickled peppers} + +Content + +\subsubsection{A third subsubsection} + +Content + +\subsubsection{A fourth} + +Content + +\subsection[How many pecks]{How many pecks of pickled peppers} + +Content + +\subsection{Did Peter Piper pick?} + +Content + + +\end{document} diff --git a/texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.dtx b/texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.dtx new file mode 100644 index 00000000..48e8a324 --- /dev/null +++ b/texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.dtx @@ -0,0 +1,723 @@ +% \iffalse +% makeindex -s gglo.ist -o aeb-minitoc.gls aeb-minitoc.glo +% makeindex -s gind.ist -o aeb-minitoc.ind aeb-minitoc.idx +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% aeb-minitoc.sty package, %% +%% Copyright (C) 2012--2018 D. P. Story %% +%% dpstory@uakron.edu dpstory@acrotex.net %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.2 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +%\NeedsTeXFormat{LaTeX2e} +%\ProvidesPackage{aeb-minitoc} +% [2018/09/21 v1.6 Creates a simple mini-toc] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex=false,linktocpage,bookmarksnumbered]{hyperref} +\usepackage{calc} +\usepackage{aeb-minitoc} +%\def\texorpdfstring#1#2{#1} +%\pdfstringdefDisableCommands{\let\\\textbackslash} +\OnlyDescription % comment out for implementation details +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\gdef\brpr#1{\texttt{\char123\relax#1\char125\relax}} +\let\darg\brpr +\let\env\texttt +\let\opt\texttt +\let\app\textsf +\let\pkg\textsf +\def\EXCL{!} +\def\visispace{\symbol{32}} +\def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}} +\def\meta#1{\textsl{\texttt{#1}}} +\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}} +\def\CMD#1{\textbackslash#1} +\makeatletter +\renewcommand\theparagraph{\texorpdfstring{\protect\P\protect\ }{\textparagraph}} +\renewcommand\thesubparagraph{\texorpdfstring{\protect\P\protect\P\protect\ }{\textparagraph\textparagraph}} +\renewcommand{\section} + {\renewcommand{\@seccntformat}[1]{\thesection\quad}% + \@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\Large\bfseries}} +\renewcommand{\paragraph} + {\renewcommand{\@seccntformat}[1]{\theparagraph\unskip\,}% + \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}} +\renewcommand{\subparagraph} + {\renewcommand{\@seccntformat}[1]{\thesubparagraph\unskip\,}% + \@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}{\bfseries}} +\makeatother +\InputIfFileExists{aebdocfmt.def}{\PackageWarning{aeb-minitoc}{Inputting aebdocfmt.def}} + {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax + \PackageInfo{aeb-minitoc}{aebdocfmt.def cannot be found}} +\begin{document} +\addtolength{\marginparwidth}{3pt} + \GetFileInfo{aeb-minitoc.sty} + \title{The \textsf{aeb-minitoc} Package} + \author{D. P. Story\\ + Email: \texttt{dpstory@uakron.edu}} + \date{processed \today} + \maketitle +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{5} +\bgroup +\value{secnumdepth}=3 +\value{tocdepth}=3 + \tableofcontents +\egroup + \DocInput{aeb-minitoc.dtx} +\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here. Execute + \begin{quote}\texttt{makeindex -s gind.ist -o aeb-minitoc.ind aeb-minitoc.idx}\end{quote} + on the command line and recompile + \texttt{aeb-minitoc.dtx}.} +\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here. Execute + \begin{quote} + \texttt{makeindex -s gglo.ist -o aeb-minitoc.gls aeb-minitoc.glo} + \end{quote} + on the command line and recompile \texttt{aeb-minitoc.dtx}.} +\end{document} +% +% \fi +% \MakeShortVerb{|} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{web}{Inputting aebdonotindex.def}} +% {\PackageInfo{web}{cannot find aebdonotindex.def}} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% The \DescribeMacro{\ifMiniTocListings}\cs{ifMiniTocListings} is a Boolean switch, which when true +% signals that there is a non-empty listing; otherwise, it is set to false. It is used to display +% a latex warning to the user that the listing is empty. Also, globally, \cs{ifMiniTocListings} +% is set to false when \IndexOpt{nominitocs}\opt{nominitocs} is taken. The other option +% is \IndexOpt{\EXCL!nominitocs}\opt{!nominitocs} is a convenience option; it is not `not' version +% of \opt{nominitocs}; when \opt{!nominitocs} is specified, mini-tocs are created. This is the +% same as specifiying no option at all. +% \begin{macrocode} +\newif\ifMiniTocListings \MiniTocListingstrue +\DeclareOption{nominitocs}{\AtEndOfPackage{\MiniTocListingsfalse + \let\insertminitoc\insertminitocNOT}} +\DeclareOption{!nominitocs}{\MiniTocListingstrue} +\ProcessOptions +% \end{macrocode} +% \section{Description} +% A simple mini-toc package; originally designed for \textsf{web}, but now works for all standard +% {\LaTeX} classes. The main user command is \cs{insertminitoc}, defined below. +% +% Our approach is to use each entry the \cs{jobname.toc} as the first argument of the +% macro \cs{mtocCL}, a second argument keeps a running count on the number of entries. +%\begin{flushleft}\small +%\begin{verbatim} +%\mtocCL{\contentsline{section}{\numberline{1}Section Title}{2}}{cnt} or +%\mtocCL{\contentsline{section} +% {\numberline{1}Section Title}{2}{section.1}}{cnt} +%\end{verbatim} +%\end{flushleft} +%\cs{contentsline} has four arguments when \pkg{hyperref} is loaded and three otherwise. When inserting +%the full table of contents, we define |\def\mtocCL#1#2{#1}| to do nothing. When we +%are building a mini-toc, we \cs{let} \cs{mtocCL} to \cs{mtoc@CL@mtoc}. The effect +%of this macro is to remove any entry (in \cs{jobname.toc}) that does not contain +%\cs{contentsline} as it first token and to position the \texttt{cnt} argument for later use. +%But by then \cs{contentsline} has already +%been \cs{let} to \cs{cl@LOOKFORSEC}. Now \cs{cl@LOOKFORSEC} determines whether any +%particular entry should be displayed in the current mini-toc. +% +% \section{Documentation and Code.} +% As a demonstration of this package, we present a mini-toc for this section, +% which only has \cs{paragraph} and \cs{subparagraph} section headings. +% \changes{v1.2}{2018/08/29}{Created \string\texttt{aeb-minitoc.ins}} +% \changes{v1.3}{2018/08/29}{Remove \string\textsf{hyperref} as a requirement} +% \changes{v1.4}{2018/08/29}{Some renaming of commands} +% \changes{v1.6}{2018/09/21}{Code cleanup in prepreparation for release} +% +% The verbatim listing for this mini-toc is +%\begin{verbatim} +%\TOCLevels{section}{subparagraph} +%\begin{minitocfmt}{\minitocFmt} +% \declaretocfmt{paragraph}{\@W{1em}\@D{0em}} +% \declaretocfmt{subparagraph}{\@W{1.5em}\@D{1em}} +%\end{minitocfmt} +% +%\begin{center}\minitocFmt +%\fbox{\begin{minipage}{0.8\linewidth}\centering +%\textbf{Contents of this section}\vadjust{\kern3pt}% +%\insertminitoc\relax +%\end{minipage}} +%\end{center} +%\end{verbatim} +% \value{secnumdepth}=5 \value{tocdepth}=5 +% \TOCLevels{section}{subparagraph} +% \begin{minitocfmt}{\minitocFmt} +% \declaretocfmt{paragraph}{\@W{1em}\@D{0em}} +% \declaretocfmt{subparagraph}{\@W{1.5em}\@D{1em}} +% \end{minitocfmt} +% +% \begin{center}\minitocFmt +% \fbox{\begin{minipage}{0.8\linewidth}\centering +% \textbf{Contents of this section}\vadjust{\kern3pt}% +% \insertminitoc\relax +% \end{minipage}} +% \end{center} +% +% \noindent We begin by saving the definitions macros we modify later. +% \begin{macrocode} +\let\mtoc@contentsline\contentsline +\let\mtoc@starttoc\@starttoc +\let\mtoc@tableofcontents\tableofcontents +\let\mtoc@addtocontents\addtocontents +% \end{macrocode} +% Some counters and utility macros. The counter \DescribeMacro\@minitocCnt\cs{@minitocCnt} is incremented +% in the redefined \cs{addtocontents} command. The command \DescribeMacro{\mtocgobble}\cs{mtocgobble} is +% a `public' version of the core {\LaTeX} command \cs{@gobble}. +% \begin{macrocode} +\newcount\@minitocCnt \@minitocCnt=0\relax +\def\csarg#1#2{\expandafter#1\csname#2\endcsname} +\let\mtoc@One=1 \let\mtoc@Zero=0 +\let\mtocgobble\@gobble +% \end{macrocode} +% +% \paragraph[The top and bottom most]{The top and bottom most.} +% The package assigns the top level and bottom level automatically, based upon the class being used; +% the document author can override these for the whole document, or for particular mini-tocs. +% \DescribeMacro{\TOPLevel}\cs{TOPLevel\darg{\ameta{name}}} is the name of the top level. It is expected +% that a mini-toc will be inserted with each top level in the document, as the author's discretion. The +% \DescribeMacro{\BTMLevel}\cs{BTMLevel\darg{\ameta{name}}} is the name of the bottom most level. A mini-toc +% consists of all sections \emph{beneath} the top level and \emph{above} the bottom level. Thus, if +% \cs{TOPLevel\darg{chapter}} and \cs{BTMLevel\darg{subsubsection}}, then the mini-toc contans all \cs{section} +% and \cs{subbsection} title headings within the current chapter. +% +% \subparagraph[Manually set the top and bottom levels]{Manually set the top and bottom levels.} \DescribeMacro{\TOPLevel}\cs{TOPLevel\darg{\ameta{top-level}}} +% and \DescribeMacro{\BTMLevel}\cs{BTMLevel\darg{\ameta{btm-level}}} are used to determine what entries are to be included in the mini-toc. +% As a convenience, +% \begin{quote} +% \DescribeMacro{\TOCLevels}\cs{TOCLevels\darg{\ameta{top-level}}\darg{\ameta{btm-level}}} +% \end{quote} +% can declare both +% at once. If an argument is empty, the current level is used. +% \begin{macrocode} +\def\TOPLevel#1{\def\x{#1}\ifx\x\@empty\else + \def\mtoc@TOPLevel{#1}\edef\TOPLevelNum{\@nameuse{sl@#1}}\fi} +\def\BTMLevel#1{\def\x{#1}\ifx\x\@empty\else + \def\mtoc@BTMLevel{#1}\edef\BTMLevelNum{\@nameuse{sl@#1}}\fi} +\def\TOCLevels#1#2{\TOPLevel{#1}\BTMLevel{#2}} +% \end{macrocode} +% \subparagraph[Automatically set the top and bottom levels]{Automatically set the top and bottom levels.} +% We make reasonable choices for \texttt{book}, \texttt{report}, and \texttt{article}; these are the three +% classes that this package supports. In the course, we define, in macro form, the levels of +% each of these section names (\cs{sl@\ameta{sec-name}} and \cs{sl@\ameta{sec-name}*}). +% \begin{macrocode} +\@ifclassloaded{book}{% + \TOCLevels{chapter}{subsection} + \def\sl@part{-1}\def\sl@chapter{0} + \csarg{\edef}{sl@part*}{\sl@part} + \csarg{\edef}{sl@chapter*}{\sl@chapter} +}{% + \@ifclassloaded{report}{% + \TOCLevels{chapter}{subsection} + \def\sl@part{-1}\def\sl@chapter{0} + \csarg{\edef}{sl@part*}{\sl@part} + \csarg{\edef}{sl@chapter*}{\sl@chapter} + }{% + \TOCLevels{section}{subsubsection} + \def\sl@part{0}\csarg{\edef}{sl@part*}{\sl@part} + }% +} +\def\sl@section{1}\def\sl@subsection{2}\def\sl@subsubsection{3} +\def\sl@paragraph{4}\def\sl@subparagraph{5}%\def\sl@all{17} +\csarg{\edef}{sl@section*}{\sl@section} +\csarg{\edef}{sl@subsection*}{\sl@subsection} +\csarg{\edef}{sl@subsubsection*}{\sl@subsubsection} +\csarg{\edef}{sl@paragraph*}{\sl@paragraph} +\csarg{\edef}{sl@subparagraph*}{\sl@subparagraph} +\newif\if@foundTOPLevel \@foundTOPLevelfalse +% \end{macrocode} +% The command \cs{insertminitoc}, just before inputting \cs{jobname.toc}, \cs{let}s \cs{contentsline} to +% \DescribeMacro\cl@LOOKFORSEC\cs{cl@LOOKFORSEC}. This command then looks for lines at the top most section level, if it finds one, +% and the section number matches the one set by \cs{insertminitoc} (\cs{mtoc@sec}), it sets +% \cs{if@foundTOPLevel} to \texttt{true}, and stores all subsequent lines in \cs{toks@} until +% another section is encountered, at which time \cs{if@foundTOPLevel} is set to \texttt{false}. There are two versions +% of \cs{cl@LOOKFORSEC}: (1) \DescribeMacro\cl@LOOKFORSEC@LX\cs{cl@LOOKFORSEC@LX} for when \pkg{hyperref} is not loaded; +% and (2) \DescribeMacro\cl@LOOKFORSEC@HY\cs{cl@LOOKFORSEC@HY} for +% when \pkg{hyperref} is loaded.\par\medskip +% \noindent +% \cs{mtoc@@contentsline} takes five arguments, we save the page number (\texttt{\#3}) +% the hyperref anchor (\texttt{\#4}) and the TOC entry number (\texttt{\#5}). The +% definitions made within \cs{mtoc@@contentsline} are later \cs{let} to \cs{@PgNum}, +% \cs{@L}, and \cs{@E}. We grab \texttt{\#5}, which is the entry count, and pass +% the rest to \cs{mtoc@contentsline}. +% \begin{macrocode} +\def\mtoc@@contentsline#1#2#3#4#5{\def\mtoc@PgNum{#3}% + \def\mtoc@HY@anchor{#4}\def\TOCEntryNum{#5}% + \mtoc@contentsline{#1}{#2}{#3}{#4}} +% \end{macrocode} +% All but the last argument in both of these next two command are the standard +% arguments for \cs{contentsline}. The last argument is one introduced by this +% package; it keeps the count of the TOC entries. This last argument is used +% to identify the top level section. +% \begin{macrocode} +\long\def\cl@LOOKFORSEC@LX#1#2#3#4{% + \cl@LOOKFORSEC@HY{#1}{#2}{#3}{\@empty}{#4}} +\long\def\cl@LOOKFORSEC@HY#1#2#3#4#5{\def\mt@rgi{#1}% dps + \if@foundTOPLevel\ifx\mtocCL\@gobbletwo\else + \edef\NUMLevel{\@nameuse{sl@#1}}% + \ifnum\NUMLevel > \TOPLevelNum\relax\else + \let\mtocCL\@gobbletwo + \fi + \fi\fi + \@chkForNl#2\@nil % is it a * section + \ifx\mtocCL\@gobbletwo\else + \edef\mtoc@tmp{\the\mtocs@toks@}% + \ifx\mt@rgi\mtoc@TOPLevel + \def\SECNUM{MTOC.#5}% + \set@display@protect + \edef\mtoc@sec{\mtoc@sec}% + \ifx\SECNUM\mtoc@sec + \@foundTOPLeveltrue + \else + \@foundTOPLevelfalse\fi + \set@typeset@protect + \else + \if@foundTOPLevel + \ifnum\NUMLevel > \BTMLevelNum\relax\else + \ifx\@nlrtn\relax + \mtocs@toks@=\expandafter{\mtoc@tmp + \mtoc@@contentsline{#1}{#2}{#3}{#4}{#5}}\else + \mtocs@toks@=\expandafter{\mtoc@tmp + \mtoc@@contentsline{#1*}{#2}{#3}{#4}{#5}}\fi + \fi + \fi + \fi + \fi +} +% \end{macrocode} +% This version of \cs{mtoc@BTMLevel} only accepts lines that are not +% \texttt{subsubsection}. +% \begin{macrocode} +\@ifpackageloaded{hyperref}{\let\cl@LOOKFORSEC\cl@LOOKFORSEC@HY} + {\let\cl@LOOKFORSEC\cl@LOOKFORSEC@LX} +% \end{macrocode} +% \DescribeMacro{\@chkForNl} determines if the first token is \cs{numberline}. +% \begin{macrocode} +\def\@chkForNl#1#2\@nil{% check for number line + \ifx#1\numberline\let\@nlrtn\relax\else + \def\@nlrtn{\numberline{\hfill}}\fi} +% \end{macrocode} +% \paragraph{Modify \texorpdfstring{\protect\cs{tableofcontents}}{\textbackslash{tableofcontents}}} +% \begin{macrocode} +\def\mtoc@st@rttoc#1{\begingroup + \if@filesw \expandafter\newwrite\csname tf@#1\endcsname + \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax + \fi\global\@nobreakfalse\endgroup} +\let\mtoc@@starttoc\mtoc@One +\def\mtoc@start@toc{\let\mtoc@start@next\relax + \@ifundefined{aebLastPage} + {% + \ifx\mtoc@@starttoc\mtoc@One + \global\let\mtoc@@starttoc\mtoc@Zero + \def\mtoc@start@next{\mtoc@st@rttoc{toc}}\fi + \mtoc@start@next + }{% + \ifnum\aebLastPage<\thepage\relax + \def\mtoc@start@next{\mtoc@st@rttoc{toc}}\fi + \mtoc@start@next + }% +} +\AtEndDocument{\mtoc@start@toc} +% \end{macrocode} +% +% \paragraph[Modify \texorpdfstring{\protect\cs{addtocontents}} +% {\textbackslash{addtocontents}}]{Modify \cs{addtocontents}.} +% (\cs{addtocontents\darg{toc}\darg{\ameta{content}}}) If the document author inserts vertical spacing, or +% other formatting, that could be problems in the minitoc. So we'll try to remove it. +% We begin by placing the second argument \ameta{content} as the argument of a command, +% \cs{mtocCL\darg{\ameta{content}}}. Initially, \cs{mtocCL} just passes its argument into the +% {\TeX} stream. Later, it will be redefined within \cs{insertminitoc}. +% \begin{macrocode} +\def\mtoc@TOC{toc} +\def\mtocCL#1#2{#1} +% \end{macrocode} +% Here, we modify the macro \cs{addtocontents} to insert \cs{mtocCL}. +% \begin{macrocode} +\renewcommand\addtocontents[2]{% + \def\mt@rgi{#1}\ifx\mt@rgi\mtoc@TOC + \global\advance\@minitocCnt\@ne + \mtoc@addtocontents{#1}{\protect\mtocCL{#2}{\the\@minitocCnt}}\else + \mtoc@addtocontents{#1}{#2}\fi} +% \end{macrocode} +% Modify the \cs{tableofcontents} to \cs{mtoc@tableofcontents}. +% We compensate later by executing \cs{mtoc@start@toc} at the end of the document. +% \begin{macrocode} +\def\tableofcontents{% + \def\@starttoc##1{\makeatletter + \@input{\jobname.##1}\makeatother}% + \NoFmtTOCEntry + \mtoc@tableofcontents + \global\let\@starttoc\mtoc@starttoc} +% \end{macrocode} +% \leavevmode\DescribeMacro{\mtoc@CL@mtoc}\cs{mtoc@CL@mtoc} is the redefined version of \cs{mtocCL}, as described above. +% We attempt to see if the first token of its argument is \cs{contentsline}, if yes +% we pass it on, otherwise, we gobble it. +% \begin{macrocode} +\newcommand{\mtoc@CL@mtoc}[1]{\mtoc@parse#1\@nil} +\def\mtoc@parse#1#2\@nil{\ifx#1\contentsline + \def\mtoc@next##1{#1#2{##1}}\else + \let\mtoc@next\@gobble\fi\mtoc@next} +% \end{macrocode} +% +% \paragraph[Modify \texorpdfstring{\protect\cs{@startsection}}{\textbackslash{@startsection}} and referencing]% +% {Modify \texorpdfstring{\protect\cs{@startsection}}{\textbackslash{@startsection}} and referencing.} +% We redefine \cs{@startsection} to pick up the first argument (the section name) +% and define \cs{@currentsecname}, which is use in a simple cross referencing system +% needed for this mini-toc package. This package should be loaded after \pkg{hyperref} for sure. +% \begin{macrocode} +\let\@startsection@mtoc@SAVE\@startsection +\def\@startsection#1{\def\@currentsecname{#1}% + \@startsection@mtoc@SAVE{#1}} +% \end{macrocode} +%\goodbreak\noindent +% The use of \DescribeMacro\mtoclabel\cs{mtoclabel} and \DescribeMacro\mtocref +% \cs{mtocref} are not needed unless you redefine a section heading to a non-numerical +% value. This system needs a section number. +% \begin{macrocode} +\def\mtoclabel#1{\label{#1}\@bsphack + \protected@write\@auxout{}{\string + \csarg{\string\gdef}{mtoclbl#1}{\the\@minitocCnt} + }% + \@esphack +} +\def\mtocref#1{\@nameuse{mtoclbl#1}} +% \end{macrocode} +% +% \paragraph[\texorpdfstring{\protect\cs{insertminitoc}}{\textbackslash{insertminitoc}}: +% The main command]{\protect\cs{insertminitoc}: The main command.} +% \DescribeMacro{\insertminitoc}\cs{insertminitoc} is the main user command for this package, it places +% a ``minitoc'' for a section (\cs{mtoc@TOPLevel}) of a document, listing only the subsections within that section. +% It takes an optional argument for indicating the section number, the subsections of which are to +% be displayed. The default is the current section, \texttt{\cs{@nameuse\darg{the\cs{mtoc@TOPLevel}}}}. +% \par\medskip\noindent +% \DescribeMacro{\if@minitoc} This Boolean is set to true, in a group, when \cs{insertminitoc} is expanded. +% This is to support a feature for formatting a mini-toc entry; +% \cs{miniorfulltoc} is used for this purpose. \cs{miniorfulltoc} is +% inserted in the optional argument of a section command: +%\begin{verbatim} +% \subsection[\protect +% \miniorfulltoc{\textbf}{Subsection Entry}]{Subsection Entry} +%\end{verbatim} +%\DescribeMacro\miniorfulltoc\hskip-\marginparsep\texttt{\darg{\ameta{fmt}}\darg{\ameta{entry}}} +%The first argument of \cs{miniorfulltoc} is passed to the second entry; for example, +%|{\textbf{Subsection Entry}}| as an argument and in a group. Thus, the first argument +%can be a command with one argument, or a command with not arguments. +% \begin{macrocode} +\newif\if@minitoc \@minitocfalse +\newif\if@MiniTocListings \@MiniTocListingstrue +\def\NoFmtTOCEntry{\@minitocfalse} +\def\FmtTOCEntry{\@minitoctrue} +\def\miniorfulltoc#1#2{\if@minitoc + {{#1{#2}}}\else{#2}\fi} +% \end{macrocode} +% \leavevmode\DescribeMacro\insertminitoc\hskip-\marginparsep\texttt{[\ameta{label-name}]} +% After the above preliminaries, we get to \cs{insertminitoc}. +% The default value of the optional parameter is |MTOC.\the\@minitocCnt|; thus, we use the most +% recent value of \cs{@minitocCnt}. An explicit argument is needed when the mini-toc is placed +% somewhere else (after \cs{\@minitocCnt} has been incremented). You can also say +% \cs{insertminitoc[\ameta{label-name}]}, where \ameta{label-name} is a label name set by +% the \cs{mtoclabel} command. +% \begin{macrocode} +\newcommand{\insertminitoc}[1][]{% + \def\mtoc@rgi{#1}\ifx\mtoc@rgi\@empty + \edef\mtoc@rgi{MTOC.\the\@minitocCnt}\else + \edef\mtoc@rgi{MTOC.\mtocref{#1}}\fi + \ifnum\TOPLevelNum > \BTMLevelNum + \PackageError{aeb-minitoc}{% + The top level (\mtoc@TOPLevel) must be\MessageBreak + must be higher on the hierarchy then at bottom level} + {Try switching the two}\fi + \begingroup + \edef\mtoc@sec{\mtoc@rgi}\mtocs@toks@={}% +% \end{macrocode} +% \cs{let} \cs{contentsline} to \cs{cl@LOOKFORSEC} +% \begin{macrocode} + \let\contentsline\cl@LOOKFORSEC +% \end{macrocode} +% \cs{let} \cs{mtocCL} to \cs{mtoc@CL@mtoc} +% \begin{macrocode} + \let\mtocCL\mtoc@CL@mtoc + \@foundTOPLevelfalse + \let\mtoc@numberline\numberline +% \end{macrocode} +% Insert formatting ($\cs{Pg}=\cs{sl@@sNumFmt}$) for the page number here. +% \begin{macrocode} + \def\numberline##1{\makebox[\mtoc@numBoxWidth][l]% + {\sl@@sNumFmt{##1}}\sl@@EntryFmt}% + \makeatletter\InputIfFileExists{\jobname.toc}% + {\PackageInfo{aeb-minitoc}{TOC file read}} + {\PackageInfo{aeb-minitoc}{TOC file not available}}% + \edef\x{\the\mtocs@toks@}\ifx\x\@empty + \global\@MiniTocListingsfalse\else + \global\@MiniTocListingstrue\fi +% \end{macrocode} +% \textbf{Insertion point.} This is where the mini-toc entries are entered +% into the latex stream to be typeset. +% \begin{macrocode} + \the\mtocs@toks@\par\makeatother + \if@MiniTocListings\else + \PackageWarning{aeb-mintoc}{No mini-toc built here}\fi + \endgroup +} +% \end{macrocode} +% When the \opt{nominitocs} option is in effect, we \cs{let} the command +% \cs{insertminitoc} to \DescribeMacro\insertminitocNOT\cs{insertminitocNOT}, which absorbs all its arguments. +% \begin{macrocode} +\newcommand{\insertminitocNOT}[1][]{} +% \end{macrocode} +% \leavevmode\DescribeMacro{\numBoxWidth}\hskip-\marginparsep\texttt{\darg{\ameta{length}}} +% The \cs{mtoc@numBoxWidth} determines the width of the \cs{hbox} that contains the section number. +% It is conveniently set using \cs{numBoxWidth}. The default declaration is +% \cs{numBoxWidth\darg{2.5em}}. The \ameta{length} should be measured in em units. Within +% the \env{minitocfmt}, \cs{@W} is \cs{let} to \cs{numBoxWidth}. +% \begin{macrocode} +\def\numBoxWidth#1{\def\mtoc@numBoxWidth{#1}} +\numBoxWidth{2.5em} +% \end{macrocode} +% In its ``raw'' expansion, \cs{insertminitoc} may not be what you want; in this case, +% enclose it in some appropriate environment. +% The following is an example of how to use this command. +% This can be part of a command that inserts code just after every \cs{section}. +%\begin{verbatim} +%\begin{center}\minitocFmt +%\begin{tabular}{c}\toprule +%\begin{minipage}[c]{0.8\linewidth} +%\insertminitoc\relax +%\end{minipage}\\\bottomrule +%\end{tabular} +%\end{center} +%\end{verbatim} +%where \cs{minitocFmt} is a command that expands to some formatting, see demo files. +% +%\paragraph[The mini-toc format environment: \texttt{minitocfmt}]% +% {The mini-toc format environment: \texttt{minitocfmt}.} +% To help facilitate designing and declaring the mini-toc format, we define +% the \texttt{minitocfmt} environment. The environment defines a command +% (\ameta{\cs{cmd}}) that contains all the formatting information for +% the mini-toc. The body of the environment consists of a series of +% \cs{declaretocfmt\darg{\ameta{toc-fmt}}} declarations. Within argument +% of \cs{declaretocfmt}, \cs{@W} is an alias for \cs{numBoxWidth} and +% \cs{@D} is an alias for \cs{sl@dots}. If \cs{@D} +% appears ($\texttt{@D} = \texttt{@dottedtocline}$, a dotted line is created in the usual +% {\LaTeX} manner. \cs{@N} is an alias \cs{sl@sNumFmt} and \cs{@P} is an alias for +% \cs{sl@pNumFmt}. All are optional. \def\MP#1{\marginpar{\raggedleft\small\itshape#1}} +%\begin{description} +% \item[\cs{@A\darg{\ameta{various}}}]\hskip-.5em\relax\space is a command that is not used very +% often, but is available when needed. The argument \ameta{various} is +% various commands to support the min-toc being generated. +%\begin{description} +% \item[\cs{@PW\darg{\ameta{length}}}] Within\MP{pg num box width} the argument of +% \cs{@A}, insert \cs{@PW\darg{\ameta{length}}} to set +% the width of the box that contains the page number +% (\cs{@pnumwidth}). The value set by {\LaTeX} is +% \texttt{1.55em}. +% \item[\cs{@DS\darg{\ameta{num}}}] The \ameta{num}\MP{dots separation} determines the +% separation between dots for a TOC entry that uses a dotted rule +% line. This command is only recognized within the argument of +% \cs{@A}. The default is 4.5. +% \item[\cs{@R\darg{\ameta{length}}}]\hskip-.5em\relax\space is a\MP{right margin of title} +% convenience command, it takes its argument and defines the +% {\LaTeX} command \cs{@tocrmarg}, which sets the right margin +% for the sec-title. The length set by {\LaTeX} is +% \texttt{2.55em}. The \ameta{length} of \cs{@R} should be \emph{larger +% than} the \ameta{length} set by \cs{@PW}. +%\end{description} +% +% \item[\cs{declaretocfmt\darg{\ameta{sec-name}}\darg{\ameta{various}}}]\hskip-.5em\relax\space +% formats all \ameta{sec-name} (section, subsection, etc.) entries. +% +% A `typical' table of contents entry has the form: +%\begin{quote}\ttfamily +%\ameta{sec-num} \ameta{title-heading}\dotfill\ameta{pg-num} +%\end{quote} +%Within the \ameta{various} argument, there are a number of commands that +%are recognized: +%\begin{description} +% \item[\cs{@W\darg{\ameta{length}}}]\hskip-.5em\relax\space is\MP{sec +% num box width} the width of the box that encloses +% \ameta{sec-num}. Normally, all lengths are measured in +% \texttt{em} units (\cs{@W\darg{\ameta{num}em}}). The default +% length is \texttt{2.5em} +% \item[\cs{@D\darg{\ameta{length}}}]\hskip-.5em\relax\space is\MP{use dots} the +% amount to indent prior to \ameta{sec-num}. Again, \texttt{em} +% units preferred (\cs{@D\darg{\ameta{num}em}}). When the \cs{@D} +% command is present in the argument, a dotted line is +% to be used for the entry (this is the norm). If \cs{@D} not +% present, there is an opportunity within the \ameta{various} +% argument to create a custom entry. +% \item[\cs{@B\darg{\ameta{length}}}] Same as \cs{@D}\MP{no dots}, but no dotted leaders are created. +% \item[\cs{@N\darg{\ameta{fmt}}}]\hskip-.5em\relax\space is\MP{fmt sec num} the +% formatting for \ameta{sec-num}. You can pass a command with one +% argument that will operate on the section number; for example, +% \cs{@N\darg{\cs{textbf}}}, \cs{@N\darg{\cs{color\darg{blue}}}}, +% or \cs{@N\darg{\cs{color\darg{blue}}\cs{textbf}}}. Note that +% changing the style to bold might require a corresponding change +% in \cs{@W}. +% \item[\cs{@F\darg{\ameta{fmt}}}]\hskip-.5em\relax\space is\MP{fmt title} the formatting +% for the title heading of the current section; for example, \cs{@F\darg{\string\bfseries}} +% turns all heading, for this \ameta{sec-name}, bold. +% \item[\cs{@P\darg{\ameta{fmt}}}]\hskip-.5em\relax\space is the\MP{fmt pg num} +% formatting for the page number (\ameta{pg-num}). You can pass a +% command with one argument that will operate on the page number +% When \pkg{hyperref} is loaded with the \opt{colorlinks} option, +% we cannot change the color of the page number (see the discussion +% of \cs{@A} above), but \cs{@P\darg{\string\textit}} changes the +% numbers to italics. If \pkg{hyperref} is not loaded, +% \cs{@P\darg{\string\color\darg{red}\string\textit}} changes page +% numbers to a red italic. +% \item[\cs{@R\darg{\ameta{length}}}]\hskip-.5em\relax\space is\MP{right margin of title} a convenience +% command, it takes its argument and defines the {\LaTeX} command +% \cs{@tocrmarg}, which sets the right margin for the sec-title. +% The length set by {\LaTeX} is \texttt{2.55em}. Setting \cs{@R} +% within the \ameta{various} argument of \cs{declaretocfmt} affects +% the current section level as well as all lower section levels. If +% you want to make this `local' change, you need to put \cs{@R} +% back to its default of \texttt{2.55em} locally for other +% declarations. +% \item[\cs{@E}] Within\MP{TOC number} the \env{minitocfmt} environment, the command +% \cs{@E} expands to the current TOC entry number of the TOC entry +% being read in. +% \item[\cs{@L}] This\MP{link anchor} macro expands to the \pkg{hyperref} anchor of the +% page entry reference, it is empty if \pkg{hyperref} is not +% loaded. +% \item[\cs{@Pg}] This\MP{pg number} macro expands to the page number this entry +% references. +%\end{description} +%\end{description} +% Usually, the \ameta{length} argument is measured in \texttt{em} units (\texttt{\ameta{num}em}). +% \begin{macrocode} +\newtoks\mtoc@toks +\newtoks\mtocs@toks@ +% \end{macrocode} +% Within the \env{minitocfmt}, \cs{@D} is \cs{let} to \cs{sl@dots}. +% \begin{macrocode} +\def\sl@dots#1{\def\sl@@dots{% + \@dottedtocline{\sl@current}{#1}{\mtoc@numBoxWidth}}} +\let\sl@@dots\@gobble +\def\sl@nodots#1{\def\sl@@dots{% + \no@dottedtocline{\sl@current}{#1}{\mtoc@numBoxWidth}}} +\let\sl@@nodots\@gobble +% \end{macrocode} +% Within the \env{minitocfmt}, \cs{@F} is \cs{let} to \cs{\sl@EntryFmt}. +% \begin{macrocode} +\def\sl@EntryFmt#1{\def\sl@@EntryFmt{#1}} % dps +\let\sl@@EntryFmt\relax % dps +% \end{macrocode} +% Within the \env{minitocfmt}, \cs{@N} is \cs{let} to \cs{sl@sNumFmt}. +% \begin{macrocode} +\def\sl@sNumFmt#1{\def\sl@@sNumFmt{#1}} +\let\sl@@sNumFmt\relax +% \end{macrocode} +% Within the \env{minitocfmt}, \cs{@P} is \cs{let} to \cs{sl@pNumFmt}. +% \begin{macrocode} +\def\sl@pNumFmt#1{\def\sl@@pNumFmt{#1}} +\let\sl@@pNumFmt\relax +\def\sl@tocrmarg#1{\def\@tocrmarg{#1}} +\def\sl@dotsep#1{\def\@dotsep{#1}} +\def\mtoc@star#1*#2\@nil{\def\@rgii{#2}\ifx\@rgii\@empty + \let\mtoc@@star\mtoc@Zero\else\let\mtoc@@star\mtoc@One\fi} +% \end{macrocode} +% \subparagraph[The \texorpdfstring{\protect\cs{declaretocfmt}}{\textbackslash{declaretocfmt}} command defined]% +% {The \texorpdfstring{\protect\cs{declaretocfmt}}{\textbackslash{declaretocfmt}} command defined.} +% The \cs{declaretocfmt} is used to designed how a mini-toc entry is displayed. +% +% \begin{macro}{\declaretocfmt}\hskip-\marginparsep\texttt{\darg{\ameta{sec-name}}\darg{\ameta{various}}} +% The \pkg{aeb-mintoc} way of declaring the formatting for a toc \ameta{sec-name} entry. The +% \ameta{various} argument consists of various combinations of \cs{@W}, \cs{@D}, \cs{@N}, and \cs{@P}. +% \begin{macrocode} +\long\def\declaretocfmt#1#2{% + \xdef\sl@current{\@nameuse{sl@#1}}% + \global\@namedef{\mtoc@CmdName @l@#1}##1##2{% + \normalfont\normalcolor\let\@E\TOCEntryNum + \let\@L\mtoc@HY@anchor\let\@Pg\mtoc@PgNum + \let\sl@@dots\@empty\let\sl@@sNumFmt\relax + \let\sl@@pNumFmt\relax\let\sl@@EntryFmt\relax + \let\@W\numBoxWidth\let\@R\sl@tocrmarg\let\@D\sl@dots + \let\@B\sl@nodots\let\@F\sl@EntryFmt\let\@N\sl@sNumFmt + \let\@P\sl@pNumFmt + #2\ifx\sl@@dots\@empty\let\sl@next\relax\else + \mtoc@star#1*\@nil % dps + \ifx\mtoc@@star\mtoc@Zero + \def\sl@next{\sl@@dots{##1}{\sl@@pNumFmt{##2}}}\else + \def\sl@next{\sl@@dots{\sl@@EntryFmt##1}{\sl@@pNumFmt{##2}}}\fi + \fi\sl@next}% + \edef\x{\expandafter\noexpand\csname l@#1\endcsname}% + \edef\y{\expandafter\noexpand\csname\mtoc@CmdName @l@#1\endcsname}% + \edef\mtoc@@tmp{\the\mtoc@toks\let\expandafter\noexpand\x= + \expandafter\noexpand\y} + \global\mtoc@toks=\expandafter{\mtoc@@tmp}} +\def\mtoc@getCmdName#1{\edef\mtoc@CmdName{\expandafter + \@gobble\string#1}} +% \end{macrocode} +% \end{macro} +% +% \subparagraph[The \texttt{minitocfmt} environment defined]% +% {The \texttt{minitocfmt} environment defined.} Is a `simplified' way of +% designing toc entries. +% \begin{environment}{minitocfmt}\hskip-\marginparsep\texttt{\darg{\cs{\ameta{cmdName}}}} +% The definition of the environment. The argument is a command that will hold the expanded +% content of the environment. The body of the environment consists of one or more +% \cs{declaretocfmt} commands. +% \begin{macrocode} +\newenvironment{minitocfmt}[1]{\makeatletter + \gdef\@mtoc@cmd@@{#1}\let\@A\mtoc@addto +% \end{macrocode} +% The \cs{mtoc@getCmdName} returns the \texttt{cmdName} (without backslash). \texttt{cmdName} +% is used the creating command sequences, using to this definition. +% \begin{macrocode} + \mtoc@getCmdName{#1}\mtoc@toks={\let\@PW\mtoc@PW\let\@DS\sl@dotsep + \let\@R\sl@tocrmarg}% +% \end{macrocode} +% The body of the environment consists of one or more \cs{declaretocfmt} commands, these +% commands contribute to \cs{mtoc@toks}. \cs{mtoc@toks} consists of all the formatting +% declarations requested. +% \begin{macrocode} +}{\expandafter\xdef\@mtoc@cmd@@{\the\mtoc@toks}} +% \end{macrocode} +% \end{environment} +% \leavevmode\DescribeMacro\mtoc@addto is a macro to add to the declarations. Within +% \env{minitocfmt} is \cs{@A} is \cs{let} to \cs{mtoc@addto}. +% \begin{macrocode} +\def\mtoc@addto#1{\edef\mtoc@@tmp{\the\mtoc@toks}% + \global\mtoc@toks=\expandafter{\mtoc@@tmp #1}} +\def\mtoc@PW#1{\def\@pnumwidth{#1}} +% \end{macrocode} +% Here is code from \texttt{latex.ltx} for \cs{@dottedtocline}, we modify it so there +% are no leaders. +% \begin{macrocode} +\def\no@dottedtocline#1#2#3#4#5{% + \ifnum #1>\c@tocdepth \else + \vskip \z@ \@plus.2\p@ + {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip + \parindent #2\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \@tempdima #3\relax + \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip + {#4}\nobreak +% \leaders\hbox{$\m@th +% \mkern \@dotsep mu\hbox{.}\mkern \@dotsep +% mu$}\hfill +% Insert an \hfill + \hfill + \nobreak + \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}% + \par}% + \fi} +% \end{macrocode} +% \begin{macrocode} +% +% \end{macrocode} +%\Finale diff --git a/texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.ins b/texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.ins new file mode 100644 index 00000000..e9d20b39 --- /dev/null +++ b/texmf-dist/source/latex/aeb-minitoc/aeb-minitoc.ins @@ -0,0 +1,60 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1999-2012 D. P. Story +%% +%% This file is part of the `AcroTeX eDucation Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2018/09/21} +\def\batchfile{aeb-minitoc.ins} + +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble + +\generate +{% + \file{aeb-minitoc.sty}{\from{aeb-minitoc.dtx}{copyright,package}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/texmf-dist/tex/latex/aeb-minitoc/aeb-minitoc.sty b/texmf-dist/tex/latex/aeb-minitoc/aeb-minitoc.sty new file mode 100644 index 00000000..44e53789 --- /dev/null +++ b/texmf-dist/tex/latex/aeb-minitoc/aeb-minitoc.sty @@ -0,0 +1,256 @@ +%% +%% This is file `aeb-minitoc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% aeb-minitoc.dtx (with options: `copyright,package') +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% aeb-minitoc.sty package, %% +%% Copyright (C) 2012--2018 D. P. Story %% +%% dpstory@uakron.edu dpstory@acrotex.net %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.2 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{aeb-minitoc} + [2018/09/21 v1.6 Creates a simple mini-toc] +\newif\ifMiniTocListings \MiniTocListingstrue +\DeclareOption{nominitocs}{\AtEndOfPackage{\MiniTocListingsfalse + \let\insertminitoc\insertminitocNOT}} +\DeclareOption{!nominitocs}{\MiniTocListingstrue} +\ProcessOptions +\let\mtoc@contentsline\contentsline +\let\mtoc@starttoc\@starttoc +\let\mtoc@tableofcontents\tableofcontents +\let\mtoc@addtocontents\addtocontents +\newcount\@minitocCnt \@minitocCnt=0\relax +\def\csarg#1#2{\expandafter#1\csname#2\endcsname} +\let\mtoc@One=1 \let\mtoc@Zero=0 +\let\mtocgobble\@gobble +\def\TOPLevel#1{\def\x{#1}\ifx\x\@empty\else + \def\mtoc@TOPLevel{#1}\edef\TOPLevelNum{\@nameuse{sl@#1}}\fi} +\def\BTMLevel#1{\def\x{#1}\ifx\x\@empty\else + \def\mtoc@BTMLevel{#1}\edef\BTMLevelNum{\@nameuse{sl@#1}}\fi} +\def\TOCLevels#1#2{\TOPLevel{#1}\BTMLevel{#2}} +\@ifclassloaded{book}{% + \TOCLevels{chapter}{subsection} + \def\sl@part{-1}\def\sl@chapter{0} + \csarg{\edef}{sl@part*}{\sl@part} + \csarg{\edef}{sl@chapter*}{\sl@chapter} +}{% + \@ifclassloaded{report}{% + \TOCLevels{chapter}{subsection} + \def\sl@part{-1}\def\sl@chapter{0} + \csarg{\edef}{sl@part*}{\sl@part} + \csarg{\edef}{sl@chapter*}{\sl@chapter} + }{% + \TOCLevels{section}{subsubsection} + \def\sl@part{0}\csarg{\edef}{sl@part*}{\sl@part} + }% +} +\def\sl@section{1}\def\sl@subsection{2}\def\sl@subsubsection{3} +\def\sl@paragraph{4}\def\sl@subparagraph{5}%\def\sl@all{17} +\csarg{\edef}{sl@section*}{\sl@section} +\csarg{\edef}{sl@subsection*}{\sl@subsection} +\csarg{\edef}{sl@subsubsection*}{\sl@subsubsection} +\csarg{\edef}{sl@paragraph*}{\sl@paragraph} +\csarg{\edef}{sl@subparagraph*}{\sl@subparagraph} +\newif\if@foundTOPLevel \@foundTOPLevelfalse +\def\mtoc@@contentsline#1#2#3#4#5{\def\mtoc@PgNum{#3}% + \def\mtoc@HY@anchor{#4}\def\TOCEntryNum{#5}% + \mtoc@contentsline{#1}{#2}{#3}{#4}} +\long\def\cl@LOOKFORSEC@LX#1#2#3#4{% + \cl@LOOKFORSEC@HY{#1}{#2}{#3}{\@empty}{#4}} +\long\def\cl@LOOKFORSEC@HY#1#2#3#4#5{\def\mt@rgi{#1}% dps + \if@foundTOPLevel\ifx\mtocCL\@gobbletwo\else + \edef\NUMLevel{\@nameuse{sl@#1}}% + \ifnum\NUMLevel > \TOPLevelNum\relax\else + \let\mtocCL\@gobbletwo + \fi + \fi\fi + \@chkForNl#2\@nil % is it a * section + \ifx\mtocCL\@gobbletwo\else + \edef\mtoc@tmp{\the\mtocs@toks@}% + \ifx\mt@rgi\mtoc@TOPLevel + \def\SECNUM{MTOC.#5}% + \set@display@protect + \edef\mtoc@sec{\mtoc@sec}% + \ifx\SECNUM\mtoc@sec + \@foundTOPLeveltrue + \else + \@foundTOPLevelfalse\fi + \set@typeset@protect + \else + \if@foundTOPLevel + \ifnum\NUMLevel > \BTMLevelNum\relax\else + \ifx\@nlrtn\relax + \mtocs@toks@=\expandafter{\mtoc@tmp + \mtoc@@contentsline{#1}{#2}{#3}{#4}{#5}}\else + \mtocs@toks@=\expandafter{\mtoc@tmp + \mtoc@@contentsline{#1*}{#2}{#3}{#4}{#5}}\fi + \fi + \fi + \fi + \fi +} +\@ifpackageloaded{hyperref}{\let\cl@LOOKFORSEC\cl@LOOKFORSEC@HY} + {\let\cl@LOOKFORSEC\cl@LOOKFORSEC@LX} +\def\@chkForNl#1#2\@nil{% check for number line + \ifx#1\numberline\let\@nlrtn\relax\else + \def\@nlrtn{\numberline{\hfill}}\fi} +\def\mtoc@st@rttoc#1{\begingroup + \if@filesw \expandafter\newwrite\csname tf@#1\endcsname + \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax + \fi\global\@nobreakfalse\endgroup} +\let\mtoc@@starttoc\mtoc@One +\def\mtoc@start@toc{\let\mtoc@start@next\relax + \@ifundefined{aebLastPage} + {% + \ifx\mtoc@@starttoc\mtoc@One + \global\let\mtoc@@starttoc\mtoc@Zero + \def\mtoc@start@next{\mtoc@st@rttoc{toc}}\fi + \mtoc@start@next + }{% + \ifnum\aebLastPage<\thepage\relax + \def\mtoc@start@next{\mtoc@st@rttoc{toc}}\fi + \mtoc@start@next + }% +} +\AtEndDocument{\mtoc@start@toc} +\def\mtoc@TOC{toc} +\def\mtocCL#1#2{#1} +\renewcommand\addtocontents[2]{% + \def\mt@rgi{#1}\ifx\mt@rgi\mtoc@TOC + \global\advance\@minitocCnt\@ne + \mtoc@addtocontents{#1}{\protect\mtocCL{#2}{\the\@minitocCnt}}\else + \mtoc@addtocontents{#1}{#2}\fi} +\def\tableofcontents{% + \def\@starttoc##1{\makeatletter + \@input{\jobname.##1}\makeatother}% + \NoFmtTOCEntry + \mtoc@tableofcontents + \global\let\@starttoc\mtoc@starttoc} +\newcommand{\mtoc@CL@mtoc}[1]{\mtoc@parse#1\@nil} +\def\mtoc@parse#1#2\@nil{\ifx#1\contentsline + \def\mtoc@next##1{#1#2{##1}}\else + \let\mtoc@next\@gobble\fi\mtoc@next} +\let\@startsection@mtoc@SAVE\@startsection +\def\@startsection#1{\def\@currentsecname{#1}% + \@startsection@mtoc@SAVE{#1}} +\def\mtoclabel#1{\label{#1}\@bsphack + \protected@write\@auxout{}{\string + \csarg{\string\gdef}{mtoclbl#1}{\the\@minitocCnt} + }% + \@esphack +} +\def\mtocref#1{\@nameuse{mtoclbl#1}} +\newif\if@minitoc \@minitocfalse +\newif\if@MiniTocListings \@MiniTocListingstrue +\def\NoFmtTOCEntry{\@minitocfalse} +\def\FmtTOCEntry{\@minitoctrue} +\def\miniorfulltoc#1#2{\if@minitoc + {{#1{#2}}}\else{#2}\fi} +\newcommand{\insertminitoc}[1][]{% + \def\mtoc@rgi{#1}\ifx\mtoc@rgi\@empty + \edef\mtoc@rgi{MTOC.\the\@minitocCnt}\else + \edef\mtoc@rgi{MTOC.\mtocref{#1}}\fi + \ifnum\TOPLevelNum > \BTMLevelNum + \PackageError{aeb-minitoc}{% + The top level (\mtoc@TOPLevel) must be\MessageBreak + must be higher on the hierarchy then at bottom level} + {Try switching the two}\fi + \begingroup + \edef\mtoc@sec{\mtoc@rgi}\mtocs@toks@={}% + \let\contentsline\cl@LOOKFORSEC + \let\mtocCL\mtoc@CL@mtoc + \@foundTOPLevelfalse + \let\mtoc@numberline\numberline + \def\numberline##1{\makebox[\mtoc@numBoxWidth][l]% + {\sl@@sNumFmt{##1}}\sl@@EntryFmt}% + \makeatletter\InputIfFileExists{\jobname.toc}% + {\PackageInfo{aeb-minitoc}{TOC file read}} + {\PackageInfo{aeb-minitoc}{TOC file not available}}% + \edef\x{\the\mtocs@toks@}\ifx\x\@empty + \global\@MiniTocListingsfalse\else + \global\@MiniTocListingstrue\fi + \the\mtocs@toks@\par\makeatother + \if@MiniTocListings\else + \PackageWarning{aeb-mintoc}{No mini-toc built here}\fi + \endgroup +} +\newcommand{\insertminitocNOT}[1][]{} +\def\numBoxWidth#1{\def\mtoc@numBoxWidth{#1}} +\numBoxWidth{2.5em} +\newtoks\mtoc@toks +\newtoks\mtocs@toks@ +\def\sl@dots#1{\def\sl@@dots{% + \@dottedtocline{\sl@current}{#1}{\mtoc@numBoxWidth}}} +\let\sl@@dots\@gobble +\def\sl@nodots#1{\def\sl@@dots{% + \no@dottedtocline{\sl@current}{#1}{\mtoc@numBoxWidth}}} +\let\sl@@nodots\@gobble +\def\sl@EntryFmt#1{\def\sl@@EntryFmt{#1}} % dps +\let\sl@@EntryFmt\relax % dps +\def\sl@sNumFmt#1{\def\sl@@sNumFmt{#1}} +\let\sl@@sNumFmt\relax +\def\sl@pNumFmt#1{\def\sl@@pNumFmt{#1}} +\let\sl@@pNumFmt\relax +\def\sl@tocrmarg#1{\def\@tocrmarg{#1}} +\def\sl@dotsep#1{\def\@dotsep{#1}} +\def\mtoc@star#1*#2\@nil{\def\@rgii{#2}\ifx\@rgii\@empty + \let\mtoc@@star\mtoc@Zero\else\let\mtoc@@star\mtoc@One\fi} +\long\def\declaretocfmt#1#2{% + \xdef\sl@current{\@nameuse{sl@#1}}% + \global\@namedef{\mtoc@CmdName @l@#1}##1##2{% + \normalfont\normalcolor\let\@E\TOCEntryNum + \let\@L\mtoc@HY@anchor\let\@Pg\mtoc@PgNum + \let\sl@@dots\@empty\let\sl@@sNumFmt\relax + \let\sl@@pNumFmt\relax\let\sl@@EntryFmt\relax + \let\@W\numBoxWidth\let\@R\sl@tocrmarg\let\@D\sl@dots + \let\@B\sl@nodots\let\@F\sl@EntryFmt\let\@N\sl@sNumFmt + \let\@P\sl@pNumFmt + #2\ifx\sl@@dots\@empty\let\sl@next\relax\else + \mtoc@star#1*\@nil % dps + \ifx\mtoc@@star\mtoc@Zero + \def\sl@next{\sl@@dots{##1}{\sl@@pNumFmt{##2}}}\else + \def\sl@next{\sl@@dots{\sl@@EntryFmt##1}{\sl@@pNumFmt{##2}}}\fi + \fi\sl@next}% + \edef\x{\expandafter\noexpand\csname l@#1\endcsname}% + \edef\y{\expandafter\noexpand\csname\mtoc@CmdName @l@#1\endcsname}% + \edef\mtoc@@tmp{\the\mtoc@toks\let\expandafter\noexpand\x= + \expandafter\noexpand\y} + \global\mtoc@toks=\expandafter{\mtoc@@tmp}} +\def\mtoc@getCmdName#1{\edef\mtoc@CmdName{\expandafter + \@gobble\string#1}} +\newenvironment{minitocfmt}[1]{\makeatletter + \gdef\@mtoc@cmd@@{#1}\let\@A\mtoc@addto + \mtoc@getCmdName{#1}\mtoc@toks={\let\@PW\mtoc@PW\let\@DS\sl@dotsep + \let\@R\sl@tocrmarg}% +}{\expandafter\xdef\@mtoc@cmd@@{\the\mtoc@toks}} +\def\mtoc@addto#1{\edef\mtoc@@tmp{\the\mtoc@toks}% + \global\mtoc@toks=\expandafter{\mtoc@@tmp #1}} +\def\mtoc@PW#1{\def\@pnumwidth{#1}} +\def\no@dottedtocline#1#2#3#4#5{% + \ifnum #1>\c@tocdepth \else + \vskip \z@ \@plus.2\p@ + {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip + \parindent #2\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \@tempdima #3\relax + \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip + {#4}\nobreak + \hfill + \nobreak + \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}% + \par}% + \fi} +\endinput +%% +%% End of file `aeb-minitoc.sty'. -- cgit v1.2.3