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?

1 Answer 1

\input eplain

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



The \listing command is defined as

   \par \begingroup
   \input #1
\let\setuplistinghook = \relax
  \let^^L = \relax
     \parskip = 0pt

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

  \def\do##1{\catcode`##1=12 }\dospecials
  \input #1 \endgroup}

It doesn't work with Spanish inverted marks.

  • And it is not possible without eplain, right?
    – Adam L. S.
    Dec 15, 2011 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, 2011 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.