[texhax] dual-use input/output macro

Uwe Lück uwe.lueck at web.de
Mon Mar 27 22:50:49 CEST 2006

A package addressing Karl's question has appeared on CTAN:

>>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 cannot think of any easy way to do this.  About all I can imagine is
>>>changing all the catcodes to other before reading the argument, printing
>>>the arg in tt, then writing the arg to an external file, and
>>>reading it back with normal catcodes to get the normal output.
>>>Is there a simpler way?  Has anyone programmed the above?  I imagine
>>>e-tex's \scantokens and \readfile (or something else?) might be useful,
>>>but didn't see a quick application.
>>>I browsed through the fancyvrb, verbatim, etc., doc but nothing jumped
>>>out at me.
>At 21:54 17.11.05, Lars Madsen wrote:
>>There is of course the way lshort does it, i.e. write the argument to an 
>>external file, do a verbatim input and a normal input. I use the same 
>>thing for internal examples i my LaTeX book.
>>But there should be a rather exotic package by Peter Sabo (if it's 
>>spelled like that), I've forgotten the name, but he gave a talk about it 
>>at EuroTeX 2005.

At 02:14 24.01.06, Uwe Lück wrote:

>2. I'd like to endorse the authors of lshort and the LaTeX
>Companion to publish the macros they've used for their
>examples in separate .sty files (or are they non-free?).

At 23:49 24.01.06, Karl Berry wrote:
>     homemade package, which though a package, basically cannot be used with
>     other classes than memoir or other layouts than the one that I'm using.
>Sure.  But by publishing it, you give the opportunity for others to be
>able to see it, use it, modify it without further ado.  You don't have
>to do anything with it -- as you say, it is hard to come up with the
>time and energy, we all have so many things to do.
>There is a common misperception that "publishing" something freely means
>committing to support/enhancements/documentation/etc. in perpetuity.  It
>doesn't.  My approach is, just put it out there.  You never know when
>someone interested will come along and find it useful, whereas if they
>have to take the step of mailing you about it, they probably won't --
>don't want to impose, too much trouble, etc.
>BTW, as far as lshort goes (or anything in teTeX and TeX Live), all the
>macros should be available.  I thought they were, but I guess I never
>actually tried reprocessing it.

At 16:20 27.03.06, CTAN Announcements wrote:
>On Sun, 26 Mar 2006, Rolf Niepraschk submitted the new package
>   showexpl
>to CTAN.
>This package provides a way to typeset LaTeX source code and the related
>result in the same document.
>Location on CTAN: /macros/latex/contrib/showexpl
>Summary description: Typesetting LaTeX source code
>License type: lppl


   The LaTeX package `showexpl' provides a way to typeset LaTeX source
   code and the related result in the same document. The `listings'
   package is required. See `doc/showexpl-test.tex' for the details.

Unfortunately, there is no other explanation of the user commands yet.
(Somewhat contrary to what Lars wrote, showexpl.dtx only documents
the implementation.) I couldn't even _find_ the usercommands so far.
Those who are better equipped than I may find them after running
showexpl.dtx (I don't have a package manager at home), usage may
then be easy to recognize.

Best regards,

P.S. to Rolf Niepraschk:

(i) In showexpl.dtx, there's the typo

(ii) The CTAN managers endorse placing the .pdf result
of a .dtx on CTAN -- I would have been happy about that.

More information about the texhax mailing list