[texhax] dual-use input/output macro

Oleg Katsitadze geolsoft at mail.ru
Fri Nov 18 13:35:17 CET 2005

On Thu, Nov 17, 2005 at 11:26:32PM +0200, Oleg Katsitadze wrote:
> As a side effect, there will be
> spaces after macro names in the verbatim text

Got another idea overnight--now I think it is possible to
avoid the extra spaces:  before we read the argument, we
change the catcode of backslash to \letter, and also do
\obeyspaces to prevent multiple spaces collapsing into one.
This is what I ended up with:

-------------------- Cut --------------------
\input eplain


\def\showme{\begingroup\catcode`\\=\letter \obeyspaces
  \input show\par


\showme{{hello, \relax here}}

\showme{\begingroup  hello,~{\it  there} $\|a_i\|^2$}

\showme{\line{hello,\hrulefill everywhere}}

-------------------- Cut --------------------

I haven't tested this thoroughly, but it seems to work with
pretty weired arguments.  Unbalanced braces won't work for
sure, but this would not be a good example to show :).

Best regards,
Oleg Katsitadze

More information about the texhax mailing list