r3tex

custom LuaTeX format
git clone git://git.rr3.xyz/r3tex
Log | Files | Refs | README | LICENSE

commit c0404758eb263369f832e0fe2a83b1afd2747c2c
parent e76fc35a68dcaa49db0cb2d2d411a2b7f3603e86
Author: robert <robertrussell.72001@gmail.com>
Date:   Sat, 15 Jan 2022 12:14:41 -0800

Add \tab, \obeytabs, and \expandtabs macros

Diffstat:
Mparam.tex | 1+
Mr3tex.tex | 1+
Mutil.tex | 21++++++++++++++++-----
3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/param.tex b/param.tex @@ -219,6 +219,7 @@ \relax %%% Custom "parameters": +% TODO: perhaps some of these should be style-specific \newskip\normalbaselineskip \newskip\normallineskip \newdimen\normallineskiplimit diff --git a/r3tex.tex b/r3tex.tex @@ -32,3 +32,4 @@ % TODO: add author info, etc. with \pdfinfo % TODO: \author, \title, \date, etc. should parse to eol +% TODO: \dospecials diff --git a/util.tex b/util.tex @@ -16,13 +16,14 @@ \chardef\#=`\# \chardef\$=`\$ -% Misc from plain +% Misc, mostly from plain \let\bgroup={ \let\egroup=} \let\endgraf=\par \let\endline=\cr \def\empty{} \def\space{ } +\def\tab{^^I} \def\null{\hbox{}} \def\m@th{\mathsurround=0pt } @@ -67,14 +68,24 @@ \def\^^M{\ } % control <return> = control <space> \def\^^I{\ } % control <tab> = control <space> { - \catcode`\^^M=13 % these lines must end with % + \catcode`\^^M=13 % These lines must end with %. % In \obeylines, we say `\let^^M=\par' instead of `\def^^M{\par}' - % since this allows, for example, `\let\par=\cr \obeylines \halign{...' + % since this allows, for example, `\let\par=\cr \obeylines \halign{...'. \gdef\obeylines{\catcode`\^^M=13 \let^^M=\par}% - \glet^^M=\par % in case ^^M appears in a \write + \glet^^M=\par % See The TeXBook, page 254. } \def\obeyspaces{\catcode`\ =13 } -{\obeyspaces\glet =\space} +{\obeyspaces\glet =\space} % See The TeXBook, page 254. +\def\obeytabs{\catcode`\^^I=13 } +{\obeytabs\glet^^I=\tab} % See The TeXBook, page 254. +{ +\obeytabs % These lines can not have tab indents. +\gdef\@expandtabs{% +\loop\ifnum\countA>0 \toksA\ea{\the\toksA\ }\decr\countA\repeat +\obeytabs \edef^^I{\the\toksA}% +} +\gdef\expandtabs{\afterassignment\@expandtabs \countA=} +} % Mode control \def\leavevmode{\unhbox\voidbox} \def\hmode{\leavevmode}