How to render an equation in Plain Tex

How to render an equation in Plain Tex

The following TeX code will render the following equation:

Equation for the DFT

Using dvi2png, the resulting document will be a PNG of the results in an image that match the dimensions of the equation itself (rather than the page). Using the "-o" flag in dvipng will write to a specific filename, rather than generate a name automatically.

<<eq.tex>>=
\hsize 0pt
\vsize 0pt
\nopagenumbers
\overfullrule 0pt
\noindent
$$
X(\omega_k) = \sum_{n=0}^{N-1} x(t_n)e^{-j\omega_k t_n}
$$
\bye

Some notes on the flags:

Setting hsize and vsize to be 0pt (nothing) is a hack that will trick TeX into dynamically stretching the page to fit everything.

Using noindent turns off the extra space that can get added to the top of the equation.

nopagenumbers will disable page numbers.

overfullrule is used to disable the black overfull box.