[latex3-commits] [git/LaTeX3-latex3-latex3] master: Use chapters in interface3 (62449376a)

Joseph Wright joseph.wright at morningstar2.co.uk
Mon Feb 8 16:56:28 CET 2021


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/62449376ae3a05203e98b8f6c8d8f63a36e42340

>---------------------------------------------------------------

commit 62449376ae3a05203e98b8f6c8d8f63a36e42340
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Mon Feb 8 15:56:28 2021 +0000

    Use chapters in interface3


>---------------------------------------------------------------

62449376ae3a05203e98b8f6c8d8f63a36e42340
 l3kernel/doc/source3body.tex | 88 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 76 insertions(+), 12 deletions(-)

diff --git a/l3kernel/doc/source3body.tex b/l3kernel/doc/source3body.tex
index 2f36e993e..9290fd990 100644
--- a/l3kernel/doc/source3body.tex
+++ b/l3kernel/doc/source3body.tex
@@ -72,16 +72,6 @@ stand-alone \LaTeX3 is developed.
 
 \end{abstract}
 
-\clearpage
-
-{%
-  \def\\{:}% fix "newlines" in the ToC
-  \tableofcontents
-}
-
-\clearpage
-\pagenumbering{arabic}
-
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
 % Each of the following \DocInput lines includes a file with extension
@@ -97,15 +87,89 @@ stand-alone \LaTeX3 is developed.
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
 \makeatletter
+% l3doc is based on article, but for these very large documents we need
+% chapters; the code is based on the standard classes but somewhat simplified
+\newcounter {chapter}
+\numberwithin{section}{chapter}
+\renewcommand \thechapter {\@arabic\c at chapter}
+\renewcommand \thesection {\thechapter.\@arabic\c at section}
+\newcommand*\chaptermark[1]{}
+\setcounter{secnumdepth}{2}
+\newcommand\@chapapp{\chaptername}
+\newcommand\chaptername{Chapter}
+  \def\ps at headings{%
+    \let\@oddfoot\@empty
+    \def\@oddhead{{\slshape\rightmark}\hfil\thepage}%
+    \let\@mkboth\markboth
+    \def\chaptermark##1{%
+      \markright {\MakeUppercase{%
+        \ifnum \c at secnumdepth >\m at ne
+            \@chapapp\ \thechapter. \ %
+        \fi
+        ##1}}}}
+\newcommand\chapter{\clearpage
+                    \thispagestyle{plain}%
+                    \global\@topnum\z@
+                    \@afterindentfalse
+                    \secdef\@chapter\@schapter}
+\def\@chapter[#1]#2{\refstepcounter{chapter}%
+                    \typeout{\@chapapp\space\thechapter.}%
+                    \addcontentsline{toc}{chapter}%
+                      {\protect\numberline{\thechapter}#1}%
+                    \chaptermark{#1}%
+                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
+                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
+                    \@makechapterhead{#2}%
+                    \@afterheading}
+\def\@makechapterhead#1{%
+  \vspace*{50\p@}%
+  {\parindent \z@ \raggedright \normalfont
+   \huge\bfseries \@chapapp\space \thechapter
+   \par\nobreak
+   \vskip 20\p@
+    \interlinepenalty\@M
+    \Huge \bfseries #1\par\nobreak
+    \vskip 40\p@
+  }}
+\newcommand*\l at chapter[2]{%
+  \ifnum \c at tocdepth >\m at ne
+    \addpenalty{-\@highpenalty}%
+    \vskip 1.0em \@plus\p@
+    \setlength\@tempdima{1.5em}%
+    \begingroup
+      \parindent \z@ \rightskip \@pnumwidth
+      \parfillskip -\@pnumwidth
+      \leavevmode \bfseries
+      \advance\leftskip\@tempdima
+      \hskip -\leftskip
+      #1\nobreak\hfil
+      \nobreak\hb at xt@\@pnumwidth{\hss #2%
+                                 \kern-\p@\kern\p@}\par
+      \penalty\@highpenalty
+    \endgroup
+  \fi}
+\renewcommand*\l at section{\@dottedtocline{1}{1.5em}{2.3em}}
+\renewcommand*\l at subsection{\@dottedtocline{2}{3.8em}{3.2em}}
+\renewcommand*\l at subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
 \def\partname{Part}
-\def\maketitle{\clearpage\part{\@title}}
+\def\maketitle{\chapter{\@title}}
 \let\thanks\@gobble
 \let\DelayPrintIndex\PrintIndex
 \let\PrintIndex\@empty
 \providecommand*{\hexnum}[1]{\text{\texttt{\char`\"}#1}}
 \makeatother
 
-\part{Introduction to \pkg{expl3} and this document}
+\clearpage
+
+{%
+  \def\\{:}% fix "newlines" in the ToC
+  \tableofcontents
+}
+
+\clearpage
+\pagenumbering{arabic}
+
+\chapter{Introduction to \pkg{expl3} and this document}
 
 This document is intended to act as a comprehensive reference manual
 for the \pkg{expl3} language. A general guide to the \LaTeX3





More information about the latex3-commits mailing list.