[latex3-commits] [git/LaTeX3-latex3-latex2e] lthooks2: crude way to typeset source2e for now fix bug in ltclass disable some code in ltdirchk (needs correcting) (322dd166)

Frank Mittelbach frank.mittelbach at latex-project.org
Sun Aug 16 10:34:25 CEST 2020


Repository : https://github.com/latex3/latex2e
On branch  : lthooks2
Link       : https://github.com/latex3/latex2e/commit/322dd166592cd17d763f9894dc887a255467d5f2

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

commit 322dd166592cd17d763f9894dc887a255467d5f2
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Sun Aug 16 10:34:25 2020 +0200

    crude way to typeset source2e for now
    fix bug in ltclass
    disable some code in ltdirchk (needs correcting)


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

322dd166592cd17d763f9894dc887a255467d5f2
 base/build.lua        |   2 +
 base/doc/source2e.tex |   4 +-
 base/ltclass.dtx      |   5 +-
 base/ltdirchk.dtx     |   4 +-
 base/ltfinal.dtx      |   8 ++-
 base/ltshipout.dtx    |   3 +-
 base/source2edoc.cls  | 194 ++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 213 insertions(+), 7 deletions(-)

diff --git a/base/build.lua b/base/build.lua
index 188a1aeb..34c2b1e2 100644
--- a/base/build.lua
+++ b/base/build.lua
@@ -53,6 +53,7 @@ sourcefiles    =
     "small2e.tex",
     "testpage.tex",
     "filehook-ltx.sty",       -- temp
+    "source2edoc.cls",        -- temp
      "*-????-??-??.sty"
   }
 textfiles =
