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
\hsizeand\vsize. Instead, it is simplest to change\textwidthand\textheight. - To control the page output, don't redefine what
\outputdoes with\box255, but what\@outputpagedoes with\box\@outputbox. - To affect the offset of the main text area on the page, change not just
\hoffsetand\voffset, but also\oddsidemargin,\evensidemargin,\topmargin,\headheight, and\headsep. - The page numbering counter is stored not in a TeX count register called
\pagenobut 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?
plainwhich defines plain tex constructs (\pagenoetc) for latex) – David Carlisle May 11 '17 at 07:07plainpackage akaplain-ltxseems relevant…) – ShreevatsaR May 11 '17 at 07:13plain, a format for authors to write documents in, and (2) as a program (often confusingly called "plain TeX" to distinguish from LaTeX), a tool for typesetting. (Even kinds of documents not considered before.) My question is about the latter: “using LaTeX as a tool for typesetting”: where does one learn LaTeX ways to accomplish near-arbitrary (within the limits of TeX) typesetting tasks using LaTeX as a tool (apart from "just find and use existing packages"). – ShreevatsaR May 11 '17 at 09:14\overwith\frac" -- for a different view, take a look at the posting What is the difference between \over and \frac? :-) – Mico May 14 '17 at 07:10source2emay be assumed to document the API for LaTeX2e, right? – jarnosc May 16 '17 at 22:47texdoc source2ein the question)… I was hoping someone would confirm it though :-) But I think the answer is more subtle than that. I should post an answer with what I understand, and see if anyone downvotes it. – ShreevatsaR May 16 '17 at 23:05