Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!news.cs.indiana.edu!ux1.cso.uiuc.edu!csrd.uiuc.edu!s41.csrd.uiuc.edu!eijkhout From: eijkhout@s41.csrd.uiuc.edu (Victor Eijkhout) Newsgroups: comp.text.tex Subject: Re: TeX program that prints itself when typeset Message-ID: <1991May16.001940.24144@csrd.uiuc.edu> Date: 16 May 91 00:19:40 GMT References: <3560@wn1.sci.kun.nl> Sender: news@csrd.uiuc.edu (news) Organization: UIUC Center for Supercomputing Research and Development Lines: 18 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 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.