sommel@sci.kun.nl (Ron Sommeling) (05/15/91)
Below is a small plain TeX program that will print itself (in typewriter font without pagenumber) when typeset. Are there shorter solutions? \output{}\def\do#1{\catcode`#112}\def\t{\dospecials\obeylines\tt~} \def~#1^^:{#1#1^^:\end}\t \output{}\def\do#1{\catcode`#112}\def\t{\dospecials\obeylines\tt~} \def~#1^^:{#1#1^^:\end}\tz Ron Sommeling <sommel@sci.kun.nl>
eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) (05/16/91)
sommel@sci.kun.nl (Ron Sommeling) writes: >Below is a small plain TeX program that will print itself (in typewriter >font without pagenumber) when typeset. Are there shorter solutions? >\output{}\def\do#1{\catcode`#112}\def\t{\dospecials\obeylines\tt~} >\def~#1^^:{#1#1^^:\end}\t >\output{}\def\do#1{\catcode`#112}\def\t{\dospecials\obeylines\tt~} >\def~#1^^:{#1#1^^:\end}\tz >Ron Sommeling <sommel@sci.kun.nl> Very cute, Ron. Here's a one-liner (albeit a rather long line :-) that doesn't print itself, but it \message's itself. \def \a #1{\let \#\relax \let \a \relax \message {#1\catcode `\#=12 \a {#1}}}\catcode `\#=12 \a {\def \a #1{\let \#\relax \let \a \relax \message {#1\catcode `\#=12 \a {#1}}}} Victor.
jeffrey@cs.chalmers.se (Alan Jeffrey) (05/16/91)
In article <3560@wn1.sci.kun.nl> sommel@sci.kun.nl (Ron Sommeling) writes: >Below is a small plain TeX program that will print itself (in typewriter >font without pagenumber) when typeset. Are there shorter solutions? Well, this is actually 6 characters longer, but it's a bit `nicer', since it doesn't rely on the fact that ^^: is z. Otherwise it's the same mechanism... \output{}\def\do#1{\catcode`#112} \def~#1{\def~##1#1{##1#1##1#1\end}\dospecials\obeylines\tt~}~! \output{}\def\do#1{\catcode`#112} \def~#1{\def~##1#1{##1#1##1#1\end}\dospecials\obeylines\tt~}~! Alan. Alan Jeffrey Tel: +46 31 72 10 98 jeffrey@cs.chalmers.se Department of Computer Sciences, Chalmers University, Gothenburg, Sweden