# Commands in TeX which are different in LaTeX

Having used LaTeX (using TeXworks with pdfLaTeX) for around a year now, I decided it would be a useful (/interesting) exercise to learn TeX, since this is the fundamental language underlying LaTeX (and therefore allows for the redefinition of LaTeX macros, the coding of which I believe would have to be done in TeX [correct if wrong]). I am learning from a copy of the TeXBook (an excellent read), which provides many examples etc, encouraging the reader to try things out for themself.

The primary way of compiling TeX which Knuth gives (which is as far as I know is the standard way), is to type the document out in a text editor, which is then handed to the TeX 'engine', which compiles the document. However, since there are many examples and exercises in the book to try, I have taken to simply trying out the commands in the TeXworks editor and then compiling (using pdfLaTeX), as this is the easiest and quickest way to see the result.

So far, I have found no problems with doing this, and to me this made sense, since (in my head), LaTeX is built upon TeX, adding in no new fundamentals, thus any command which does something in TeX, should do the same in LaTeX.

However recently I have been reading more into the exact differences between LaTeX and TeX, and it seems as though the two are more different than I first assumed. For the most part this doesn't bother me, since whilst some TeX commands have been re-designed for LaTeX (eg the \it command, replaced by \textit), the TeX commands themselves still do work, so in theory, I could still type a document out in plain TeX, then compile it with pdfLaTeX, and produce a correct result. However, I saw something troubling here which suggested that there are some TeX commands which assume different meanings which interpreted by LaTeX.

Please could someone give some examples of these commands, and if possible, give any other justification as to why plain TeX should not be used within LaTeX.

Any help is greatly appreciated! :)

Postscript: I am aware that TeXworks also provides the option of compiling with pdfTeX, however this would remove the macros made by LaTeX (such as the \section command), thus making life harder again. My question is more one of principle rather than actually suggesting that I might try and typeset in TeX using LaTeX.

•  to \[  is another famous example of "not really correct output with the plain way". – TeXnician Oct 17 '17 at 14:36
• plain tex and latex are both written in tex but have no tex code in common, so while some commands have the same name and some of the ones that have the same name have the same definition, it is a bad idea to use latex as a tool to learn plain. – David Carlisle Oct 17 '17 at 14:36
• Although it does not answer your question, I think you could find the following question and answers of interest: tex.stackexchange.com/q/49/34551 – Clément Oct 17 '17 at 14:45
• I think this question is answered several times on this site. – percusse Oct 17 '17 at 14:45
• “in theory, I could still type a document out in plain TeX, then compile it with pdfLaTeX, and produce a correct result” — no, neither in theory nor in practice. For example, the following is a valid plain TeX document: Hello world \bye. If I try to compile it with latex, I get errors about Missing \begin{document} and about Undefined control sequence for \bye. – ShreevatsaR Oct 17 '17 at 14:45

plain tex and latex are both written in tex but have no tex code in common, so while some commands have the same name and some of the ones that have the same name have the same definition, it is a bad idea to use latex as a tool to learn plain.

The TeXBook describes two sets of commands (and doesn't always go to great lengths to distinguish them, apart from in the index) primitive commands are built in to tex-the-program, and other commands are defined in the plain tex format.

LaTeX is of course defined in using the same primitives, but most of them should not normally be used directly in a document, and some (notably \end) are masked by latex commands of the same name so the primitive is not accessible under its original name)

But none of the plain tex definition files are loaded into the latex format so none of the commands defined in plain tex are defined.

Parts of latex originally were a copy of a subset of plain tex, but with 30 years separate development there are rather few commands now with the same definition in the two formats.

You mention \it that is defined in plain tex as

> \it=macro:
->\fam \itfam \tenit .
l.2 \show\it


so it directly selects 10pt cm italic

in latex it is

> \it=undefined.
l.2 \show\it


That is, it isn't defined at all.

If you use \documentclass{article} then a command with the name \it is defined but its definition is

> \it=macro:
->\protect \it  .
l.3 \show\it


It has a similar end-user effect of selecting an italic font but its definition couldn't be more different.

You see similar differences in anything to do with page makeup and inserts, so plain Tex has \topinsert to insert a figure in a page, this command is not defined in latex at all.

Similarly in mathematics multi-line displays are set in plain with \eqalign which is not defined in latex.

So in summary while some simple examples may work, using plain tex commands in latex is architecturally wrong and very error prone in practice and not a recommended way to teach yourself plain TeX.

• Thanks this is exactly what I was looking for! Is it correct to say then that if I wanted to redefine/define my own LaTeX macros, that this would have to be done in (primitive) TeX? – aidangallagher4 Oct 17 '17 at 16:59
• @aidangallagher4 not really, but it is true that currently if you look at existing definitions in latex they often use "plain style" definitions, but that is largely an optimisation required on machines of the 1980s. if you look at newer packages you will find that they are written in far more extensive libraries of macros so siunix or fontspec written using expl3 or tikz written using pgf etc. – David Carlisle Oct 17 '17 at 18:23