%% LaTeX2e file `etocsnippet-21-A.tex' %% generated by the `filecontentshere' environment %% from source `etoc' on 2021/09/23. %% % it will be easy to globally shift the TOC horizontally if needed \def\TOCleftmargin {0pt} \def\TOCrightmargin {2.55em}% like LaTeX's \@tocrmarg % this is for dotted leaders \newbox\TOCleaderbox \def\TOCleaderboxwidth {0.7777em}% about like what standard classes do % vertical spacing \def\TOCverysmallvskip {0pt plus .2pt} \def\TOCmedvskip {1em plus 1pt} \def\TOCbigvskip {2.25em plus 1pt} % the ``numwidths'' for typesetting the numbering of division units. % I don't recall exactly how (and for which fonts) these figures were chosen. % They quickly prove too small if using Roman numerals (as do too the book % class defaults even though they are a bit larger). \def\TOCnumwidthB {1.5em} % chapter \def\TOCnumwidthC {2.278em}% section, I think default is 2.3em \def\TOCnumwidthD {3.056em}% analog in standard class is 3.2em \def\TOCnumwidthE {3.833em}% analog in standard class is 4.1em \def\TOCnumwidthF {4.611em}% analog in standard class is 5em \def\TOCnumwidthG {5.389em}% analog in standard class is 6em % The code for the ``global toc style''. \newcommand*\TOCglobalstyle {% \etocsettocstyle {\if@twocolumn \@restonecoltrue \onecolumn \else \@restonecolfalse \fi \parindent\z@ \leftskip\z@skip \rightskip \z@skip \setbox\TOCleaderbox\hbox to \TOCleaderboxwidth{\hss.\hss}% \chapter *{\noindent\kern\TOCleftmargin\relax % uses "pt"... \contentsname \@mkboth {\MakeUppercase \contentsname}{\MakeUppercase \contentsname}}% \rightskip \TOCrightmargin\relax \parfillskip -\rightskip % or a smaller value if desired \leftskip \TOCleftmargin \relax } {\if@restonecol \twocolumn \fi\cleardoublepage}% % \etocsetstyle{part} {} {\addpenalty {-\@highpenalty}% \addvspace \TOCbigvskip \leavevmode {\large \bfseries % use a group to limit font change \interlinepenalty\@M \etocifnumbered{\etocnumber\hspace{1em}}{}% \etocname \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}}\par \nobreak } {} {}% % \etocsetstyle{chapter} {\advance\leftskip\TOCnumwidthB\relax} {\addpenalty {-\@highpenalty }% \vskip \TOCmedvskip\relax \leavevmode {\interlinepenalty\@M \etocifnumbered {\llap{\makebox[\TOCnumwidthB][l]{\bfseries\etocnumber}}} {\advance\leftskip-\TOCnumwidthB\relax}% \bfseries\etocname \nobreak\hfil\makebox[-\parfillskip][r]{\etocpage}\par }% \penalty \@highpenalty } {} {\advance\leftskip-\TOCnumwidthB\relax}% % \TOCsetlinestyle {section} {\TOCnumwidthC}% \TOCsetlinestyle {subsection} {\TOCnumwidthD}% \TOCsetlinestyle {subsubsection}{\TOCnumwidthE}% \TOCsetlinestyle {paragraph} {\TOCnumwidthF}% \TOCsetlinestyle {subparagraph} {\TOCnumwidthG}% }% end of \TOCglobalstyle %The common code for line styles is abstracted into a macro: \newcommand\TOCsetlinestyle [2]{% #1= unit, #2= numwidth as macro \etocsetstyle{#1} {\advance\leftskip#2\relax} {\vskip \TOCverysmallvskip\relax \leavevmode {\interlinepenalty\@M \etocifnumbered {\llap{\makebox[#2][l]{\etocnumber}}}{\advance\leftskip-#2\relax}% \etocname \nobreak\leaders \copy\TOCleaderbox \hfil\makebox[-\parfillskip][r]{\etocpage}% \par }% } {} {\advance\leftskip-#2\relax}% } \makeatother