# Read manuscript in to output

I want to put my source plain TeX file in the output of the same plain TeX file.

As I remember coming through a macro, that can put a file's content in to the output, but only \input comes to mind. What could it be?

Becoming frustrated—and so tired—I decided, to use the \openin, \read, \closein macros, but failed. For the same file, nothing is read. Only for a text file, the very first line is read, but only if the condition is after the body of the loop.

However, while I was writing this question, a suggestion were showed here, which I learned from that I was missing \unless. It is fine, but now everything is interpreted. How can I avoid that?

-

\input eplain

This is my plain \TeX{} file that contains a listing of itself.

\listing{\jobname.tex}

\bye


The \listing command is defined as

\def\listing#1{%
\par \begingroup
\@setuplisting
\setuplistinghook
\input #1
\endgroup
}%
\let\setuplistinghook = \relax
{%
\makeactive\^^L
\let^^L = \relax
\gdef\@setuplisting{%
\uncatcodespecials
\obeywhitespace
\makeactive\
\makeactive\^^I
\makeactive\^^L
\def^^L{\vfill\break}%
\parskip = 0pt
\listingfont
}%
}%


and this depends on many other definitions. If your file doesn't contain strange things, a simpler definition might work:

\def\listing#1{\par\begingroup
\parindent=0pt
\def\do##1{\catcode##1=12 }\dospecials
\def\par{\endgraf\leavevmode}%
\obeyspaces\obeylines\tt
\input #1 \endgroup}


It doesn't work with Spanish inverted marks.

-
And it is not possible without eplain, right? –  Adam L. S. Dec 15 '11 at 12:54
eplain.tex makes available the command. I'll try to look if it's practical to extract the definition. –  egreg Dec 15 '11 at 17:34