% macros definitions for e-TeX manual

\def\NTS{\leavevmode\hbox{$\cal N\kern-0.35em\lower0.5ex\hbox{$\cal T$}%
  \kern-0.2emS$}}
\def\eTeX{\leavevmode\hbox{$\varepsilon$}-\TeX}
\def\TeXbook{{\sl The \TeX\/book\/}}

\DeclareFontShape{OT1}{cmr}{bxrev}{n}{<-> xbmc10}{} % for right-to-left text
\DeclareTextFontCommand{\revrm}{\fontseries{bxrev}\fontshape{n}\selectfont}

\ifx\beginL\undefined % this is \TeX
  \def\XeT{X\kern-.125em\lower.5ex\hbox{E}\kern-.1667emT}
  \def\TeXeT{\TeX-\hbox{\revrm{\XeT}}}
  \def\TeXXeT{\TeX-\hbox{\revrm{-\XeT}}}
\else
  \ifx\eTeXversion\undefined % this is \TeXeT
    \def\TeXeT{\TeX-\revrm{\beginR\TeX\endR}}
    \def\TeXXeT{\TeX-\revrm{\beginR\TeX-\endR}}
  \else % this is \eTeX
    \def\TeXeT{\TeX-\revrm{\TeXXeTstate=1\beginR\TeX\endR}}
    \def\TeXXeT{\TeX-\revrm{\TeXXeTstate=1\beginR\TeX-\endR}}
  \fi
\fi

{\def~{|} \global\catcode`\|=\active \global\let|=~}
\def\|{\leavevmode\verb|}
\def\<{\leavevmode\hbox\bgroup\catcode`>=13$\langle$} % syntax quantity
\def\>{\/$\rangle$\egroup} % finish syntax quantity
\def\cstok#1{\leavevmode\thinspace\hbox{\vrule\vtop{\vbox{\hrule\kern1pt
        \hbox{\vphantom{\tt/}\thinspace{\tt#1}\thinspace}}
      \kern1pt\hrule}\vrule}\thinspace} % control sequence token
\def\[#1]{\thinspace{\tt#1}\thinspace} % keyword in syntax

\newenvironment{paramlist}%
 {\endgraf\parskip=0pt
  \advance\leftskip by5em \parindent=-2.5em}%
 {\endgraf}

\newenvironment{syntax}%
 {\endgraf\nobreak\medskip
  \begingroup \catcode`<=13 \catcode`[=13 \let|=\|%
  \let\par=\endsyntaxline \obeylines}%
 {\medbreak}

\def\endsyntaxline{\futurelet\next\syntaxswitch}
\def\syntaxswitch{\ifx\next\<\let\next=\syntaxrule
  \else\ifx\next\end\let\next=\endgroup
  \else\let\next=\continuerule\fi\fi \next}
\def\continuerule{\hfil\break\indent\qquad}
{\catcode`<=13 \catcode`>=13 \catcode`[=13
  \global\let<=\< \global\let>=\> \global\let[=\[
  \gdef\syntaxrule<{\endgraf\indent\<}}
\def\is{\ $\longrightarrow$ }
\def\alt{\ $\vert$ }
\def\more{whatever \TeXbook\ defines}
\def\ot#1{\|#1|$_{12}$} % an other token
\def\cs#1{{\tt\char`\\#1}}

\newenvironment{multilist}[2]%
 {$$\setbox\z@=\hbox\bgroup  % catch some funny things -> \mathord
  \let\a=\empty
  \let\b=\empty
  \count@=\z@
  \toks@={#2}%
  \def\item##1\cr
   {\ifnum \count@=\z@
      \count@=#1%
      \expandafter\def\expandafter\b\expandafter{\b\y{}}%
    \fi
    \advance\count@ by\m@ne
    \expandafter\def\expandafter\a\expandafter{\a\x{##1}}}%
  \ignorespaces}%
 {\loop
  \ifnum \count@>\z@
    \expandafter\def\expandafter\a\expandafter{\a\expandafter\z\b\relax}%
    \advance\count@ by\m@ne
  \repeat
  \def\x##1{\expandafter\y\b\relax{##1}}%
  \def\y\y##1##2\relax##3%
   {\ifx @##1@%
      \def\b{##2\y{##3}}%
    \else
      \def\b{##2\y{##1&##3}}%
    \fi}%
  \def\z\y##1##2\relax{\def\b{##2\y{##1}}}%
  \a
  \def\x
   {\expandafter\egroup\expandafter\halign\expandafter\bgroup
    \expandafter&\the\toks@\cr}%
  \def\y##1{\expandafter\def\expandafter\x\expandafter{\x##1\cr}}%
  \b
  \x\egroup $$}

.
