summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-02-23 00:28:45 +0000
committerKarl Berry <karl@freefriends.org>2020-02-23 00:28:45 +0000
commitf24377c5813241f4296f4b9d5118dbde63f296ed (patch)
tree7ff345a605796219a6bbe7e1b034dbf5dc8b6802 /Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx
parent518c6e7b162ab91af2be637db0700cf235c1513c (diff)
ntgclass (22feb20)
git-svn-id: svn://tug.org/texlive/trunk@53870 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx')
-rw-r--r--Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx349
1 files changed, 239 insertions, 110 deletions
diff --git a/Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx b/Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx
index 53b1064b112..b8322eb68f5 100644
--- a/Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx
+++ b/Master/texmf-dist/source/latex/ntgclass/ntgclass.dtx
@@ -1,62 +1,41 @@
-% \iffalse meta-comment
-%
-% % \iffalse meta-comment
-% %
-% % Copyright (C) 1990-2004 Nederlandstalige TeX Gebruikersgroep.
-% % All rights reserved.
-% %
-% % This file is part of the NTG document classes distribution
-% % ----------------------------------------------------------
-% %
-% % It may be distributed and/or modified under the
-% % conditions of the LaTeX Project Public License, either version 1.3
-% % 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.3 or later is part of all distributions of LaTeX
-% % version 2003/12/01 or later.
-% %
-% % This work has the LPPL maintenance status "maintained".
-% %
-% % The Current Maintainer of this work is Johannes Braams.
-% %
-% % The list of all files belonging to the NTG document classes
-% % distribution is given in the file `manifest.txt.
-% %
-% % The list of derived (unpacked) files belonging to the distribution
-% % and covered by LPPL is defined by the unpacking scripts (with
-% % extension .ins) which are part of the distribution.
-% % \fi
-% \fi
-% \CheckSum{3726}
% \iffalse
-%% Copyright (C) 1994 -- 2004 by Victor Eijkhout and Johannes Braams
-%% Based on classes.dtx
-%% Copyright (C) 1999 LaTeX3 project, all rights reserved.
-%%
-%% \CharacterTable
-%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
-%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
-%% Digits \0\1\2\3\4\5\6\7\8\9
-%% Exclamation \! Double quote \" Hash (number) \#
-%% Dollar \$ Percent \% Ampersand \&
-%% Acute accent \' Left paren \( Right paren \)
-%% Asterisk \* Plus \+ Comma \,
-%% Minus \- Point \. Solidus \/
-%% Colon \: Semicolon \; Less than \<
-%% Equals \= Greater than \> Question mark \?
-%% Commercial at \@ Left bracket \[ Backslash \\
-%% Right bracket \] Circumflex \^ Underscore \_
-%% Grave accent \` Left brace \{ Vertical bar \|
-%% Right brace \} Tilde \~}
%
+% Copyright (C) 1994 -- 2020 by Nederlandstalige TeX Gebruikersgroep.
+% Based on classes.dtx
+% Copyright (C) 1999 LaTeX3 project, all rights reserved.
+%
+% This file is part of the NTG document classes distribution
+% ----------------------------------------------------------
+%
+% It may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3c
+% 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.3c or later is part of all distributions of LaTeX
+% version 2008 or later.
+%
+% This work has the LPPL maintenance status "maintained".
+%
+% The Current Maintainer of this work is Johannes Braams.
+%
+% The list of all files belonging to the NTG document classes
+% distribution is given in the file `manifest.txt.
+%
+% The list of derived (unpacked) files belonging to the distribution
+% and covered by LPPL is defined by the unpacking scripts (with
+% extension .ins) which are part of the distribution.
+%
+% \fi
+% \CheckSum{3782}
+%\iffalse
% \section{Identification}
%
% These document classes can only be used with \LaTeXe, so we make
% sure that an appropriate message is displayed when another \TeX{}
% format is used.
% \begin{macrocode}
-%<artikel|rapport|boek>\NeedsTeXFormat{LaTeX2e}[1995/06/01]
+%<artikel|rapport|boek>\NeedsTeXFormat{LaTeX2e}[1995/12/01]
% \end{macrocode}
%
% Announce the Class name and its version:
@@ -80,7 +59,7 @@
%<*driver>
\ProvidesFile{ntgclass.drv}
%</driver>
- [2004/06/07 v2.1a
+ [2020/02/22 v2.1c
%<artikel|rapport|boek> NTG LaTeX document class]
%<10pt|11pt|12pt> NTG LaTeX file (size option)]
% \end{macrocode}
@@ -178,8 +157,6 @@
% \end{macrocode}
% \fi
%
-%
-%
% \changes{v2.0b}{1994/02/02}{Removed typos that were found in
% classes.dtx, synced with that file}
% \changes{v2.0d}{1994/02/23}{Fixed some errors in the documentation}
@@ -196,13 +173,15 @@
% \changes{v2.0p}{1995/08/10}{use \cs{hb@xt@} instead of \cs{hbox}
% \texttt{to}}
% \changes{v2.0x}{1997/09/08}{Repaired a few documentation bugs}
+% \changes{v2.1c}{2020/02/18}{Update to synchronize with classes.dtx}
+% \changes{v2.1c}{2020/02/18}{Various commands made robust}
%
% \title{NTG Document Classes for \LaTeX{} version 2e\thanks{This file
% has version number \fileversion, last revised \filedate.}}
%
% \author{%
% Copyright (C) 1992 by Leslie Lamport \and
-% Copyright (C) 1994,1999 by Victor Eijkhout \and Johannes Braams
+% Copyright (C) 1994-2020 by Victor Eijkhout \and Johannes Braams
% }
% \date{\filedate}
%
@@ -659,6 +638,16 @@
% \begin{macrocode}
\normalsize
% \end{macrocode}
+% We use |\MakeRobust| instead of |\DeclareRobustCommand| above to
+% avoid a log entry for the redefinition.
+% But if we are running in a rollback situation
+% (prior to 2015) we don't touch it.
+% \changes{v2.1c}{2020/02/18}{Roll back handling (gh/201)}
+% \begin{macrocode}
+\ifx\MakeRobust\@undefined \else
+ \MakeRobust\normalsize
+\fi
+% \end{macrocode}
% \end{macro}
% \end{macro}
%
@@ -666,8 +655,10 @@
% \changes{v2.0f}{1994/04/18}{Use \cs{newcommand} instead of
% \cs{renewcommand} because of change in the \LaTeX kernel}
% This is similar to |\normalsize|.
+% \changes{v2.1c}{2020/02/18}{Use \cs{DeclareRobustCommand} instead of
+% \cs{newcommand*}}
% \begin{macrocode}
-\newcommand*\small{%
+\DeclareRobustCommand\small{%
%<*10pt>
\@setfontsize\small\@ixpt{11}%
\abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
@@ -696,7 +687,7 @@
% \cs{renewcommand} because of change in the \LaTeX kernel}
% This is similar to |\normalsize|.
% \begin{macrocode}
-\newcommand*\footnotesize{%
+\DeclareRobustCommand\footnotesize{%
%<*10pt>
\@setfontsize\footnotesize\@viiipt{9.5}%
\abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
@@ -734,30 +725,30 @@
% lists alone.
% \begin{macrocode}
%<*10pt>
-\newcommand*\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt}
-\newcommand*\tiny{\@setfontsize\tiny\@vpt\@vipt}
-\newcommand*\large{\@setfontsize\large\@xiipt{14}}
-\newcommand*\Large{\@setfontsize\Large\@xivpt{18}}
-\newcommand*\LARGE{\@setfontsize\LARGE\@xviipt{22}}
-\newcommand*\huge{\@setfontsize\huge\@xxpt{25}}
-\newcommand*\Huge{\@setfontsize\Huge\@xxvpt{30}}
+\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt}
+\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vpt\@vipt}
+\DeclareRobustCommand\large{\@setfontsize\large\@xiipt{14}}
+\DeclareRobustCommand\Large{\@setfontsize\Large\@xivpt{18}}
+\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xviipt{22}}
+\DeclareRobustCommand\huge{\@setfontsize\huge\@xxpt{25}}
+\DeclareRobustCommand\Huge{\@setfontsize\Huge\@xxvpt{30}}
%</10pt>
%<*11pt>
-\newcommand*\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}}
-\newcommand*\tiny{\@setfontsize\tiny\@vipt\@viipt}
-\newcommand*\large{\@setfontsize\large\@xiipt{14}}
-\newcommand*\Large{\@setfontsize\Large\@xivpt{18}}
-\newcommand*\LARGE{\@setfontsize\LARGE\@xviipt{22}}
-\newcommand*\huge{\@setfontsize\huge\@xxpt{25}}
-\newcommand*\Huge{\@setfontsize\Huge\@xxvpt{30}}
+\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}}
+\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vipt\@viipt}
+\DeclareRobustCommand\large{\@setfontsize\large\@xiipt{14}}
+\DeclareRobustCommand\Large{\@setfontsize\Large\@xivpt{18}}
+\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xviipt{22}}
+\DeclareRobustCommand\huge{\@setfontsize\huge\@xxpt{25}}
+\DeclareRobustCommand\Huge{\@setfontsize\Huge\@xxvpt{30}}
%</11pt>
%<*12pt>
-\newcommand*\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}}
-\newcommand*\tiny{\@setfontsize\tiny\@vipt\@viipt}
-\newcommand*\large{\@setfontsize\large\@xivpt{18}}
-\newcommand*\Large{\@setfontsize\Large\@xviipt{22}}
-\newcommand*\LARGE{\@setfontsize\LARGE\@xxpt{25}}
-\newcommand*\huge{\@setfontsize\huge\@xxvpt{30}}
+\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viiipt{9.5}}
+\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vipt\@viipt}
+\DeclareRobustCommand\large{\@setfontsize\large\@xivpt{18}}
+\DeclareRobustCommand\Large{\@setfontsize\Large\@xviipt{22}}
+\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xxpt{25}}
+\DeclareRobustCommand\huge{\@setfontsize\huge\@xxvpt{30}}
\let\Huge=\huge
%</12pt>
%</10pt|11pt|12pt>
@@ -1692,7 +1683,7 @@
% \begin{macrocode}
\renewcommand*\ps@plain{%
% \end{macrocode}
-% The running head are empty in this pagestyle, the page number
+% The running heads are empty in this pagestyle, the page number
% appears in the running foot.
% \begin{macrocode}
\let\@oddhead\@empty\let\@evenhead\@empty
@@ -2361,6 +2352,8 @@
% This |{| used to be after the argument to |\@hangfrom| but was
% moved here to allow commands such as |\MakeUppercase| to be used
% at the end of |#6|.
+% \changes{v2.1b}{2004/08/14}{No longer pass \cs{toc@font} through the
+% \texttt{.aux} file as this upsets pdf\LaTeX}
% \begin{macrocode}
#6{%
%<*type1|type3>
@@ -2377,7 +2370,7 @@
\else
\protect\numberline{\csname the#1\endcsname}%
\fi
- \toc@font#2 #7}%
+ #7}%
\else
\def\@svsechd{#6\hskip #3\relax
\@svsec #8\csname #1mark\endcsname{#7}%
@@ -2386,7 +2379,7 @@
\else
\protect\numberline{\csname the#1\endcsname}%
\fi
- \toc@font#2 #7}}%
+ #7}}%
\fi
\@xsect{#5}}
% \end{macrocode}
@@ -2675,12 +2668,14 @@
% part, otherwise it is unnumbered.
% \changes{v2.0p}{1995/08/10}{replace \cs{reset@font} with
% \cs{normalfont}}
+% \changes{v2.1b}{2004/08/16}{use \cs{numberline} instead of a fixed
+% space of \texttt{1 em}}
% \begin{macrocode}
%<*artikel>
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{part}%
- \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+ \addcontentsline{toc}{part}{\protect\numberline{\thepart}#1}%
\else
\addcontentsline{toc}{part}{#1}%
\fi
@@ -2718,12 +2713,14 @@
% When \Lcount{secnumdepth} is larger than $-2$ for the
% document class rapport and boek, we have a numbered
% part, otherwise it is unnumbered.
+% \changes{v2.1b}{2004/08/16}{use \cs{numberline} instead of a fixed
+% space of \texttt{1 em}}
% \begin{macrocode}
%<*rapport|boek>
\def\@part[#1]#2{%
\ifnum \c@secnumdepth >-2\relax
\refstepcounter{part}%
- \addcontentsline{toc}{part}{\thepart\hspace{1em}\toc@case{#1}}%
+ \addcontentsline{toc}{part}{\protect\numberline{\thepart}{#1}}%
\else
\addcontentsline{toc}{part}{\toc@case{#1}}%
\fi
@@ -2743,11 +2740,13 @@
% When this is a numbered part we have to print the number. We have
% to expand |\partname| before |\uppercase| is called, therefore we
% use a temporary control sequence that, when called will execute
-% |\uppercase| on the contents of |\partname|.
+% |\MakeUppercase| on the contents of |\partname|.
+% \changes{v2.1c}{2020/02/22}{Use \cs{MakeUppercase} instead of
+% \cs{uppercase}}
% \begin{macrocode}
\ifnum \c@secnumdepth >-2\relax
\Large\PartFont
- \edef\@tempa{\noexpand\uppercase{\partname}}\@tempa
+ \edef\@tempa{\noexpand\MakeUppercase{\partname}}\@tempa
\nobreakspace\thepart
\par
% \end{macrocode}
@@ -2756,7 +2755,7 @@
% \begin{macrocode}
\vskip 20\p@
\fi
- \Large \PartFont \uppercase{#2}\par}%
+ \Large \PartFont \MakeUppercase{#2}\par}%
\@endpart}
%</rapport|boek>
% \end{macrocode}
@@ -2868,6 +2867,8 @@
% inform the user that a new chapter is about to be typeset by
% writing a message to the terminal.
% \changes{v2.0k}{1994/06/08}{Removed carriage return behind +boek}
+% \changes{v2.1b}{2004/08/14}{No longer pass \cs{toc@font} through the
+% \texttt{.aux} file as this upsets pdf\LaTeX}
% \begin{macrocode}
\def\@chapter[#1]#2{%
\ifnum \c@secnumdepth >\m@ne
@@ -2875,14 +2876,14 @@
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}\toc@font0 #1}%
+ {\protect\numberline{\thechapter}#1}%
%<*boek>
\else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
+ \addcontentsline{toc}{chapter}{#1}%
\fi
%</boek>
\else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
+ \addcontentsline{toc}{chapter}{#1}%
\fi
% \end{macrocode}
% After having written an entry to the table of contents we store
@@ -3417,15 +3418,20 @@
% We want to have different label positioning on different levels of
% list. To acheive this we have to redefine the \Lenv{enumerate}
% environment.
-%
+% \changes{v2.1c}{2020/02/21}{Use \cs{thr@@}}
% \begin{macrocode}
\renewenvironment{enumerate}{%
- \ifnum \@enumdepth >3
+ \ifnum \@enumdepth >\thr@@
\@toodeep
\else
\advance\@enumdepth \@ne
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
- \list{\csname label\@enumctr\endcsname}
+% \end{macrocode}
+% \changes{v2.1c}{2020/02/21}{Use \cs{expandafter}}
+% \begin{macrocode}
+ \expandafter
+ \list
+ \csname label\@enumctr\endcsname
{\usecounter{\@enumctr}%
%<type1> \ifnum \@listdepth=1
%<*type1|type3>
@@ -3464,29 +3470,54 @@
% \changes{v2.0u}{1996/09/23}{Did similar for the bullet and centered
% dot.}
% \changes{v2.0v}{1997/03/02}{Now also \cs{textasteriskcentered}}
+% \changes{v2.1c}{2020/02/18}{Use \cs{labelitemfont}}
+% \begin{macrocode}
+\newcommand\labelitemi {\labelitemfont \textbullet}
+\newcommand\labelitemii {\labelitemfont \bfseries \textendash}
+\newcommand\labelitemiii{\labelitemfont \textasteriskcentered}
+\newcommand\labelitemiv {\labelitemfont \textperiodcentered}
+% \end{macrocode}
+%
+% \begin{macro}{\labelitemfont}
+% The default definition for \cs{labelitemfont} is to reset the
+% font to \cs{normalfont} so that always the same symbol is
+% produced regardless of surrounding conditions.
+%
+% \changes{v2.1c}{2020/02/18}{Normalize label fonts}
+% A possible alternative would be
+%\begin{verbatim}
+%\renewcommand\labelitemfont{%
+% \fontseries\seriesdefault
+% \fontshape\shapedefault\selectfont}
+%\end{verbatim}
+% which resets series and shape doesn't touch the family.
% \begin{macrocode}
-\newcommand*{\labelitemi}{\textbullet}
-\newcommand*{\labelitemii}{\normalfont\bfseries \textendash}
-\newcommand*{\labelitemiii}{\textasteriskcentered}
-\newcommand*{\labelitemiv}{\textperiodcentered}
+\newcommand\labelitemfont{\normalfont}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{environment}{itemize}
% We want to have differen label positioning on different levels of
% list. To acheive this we have to redefine the \Lenv{itemize}
% environment.
+% \changes{v2.1c}{2020/02/21}{Use \cs{thr@@}}
% \begin{macrocode}
\renewenvironment{itemize}{%
- \ifnum \@itemdepth >3
+ \ifnum \@itemdepth >\thr@@
\@toodeep
\else
\advance\@itemdepth \@ne
\edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
- \list{\csname\@itemitem\endcsname}%
+% \end{macrocode}
+% \changes{v2.1c}{2020/02/21}{Use \cs{expandafter}}
+% \begin{macrocode}
+ \expandafter
+ \list
+ \csname\@itemitem\endcsname
{%
%<type1> \ifnum \@listdepth=1\relax
%<*type1|type3>
@@ -3526,8 +3557,10 @@
% To change the formatting of the label, you must redefine
% |\descriptionlabel|.
%
+% \changes{v2.1c}{2020/02/18}{Inserted \cs{normalfont}}
% \begin{macrocode}
-\newcommand*\descriptionlabel[1]{\hspace\labelsep \bfseries #1}
+\newcommand*\descriptionlabel[1]{\hspace\labelsep
+ \normalfont\bfseries #1}
% \end{macrocode}
% \end{macro}
%
@@ -3607,12 +3640,17 @@
%
% Note that this environment is not defined for boeks.
% \changes{v2.0e}{1994/03/19}{Use \cs{SectFont} for the abstract title}
+% \changes{v2.1c}{2020/02/18}{Added setting of \cs{beginparpenalty}
+% to discourage page break before abstract heading and setting of
+% \cs{@endparpenalty} to avoid page break after abstract heading.}
% \begin{macrocode}
%<!boek>\if@titlepage
\newenvironment{abstract}{%
\titlepage
\null\vfil
- \hbox{\SectFont \abstractname}
+ \@beginparpenalty\@lowpenalty
+ \hbox{\SectFont \abstractname}%
+ \@endparpenalty\@M
\noindent\ignorespaces}
{\par\vfil\null\endtitlepage}
% \end{macrocode}
@@ -4405,10 +4443,22 @@
% information.
% \changes{v2.1a}{2004/06/07}{Moved \cs{@mkboth} out of heading arg
% (\LaTeX{} pr/3285)}
+% \changes{v2.1c}{2020/02/18}{Explain why \cs{@mkboth} is inside the heading
+% arg for \cs{tableofcontents} (\LaTeX{} pr/3285 and pr/3984)}
% \begin{macrocode}
\chapter*{\contentsname}%
%</rapport|boek>
%<artikel> \section*{\contentsname}%
+% \end{macrocode}
+% The code for |\@mkboth| is placed inside the heading to avoid any
+% influence on vertical spacing after the heading (in some cases). For
+% other commands, such as |\listoffigures| below this has been changed from
+% the \LaTeX{}2.09 version as it will produce a serious bug if used in
+% two-column mode (see, \LaTeX{} pr/3285). However
+% |\tableofcontents| is always
+% typeset in one-column mode in these classes, therefore the somewhat
+% inconsistent setting has been retained for compatibility reasons.
+% \begin{macrocode}
\@mkboth{\MakeUppercase{\contentsname}}%
{\MakeUppercase{\contentsname}}%
% \end{macrocode}
@@ -4424,7 +4474,7 @@
%
% \begin{macro}{\@starttoc}
% The internal \LaTeXe macro |\@starttoc| needs to be adapted for
-% the \file{artikel3} and \file{rapport3} document classes,in order
+% the \file{artikel3} and \file{rapport3} document classes, in order
% to deal with a the fact that for these document classes the
% |\parskip| is normally non-zero. We don't want that in the table
% of contents.
@@ -4437,7 +4487,12 @@
\if@filesw
\expandafter\newwrite\csname tf@#1\endcsname
\immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
- \fi \global\@nobreakfalse \endgroup}
+% \end{macrocode}
+%
+% \changes{v2.1c}{2020/02/21}{Remove \cs{global} before
+% \cs{@nobreakfalse} as was done in \LaTeX}
+% \begin{macrocode}
+ \fi \@nobreakfalse \endgroup}
%</type3>
% \end{macrocode}
% \end{macro}
@@ -4447,6 +4502,10 @@
% contents than the standard classes from which they were
% developped. In order to acheive this different format we defined
% the macro |\@regtocline|.
+% \changes{v2.1b}{2004/08/14}{\cs{toc@font} is no longer passed
+% throughthe \texttt{.aux}-file, we set it here directly}
+% \changes{v2.1b}{2004/08/16}{\cs{toc@case} is no longer passed
+% through the \texttt{.aux} file, set it directly}
% \begin{macrocode}
\newcommand*\@regtocline[3]{%
\ifnum #1>\c@tocdepth
@@ -4460,7 +4519,9 @@
%<type2> \advance\@tempdima by \othermargin
\parindent\z@
\leavevmode
- \hbox{}\hskip -\leftskip\relax#2\nobreak
+ \hbox{}\hskip -\leftskip\relax
+ \ifnum#1<0\toc@case{#2}\else
+ \toc@font#1 #2\fi\nobreak
\hskip 1em \nobreak{\slshape #3}\par
}%
\fi}
@@ -4476,14 +4537,32 @@
% \end{macro}
%
% \begin{macro}{\toc@font}
+% \begin{macro}{\toc@fontsel}
% The changed definition of |\@sect| that we use, selects a
% different font for the table of contents for the various header
% levels. It does this using |\toc@font|.
+% \changes{v2.1b}{2004/08/16}{We want this font change to only affect
+% the section title, \emph{not} the section number, therefor we
+% need to push it behind \cs{numberline} and its argument}
% \begin{macrocode}
\if@oldtoc
\newcommand*\toc@font[1]{\relax}
\else
- \newcommand*\toc@font[1]{%
+% \end{macrocode}
+% A line of the table of contents contains |\numberline| and the
+% section number as its first two elements. We don't want to set
+% the section number using |\toc@font|, therefor we give it two
+% additional arguments and pass them on first, \emph{before}
+% changing the font. Note that we need to re-insert the braces
+% around the second argument.
+% \changes{v2.1b}{2004/08/16}{Introduce a separarte macro
+% \cs{toc@fontsel}}
+% \changes{v2.1c}{2020/02/22}{We need to jump another tolken, so we
+% need 4 arguments to accomplish that}
+% \begin{macrocode}
+ \newcommand*\toc@font[4]{%
+ #2{#3}#4\toc@fontsel#1}
+ \newcommand*\toc@fontsel[1]{%
%<*artikel>
\ifcase#1\relax
%<type2> \Large\bfseries
@@ -4498,9 +4577,39 @@
\or\rmfamily
%</rapport|boek>
\fi}
+% \end{macrocode}
+% \changes{v2.1b}{2004/08/16}{Take \textsf{hyperref} into account}
+% When the user wants to produce a hyper-document using
+% \textsf{hyperref} we need to take special precautions to make it
+% work for the table of contents. We check for the existence of
+% |\hyper@linkstart| to detect this situation at
+% |\begin{document}|.
+%
+% \textsf{Hyperref} injects extra tokens
+% (|\hyper@linkstart{link}{Hy@tocdestname}|)
+% into the stream in front of thde real contentsline. The command
+% |\hyper@linkstart| and its arguments need to be protected from
+% expanding too early or being ``upperccased'' themselves.
+%
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifx\hyper@linkstart\undefined
+ \else
+% \end{macrocode}
+% In the contentslines for chapters, sections etc., the command
+% selection of the appropriate font needs to come after the code
+% that \textsf{hyperref} injects. we do this with some argument
+% shuffling.
+% \changes{v2.1c}{2020/02/21}{removed the space between \#1 and \#5}
+% \begin{macrocode}
+ \let\ORG@hyper@linkstart\hyper@linkstart
+ \protected\def\hyper@linkstart#1#2{%
+ \lowercase{\ORG@hyper@linkstart{#1}{#2}}}
+ \fi}
\fi
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\toc@case}
% In the \file{rapport} and \file{boek} document classes, the
@@ -4558,7 +4667,13 @@
% set flush right.
% \begin{macrocode}
{\leavevmode
- \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2%
+% \end{macrocode}
+%
+% \changes{v2.1c}{2020/02/18}{Prevent protrusion
+% (\url{https://tex.stackexchange.com/q/172785/10109})}
+% \begin{macrocode}
+ \kern-\p@\kern\p@}}\par
% \end{macrocode}
% Prevent a pagebreak immediately after this entry, but use
% |\everypar| to reset the |\if@nobreak| switch. Finally we close
@@ -4574,15 +4689,17 @@
\fi}
% \end{macrocode}
% Then we can introduce our new definition.
+% \changes{v2.1b}{2004/08/16}{Use \cs{l@@part} to prevent the \cs{fi}
+% from intervening}
% \begin{macrocode}
\else
\newcommand*\l@part{%
- \ifnum \c@tocdepth >-2\relax
+ \ifnum \c@tocdepth >-2\let\l@@part\relax
%<artikel> \addpenalty\@secpenalty
%<!artikel> \addpenalty{-\@highpenalty}%
\addvspace{2.25em \@plus \p@}%
- \@regtocline{0}%
- \fi}
+ \def\l@@part{\@regtocline{-1}}%
+ \fi\l@@part}
\fi
% \end{macrocode}
% \end{macro}
@@ -4626,7 +4743,13 @@
% \begin{macrocode}
\advance\leftskip\@tempdima
\hskip -\leftskip
- #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
+ #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2%
+% \end{macrocode}
+%
+% \changes{v2.1b}{2020/02/17}{Prevent protrusion
+% (\url{https://tex.stackexchange.com/q/172785/10109})}
+% \begin{macrocode}
+ \kern-\p@\kern\p@}\par
\penalty\@highpenalty
\endgroup}
% \end{macrocode}
@@ -4677,7 +4800,13 @@
% \begin{macrocode}
\advance\leftskip\@tempdima
\hskip -\leftskip
- #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
+ #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2%
+% \end{macrocode}
+%
+% \changes{v2.1b}{2020/02/18}{Prevent protrusion
+% (\url{https://tex.stackexchange.com/q/172785/10109})}
+% \begin{macrocode}
+ \kern-\p@\kern\p@}}\par
\endgroup}
% \end{macrocode}
% The new definition:
@@ -5270,4 +5399,4 @@
% \Finale
%
\endinput
-%
+% \ No newline at end of file