Does there exist some concise documentation showing, for things commonly done in plain TeX, the recommended/idiomatic “LaTeX way” of doing something equivalent? Or if not, what are the most common such things to know?
Background/context: Recently, while answering a question about an unusual page layout, I first wrote an answer in plain TeX, then started trying to make it work with LaTeX. In doing this, I discovered a few things, like:
- In LaTeX (and with typical document classes I guess), to change the dimensions of the main text area, don't directly change
\hsize
and\vsize
. Instead, it is simplest to change\textwidth
and\textheight
. - To control the page output, don't redefine what
\output
does with\box255
, but what\@outputpage
does with\box\@outputbox
. - To affect the offset of the main text area on the page, change not just
\hoffset
and\voffset
, but also\oddsidemargin
,\evensidemargin
,\topmargin
,\headheight
, and\headsep
. - The page numbering counter is stored not in a TeX count register called
\pageno
but in a LaTeX counter calledpage
.
These are just examples (and some may be wrong); I'm asking about the general case where someone has written some (relatively straightforward) plain TeX document (understanding what it does), and wants to change it to work with LaTeX. What would be some useful things to know, in this case?
I'm aware that this may not be a question with a perfect answer, so I'd be perfectly happy with any of the following kinds of answers:
There is such a document, at [location]. Or: there are only a few main things to know, namely [list].
There is no such document: you simply have to learn the whole of LaTeX by reading [Book1], [Book2], and/or by reading through the LaTeX sources (
texdoc source2e
).There are a few kinds of things, and each of them is covered in a different kind of documentation: [X] for topic [T1], [Y] for topic [T2], …
If you're using simple plain TeX, the main thing to know is the LaTeX equivalents of facilities provided by the ~1000-line
plain.tex
. A translation of those into LaTeX is: […].
Edit: It has been pointed out to me that in a LaTeX document one should simply not do any of the above things. And I completely agree!
I should have made this clear earlier, but I was not thinking clearly myself:
In a LaTeX document, as a “user” of LaTeX, one should not resort to such “raw” typesetting. (So the answer to the above question, if it's being asked as a LaTeX user, is “just don't do that”.) Instead, one expresses one's intentions as some combination of invocations of package-provided commands.
In a LaTeX package or class, as the author of the package/class, is the only place to fiddle with typesetting. My question is about this part: where can you learn the LaTeX equivalents of such plain TeX commands, to accomplish common typesetting solutions in LaTeX? (I do understand that you should then also provide good commands so that users of your package can express themselves logically/semantically.)
For example, from plain-TeX version in revision 1 of the linked answer, to get something that compiles in LaTeX (let's say I wanted to make it a package), I cobbled together something through a combination of reading source2e.pdf
, reading other packages' implementations (poorly commented) of similar solutions, randomly searching the internet and this site, using \show
and \message
to debug what's going on, and sometimes pure guesswork. My question is: if you want to write a package to accomplish certain kind of typesetting, where would one learn this instead?