# How to get started with plain TeX

I am using TeX Live 2010 on Windows 7. I have no experience to compile a plain TeX input file.

1. Is my input file below correct?

% gettingstarted.tex
\input pstricks
\topmargin=-72.27pt
\oddsidemargin=-72.27pt
\paperwidth=72.27pt
\paperheight=72.27pt
\parindent=0pt
\special{papersize=\the\paperwidth,\the\paperheight}

\pspicture(\paperwidth,\paperheight)
\psframe(\paperwidth,\paperheight)
\endpspicture

\bye

2. What is the plain TeX compiler I must execute to get DVI output? And what is the syntax?

I have tried using tex gettingstarted.tex and I got the following errors:

-
I strongly suggest you start simple with plain TeX, reading The TeXbook and working up from basic examples. –  Joseph Wright Jul 18 '11 at 7:38

You can use pdftex, if you want to profit from e-TeX extensions; on TeX Live it's available for DVI output as etex or, from the command line,

pdftex --output-format=dvi


Plain TeX has not many page format parameters: the upper left corner of the type block is 1in from the left edge and 1in from the upper edge of the paper.

In order to shift the text block it's necessary to either modify the output routine or to set \hoffset and \voffset. So

\hoffset=-72.27truept
\voffset=-72.27truept
\special{papersize=72.27pt,72.27pt}
\hsize=72.27truept
\vsize=72.27truept

\parindent=0pt
\nopagenumbers

\input pstricks

\pspicture(72.27pt,72.27pt)
\psframe(72.27pt,72.27pt)
\endpspicture

\bye


Without \nopagenumbers you'd have the number "printed" outside the page area.

A modified output routine that makes unnecessary to act on \hoffset and \voffset is

\catcode@=11
\def\xportoutput#1#2{%
\shipout\vbox{\vglue#1\relax
\ifnum\outputpenalty>-\@MM \else\dosupereject\fi}
\catcode@=12
\output{\xportoutput{-72.27truept}{-72.27truept}}


One can change the two parameters to \xportoutput, for example to adapt the position of the text block to A4 paper. The arguments are respectively the horizontal and the vertical displacements with respect to the default reference point. It's better to use truept in order not to apply the \mag factor.

-
That option is passed to xcolor. There's no xcolor for Plain. –  egreg Jul 18 '11 at 12:16
It loads xcolor in LaTeX. –  egreg Jul 18 '11 at 13:15

Your input file is not right, as the various dimensions you've tried to use are not defined by the plain TeX format.

On the tool itself, it's just tex:

tex <filename>

-
% gettingstarted.tex
\input pstricks
\parindent=0pt
\special{papersize=72.27pt,72.27pt}

\pspicture(72.27pt,72.27pt)
\psframe(72.27pt,72.27pt)
\endpspicture

\bye

-
\leftskip=-in and vor the vertical space I forgot it –  Herbert Jul 18 '11 at 9:14
xcolor is a LaTeX package! –  Herbert Jul 18 '11 at 13:35

You could \input eplain* to have those commands available, with the exception of \oddsidemargin for which you could use (for the purposes of this particular question) the command \leftmargin.

*eplain

-