diff options
Diffstat (limited to 'macros/plain/contrib/misc/unouter.tex')
-rw-r--r-- | macros/plain/contrib/misc/unouter.tex | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/macros/plain/contrib/misc/unouter.tex b/macros/plain/contrib/misc/unouter.tex new file mode 100644 index 0000000000..8b640aaf1f --- /dev/null +++ b/macros/plain/contrib/misc/unouter.tex @@ -0,0 +1,36 @@ +% unouter.tex - remove the concept of \outer from plain TeX +% By Eamonn McManus Nov 88. This file is not copyrighted. + +% This macro removes the outerness of the control sequence \csname#1\endcsname +% by copying it to \csname un*#1\endcsname and then defining +% \csname#1\endcsname to be a macro that expands to that. For example, +% after \unouter{proclaim}, we have: \proclaim=macro:->\un*proclaim . +% and \un*proclaim=\outer macro:->[original definition of \proclaim] . +% It would be nice if we could avoid this extra level, but I know of no way +% of doing that short of writing the \meaning to a file and reading that in +% again (yeuch). +\def\unouter#1{\toks0=\expandafter{\csname un*#1\endcsname}% + \edef\next{\let\the\toks0=}\expandafter\next\csname#1\endcsname + \expandafter\edef\csname#1\endcsname{\the\toks0}} + +% In the case where the macro has no parameter text, we can unouter it +% directly by putting its expansion into a token list and redefining it +% in terms of that expansion. +\def\simpunouter#1{% + \toks0=\expandafter\expandafter\expandafter{\csname#1\endcsname}% + \expandafter\edef\csname#1\endcsname{\the\toks0}} + +% ^^L is defined as \outer\par +\let^^L=\par + +% Change everything else defined as \outer. +\simpunouter{newcount} \simpunouter{newdimen} \simpunouter{newskip} +\simpunouter{newmuskip} \simpunouter{newbox} \simpunouter{newtoks} +\simpunouter{newread} \simpunouter{newwrite} \simpunouter{newfam} +\simpunouter{+} \simpunouter{bye} +\unouter{newhelp} \unouter{newif} \unouter{beginsection} \unouter{proclaim} + +% \unouter no longer needed, and remove the offending primitive! +\let\unouter=\undefined \let\simpunouter=\undefined \let\outer=\relax + +\endinput |