# Plain TeX and TeX4ht

If you try to generate `html` version of your plain TeX document using a combination of pdfTeX and TeX4ht, you will find terrible mismatches and `html` version will not be generated. The reason for the problem is TeX4ht needs a `dvi` output from which it extracts the html while pdfTeX generates a `pdf` by default. Therefore, TeX4ht post-processor will cry that there is no `jobname.dvi`. However,

``` ht 'pdftex -output-format=dvi' bk7.tex
```

will work. But the `html` file will have only the ASCII characters of your document and will not be valid `html`. To make a valid `html` from a plain TeX file, you have to do the following trick.

You need to wrap up your TeX source file with following code:

``` \input amstex
\documentstyle{amsppt}
\csname tex4ht\endcsname
\document

. . . source of your plain TeX document . . .

\enddocument```

The following command might be handy to generate `file.html` assuming your input file name is `file.tex`:

``` httex file "xhtml,html4.4ht,unicode.4ht,mathml.4ht"
```

Plain TeX users might miss this trick when they happen to use TeX4ht which is supposed to work out of box in the case of LaTeX documents.