# Creating a Plain TeX document that's formatted like a LaTeX “report”

Hey I want a report format, how can I spcecify in Plain TeX that it is a report, like in LaTeX we have

\documentclass{report}


How can this be done for a Plain TeX document? And, how do I add images in a Plain TeX document?

• Graphics for pdftex it is \pdfximage and some arguments to it, but for TeX producing .dvi I have never done such things (I am not that old :-P)) There is no \documentclass stuff in plainTeX – user31729 Jan 4 '15 at 9:16
• @ChristianHupfer Well images in plain depend on the engine/driver so it's a bit more complicated than that ;-) We do have a question about it, though. – Joseph Wright Jan 4 '15 at 9:19
• @JosephWright: Yes I know that it depends on the engine, but I've never used plain TeX in conjunction with graphics. Thanks for updating with a link – user31729 Jan 4 '15 at 9:20
• @mistha You've asked three questions in quick succession on 'plain TeX basics'. Can I suggest you start by reading The TeXbook, 'required reading' I'd say for any plain user (even if you also read other guides on plain). – Joseph Wright Jan 4 '15 at 9:20
• Yes, I have started with the book, but I am not getting the answers that I want, that is why I am asking here:) – Mistha Jan 4 '15 at 9:23

It depends on the fact what do you mean to do by "report" document class. For example, if you need only write:

\documentclass{report}
\begin{document}
Hello world.
\end{document}


then the same could be done in plain TeX by:

Hello world.\bye


But if you need something more special (from LaTeX features) then you need to program this by your own macros.

But there is another alternative. You can use OPmac macro package for example. This macro package provides similar features like LaTeX for plain TeX users (references, hyperlinks, colors, graphics, font managing, ams-math, TOC plus index auto-generating, bib. references, etc.). The advantage is that the macros from OPmac are much more simple than LaTeX equivalents, so you can start with inspiration for your own macros here. Second advantage is that the markup language for authors are more simple without many \begin{foo}...\end{foo}, without many curly braces etc. The markup doesn't hide the problematic of core TeX, but it cooperates with it.

I know many people, they tried plain TeX + OPmac and they found that it is more comfortable and more simple than using LaTeX. For example, all OPmac features are documented at only 16 pages (for users) and there is detail technical documentation of all macros.

• rather a pity opmac’s not been submitted to ctan, since that means it can’t be in tex live (and fwiw, in the uk tex faq — but i’ve not worked on that for a looong time since (a) most people prefer tex/sx to it, and (b) in the light of (a), i can’t achieve the necessary activation potential.) – wasteofspace Jan 4 '15 at 10:49
• @wasteofspace OPmac is a part of csplain package and csplain has been submitted to CTAN. So, it is included in TeXlive and MikTeX, for example. – wipet Jan 4 '15 at 10:56

Fundamentally, the difference between different kinds of document can be reduced to:

• Variations in what is sensible as input (particularly any logical mark up in use)
• Variations in appearance (layout)

Plain TeX provides a very small set of 'core' macros to produce documents, but they are not targeting any particular document type. As such, the expectation is that either you define any more 'focused' macros and design decisions at the start of the file or that you write a secondary file containing the same information and \input it at the start of your document. Knuth shows these ideas in The TeXbook and of course in the source for The TeXbook itself (which uses a file called manmac.tex containing macros to support producing the book).

LaTeX formalises the idea of a 'set of macros' by requiring a document class for each document produced. The idea here is that most users most of the time should be focussing on their content. However, there's nothing that a LaTeX document class can do that a set of macros simply read into plain TeX cannot do.

Worth noting in terms of the comparison with the LaTeX report class is that LaTeX's core classes don't do a lot. They provide some basic logical commands (sectioning and so forth) and make some basic design decisions, but they are not particularly focussed on specific cases. As such, a set of 'utility' plain macros will offer similar abilities.

• Graphics inclusion in plain is covered in another question, as I've noted, so I've not included it here. – Joseph Wright Jan 4 '15 at 9:53