[texhax] dual-use input/output macro

Uwe Lück uwe.lueck at web.de
Fri Jan 27 02:19:01 CET 2006


>>Karl Berry :
>>>Suppose I want to show both the TeX input and its corresponding output
>>>as an example.  Not big files, but just small fragments.  As in:
>>>
>>>  \showme{hello, \relax there}
>>>
>>>and the typeset output could be, say, two lines:
>>>
>>>  hello, \relax there   % in typewriter
>>>  hello, there          % in roman

[I answered:]

>1. Some of you may be pleased by a look at Matt Swift's
>
>     CTAN/macros/latex/contrib/frankenstein/compsci.dvi

I _thought_ this were an answer -- yet, sorry, compsci.sty
just displays input/output by different category codes, so
my idea that it could be used for Karl's dual ... would have
amounted to pretending that
     \showme #1 -> `\verb|#1|' results in `#1'.
would do as desired, ignorant of the very problem.

Doing it _without_ changing category codes is exemplified
in my attachment: load something like \cwd{fbox}\{example\}
into a token register, then read it under different definitions
of \cwd etc., viz. once \cwd{fbox} becomes something like
\texttt{\@backslashchar fbox}, the other time something like
\csname fbox\endcsname.

I am not convinced that this approach of mine is elegant and
simple. Rather, it is (additionally) motivated by that "metacode"
idea sketched on the single page of macmanul.dvi (display
what happens to macro parameters). And at least, it
demonstrates that there is another way of "dual input/output".

Good night,
   Uwe.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MACMANUL.zip
Type: application/zip
Size: 6117 bytes
Desc: not available
Url : http://tug.org/pipermail/texhax/attachments/20060127/da1bc1c2/MACMANUL.zip


More information about the texhax mailing list