diff options
Diffstat (limited to 'Master/texmf-dist/doc/latex/etoc/etocsnippet-21-A.tex')
-rw-r--r-- | Master/texmf-dist/doc/latex/etoc/etocsnippet-21-A.tex | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/etoc/etocsnippet-21-A.tex b/Master/texmf-dist/doc/latex/etoc/etocsnippet-21-A.tex new file mode 100644 index 00000000000..a06ecf784b4 --- /dev/null +++ b/Master/texmf-dist/doc/latex/etoc/etocsnippet-21-A.tex @@ -0,0 +1,100 @@ +%% LaTeX2e file `etocsnippet-21-A.tex' +%% generated by the `filecontentshere' environment +%% from source `etoc' on 2019/11/17. +%% +% 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 |