@@ -72,6 +73,7 @@ textfiles =
   }
 typesetfiles   =
   {
+    "source2edoc.cls",        -- temp
     "source2e.tex", -- Has to be first: source2e.ist creation!
     "alltt.dtx",
     "classes.dtx",
diff --git a/base/doc/source2e.tex b/base/doc/source2e.tex
index 3529d437..65e0cf0d 100644
--- a/base/doc/source2e.tex
+++ b/base/doc/source2e.tex
@@ -69,7 +69,7 @@ page_precedence "rnaA"
 
 
 
-\documentclass{ltxdoc}
+\documentclass{source2edoc}
 
 \listfiles
 
@@ -314,6 +314,8 @@ page_precedence "rnaA"
 
  \DocInclude{ltpage}   % \pagestyle \raggedbottom \sloppy
 
+ \DocInclude{ltshipout}% \shipout redefinition (L3 module)
+
  \DocInclude{ltoutput} % Output routine
 
  \DocInclude{ltclass}  % Package & Class interface
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index 008d0960..16ac63d4 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -256,8 +256,9 @@
 %    \PassOptionsToPackage{foo,bar}{fred}
 %    \RequirePackage[baz]{fred}\end{verbatim}
 % is the same as:
-% \begin{verbatim}
-%    \RequirePackage[foo,bar,baz]{fred}\end{verbatim}
+%\begin{verbatim}
+%    \RequirePackage[foo,bar,baz]{fred}
+%\end{verbatim}
 %
 % \DescribeMacro\LoadClassWithOptions
 % |\LoadClassWithOptions|\marg{name}\oarg{version}:\\
diff --git a/base/ltdirchk.dtx b/base/ltdirchk.dtx
index 25fb9480..525af37a 100644
--- a/base/ltdirchk.dtx
+++ b/base/ltdirchk.dtx
@@ -172,7 +172,9 @@
 %, \LaTeX\ will not work around a bug in old \TeX\ versions, and
 % so error messages will appear in a very strange format, with |^^J|
 % appearing instead of line breaks:
-% \begingroup\catcode`\==\active \def=#1#2{}\hfuzz\maxdimen
+% \begingroup
+%  ^^A FMi next line doesn't work with hacked class
+%  ^^A\catcode`\==\active \def=#1#2{}\hfuzz\maxdimen
 %\begin{verbatim}
 %! LaTeX Error: \rubbish undefined.^^J^^JSee the LaTeX manual or LaTeX=
 % Companion
diff --git a/base/ltfinal.dtx b/base/ltfinal.dtx
index c1e3ea93..5a01f852 100644
--- a/base/ltfinal.dtx
+++ b/base/ltfinal.dtx
@@ -1141,21 +1141,25 @@
 \input lthooks.ltx
 %\input ltshipout.ltx
 
-\ExplSyntaxOn
+
+%    \end{macrocode}
 %  \begin{macro}{shipout/before,
 %                   shipout/foreground,shipout/background,
 %                   shipout/firstpage,
 %                   shipout/lastpage}
 %    Declaring all hooks for the shipout code.
 %    \begin{macrocode}
+\ExplSyntaxOn
 \hook_new:n{shipout/before}
 \hook_new:n{shipout/foreground}
 \hook_new:n{shipout/background}
 \hook_new:n{shipout/firstpage}
 \hook_new:n{shipout/lastpage}
+\ExplSyntaxOff
 %    \end{macrocode}
 %  \end{macro}
-\ExplSyntaxOff
+%    \begin{macrocode}
+
 
 \input ltfilehook.ltx
 
diff --git a/base/ltshipout.dtx b/base/ltshipout.dtx
index db796d0f..97889a03 100644
--- a/base/ltshipout.dtx
+++ b/base/ltshipout.dtx
@@ -53,7 +53,8 @@
 %
 % \long\def\fmi#1{\begin{quote}\itshape Todo: #1\end{quote}}
 %
-% \newcommand\hook[1]{\texttt{#1}}
+% \providecommand\hook[1]{\texttt{#1}}
+% \providecommand\pkg[1]{\texttt{#1}}
 %
 %
 % \title{The \texttt{ltshipout} package\thanks{This package has version
diff --git a/base/source2edoc.cls b/base/source2edoc.cls
new file mode 100644
index 00000000..4048f6cb
--- /dev/null
+++ b/base/source2edoc.cls
@@ -0,0 +1,194 @@
+
+% This class is buggy and needs fixing
+
+\ProvidesClass{source2edoc}[2020/08/16 v0.1 Quick hack to typeset source2.tex
+   (not usable for anything else and buggy -- will vanish again)!]
+
+\LoadClass{l3doc}
+
+\RemoveFromHook{begindocument}[l3doc]
+\AddToHook{begindocument}{\MakeShortVerb \|}
+
+%\ShowHook{begindocument}
+
+
+\def\partname{File}
+\renewcommand*{\DocInclude}[1]{%
+  \relax
+  \clearpage
+  \docincludeaux
+  \IfFileExists{#1.fdd}%
+    {\def\currentfile{#1.fdd}}%
+    {\def\currentfile{#1.dtx}}%
+  \ifnum\@auxout=\@partaux
+    \@latexerr{\string\include\space cannot be nested}\@eha
+  \else
+    \set at curr@file at trim@spaces{#1}%
+    \expandafter\@docinclude\expandafter{\@curr at file}
+ \fi}
+\def\@docinclude#1 {\clearpage
+\if at filesw \immediate\write\@mainaux{\string\@input{"#1.aux"}}\fi
+\@tempswatrue\if at partsw \@tempswafalse\edef\@tempb{#1}\@for
+\@tempa:=\@partlist\do{\ifx\@tempa\@tempb\@tempswatrue\fi}\fi
+\if at tempswa \let\@auxout\@partaux \if at filesw
+\immediate\openout\@partaux "#1.aux"
+\immediate\write\@partaux{\relax}\fi
+\let\@ltxdoc at PrintIndex\PrintIndex
+\let\PrintIndex\relax
+\let\@ltxdoc at PrintChanges\PrintChanges
+\let\PrintChanges\relax
+\let\@ltxdoc at theglossary\theglossary
+\let\@ltxdoc at endtheglossary\endtheglossary
+\part{\currentfile}%
+  {\let\ttfamily\relax
+  \xdef\filekey{\filekey, \thepart={\ttfamily\currentfile}}}%
+\DocInput{\currentfile}%
+\let\PrintIndex\@ltxdoc at PrintIndex
+\let\PrintChanges\@ltxdoc at PrintChanges
+\let\theglossary\@ltxdoc at theglossary
+\let\endtheglossary\@ltxdoc at endtheglossary
+\clearpage
+\@writeckpt{#1}\if at filesw \immediate\closeout\@partaux \fi
+\else\@nameuse{cp@#1}\fi\let\@auxout\@mainaux}
+\gdef\codeline at wrindex#1{\if at filesw
+      \begingroup
+        \let\protect\noexpand
+        \immediate\write\@indexfile
+            {\string\indexentry{#1}%
+            {\filesep\number\c at CodelineNo}}%
+      \endgroup\fi}
+\let\filesep\@empty
+\def\aalph#1{\@aalph{\csname c@#1\endcsname}}
+\def\@aalph#1{%
+  \ifcase#1\or a\or b\or c\or d\or e\or f\or g\or h\or i\or
+         j\or k\or l\or m\or n\or o\or p\or q\or r\or s\or
+         t\or u\or v\or w\or x\or y\or z\or A\or B\or C\or
+         D\or E\or F\or G\or H\or I\or J\or K\or L\or M\or
+         N\or O\or P\or Q\or R\or S\or T\or U\or V\or W\or
+         X\or Y\or Z\else\@ctrerr\fi}
+\def\docincludeaux{%
+  \def\thepart{\aalph{part}}\def\filesep{\thepart-}%
+  \let\filekey\@gobble
+  \g at addto@macro\index at prologue{%
+    \gdef\@oddfoot{\parbox[t]{\textwidth}{\strut\footnotesize
+       \raggedright{\bfseries File Key:} \filekey}}%
+    \let\@evenfoot\@oddfoot}%
+  \global\let\docincludeaux\relax
+ \gdef\@oddfoot{%
+   \expandafter\ifx\csname ver@\currentfile\endcsname\relax
+    File \thepart: {\ttfamily\currentfile} %
+   \else
+    \GetFileInfo{\currentfile}%
+    File \thepart: {\ttfamily\filename} %
+    Date: \filedate\ %
+    Version \fileversion
+    \fi
+    \hfill\thepage}%
+ \let\@evenfoot\@oddfoot}%
+\def\MaintainedBy#1{\gdef\@maintainedby{#1}}
+\let\@maintainedby\@empty
+\def\MaintainedByLaTeXTeam#1{%
+{\gdef\@maintainedby{%
+This file is maintained by the \LaTeX{} Project team.\\%
+Bug reports can be opened (category \texttt{#1}) at\\%
+\url{https://latex-project.org/bugs.html}.}}}
+\def\@maketitle{%
+  \newpage
+  \null
+  \vskip 2em%
+  \begin{center}%
+  \let \footnote \thanks
+    {\LARGE \@title \par}%
+    \vskip 1.5em%
+    {\large
+      \lineskip .5em%
+      \begin{tabular}[t]{c}%
+        \@author
+      \end{tabular}\par}%
+    \vskip 1em%
+    {\large \@date}%
+    \ifx\@maintainedby\@empty
+    \else
+    \vskip 1em%
+    \fbox{\fbox{\begin{tabular}{@{}l@{}}\@maintainedby\end{tabular}}}%
+    \fi
+  \end{center}%
+  \par
+  \vskip 1.5em}
+\providecommand\url{\texttt}
+\def\task#1#2{}
+
+
+\def\oc at scan#1{%
+  \ifx\oc at bslash#1%
+                      \egroup\let\next\oc at bslash\else
+  \ifcat a\noexpand#1%
+                      #1\let\next\oc at scan\else
+  \ifx\oc at percent#1%
+                      \def\next{\char`\%\egroup}%
+  \else
+                      #1\let\next\egroup
+  \fi\fi\fi\next}
+\def\oc at bslash{\bgroup\oc at ttf\char`\\\oc at scan}%
+\def\oc at verb#1{%
+  \catcode`#1\active
+  \uccode`\~`#1%
+  \uppercase{\def~{{\oc at ttf\char`#1}}}}
+\begingroup
+  \obeyspaces%
+  \catcode`\/=\catcode`\\
+  /catcode`/\/active
+  /catcode`<=/catcode`{%
+  /catcode`>=/catcode`}%
+  /catcode`/{/active%
+  /catcode`/}/active%
+  /gdef/oldc< \end{oldcomments}>%
+  /gdef/begmac<    \begin{macrocode}>%
+  /gdef/obs</def <</oc at ttf/ >>>%
+/endgroup%
+\begingroup
+  \catcode`\/=\catcode`\\
+  \catcode`\\=13
+  /catcode`/|=/catcode`/%
+  /catcode`/%=13
+  /gdef/oldcomments{|
+    /makeatletter
+    /let/do/oc at verb/dospecials
+    /frenchspacing/@vobeyspaces/obs
+    /raggedright
+    /oc at verb/>|
+    /oc at verb/<|
+    /let\/oc at bslash
+    /let%/oc at percent
+    /obeylines
+    /parindent/z@
+    /ttfamily/expandafter/let/expandafter/oc at ttf/the/font
+    /rmfamily
+    /textit{Historical /LaTeX/,2.09 comments (not necessarily accurate any more):}
+    /hfuzz/maxdimen
+    }
+/endgroup
+\begingroup
+  \sloppy%
+  \obeylines%
+  \gdef\oc at percent#1^^M{%
+    \ifvmode%
+    \def\commentline{#1}%
+    \ifx\commentline\oldc%
+    \textit{End of historical \LaTeX\,2.09 comments.}
+    \end{oldcomments}%
+    \else%
+    \ifx\commentline\begmac%
+    \begin{macrocode}%
+    \else%
+    \leavevmode%
+    #1^^M%
+    \fi\fi%
+    \else%
+    {\oc at ttf\char`\%}#1^^M%
+    \fi}%
+\endgroup%
+
+\errorstopmode  
+
+\endinput





More information about the latex3-commits mailing list.