What is the core of TeX as a programming language? [closed]

Tex (and LaTeX) mix programming elements with typesetting ones. It's often confusing to a beginner to tell them apart. Could anyone show me a list of the very core commands of TeX (and perhaps LaTeX) as a programming language?

closed as too broad by jubobs, Mico, Paul Gessler, Kurt, Sean AllredFeb 23 '15 at 15:49

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• See The TeXbook by D.E. Knuth for the former, and LaTeX User Guide a Reference Manual, by L. Lamport for the latter. – Steven B. Segletes Feb 23 '15 at 15:14
• For TeX itself, the usual suggestion would be The TeXbook or TeX by Topic. For LaTeX2e it's well-known that bits of TeX mix with bits of documented programming code and other 'stuff'. Perhaps you could specify a little more more what your focus is? – Joseph Wright Feb 23 '15 at 15:19
• I suppose one may consider the so-called primitive TeX commands -- macros such as `\relax`, `\expandafter`, `\vcenter`, etc -- to be the "core" of TeX as a language. The TeX primitives are listed in the TeXbook as well as in other documents. However, the primitives alone are not suitable for ordinary typesetting needs. Knuth defined a set of macros generally known as the "Plain TeX" format; these are also listed in the TeXbook. Additional primitives are defined in eTeX, XeTeX, and LuaTeX. LaTeX as a format implements many (most?) Plain-TeX macros -- and adds many more. – Mico Feb 23 '15 at 15:32
• To the extent that TeX by Topic organizes commands thematically, I think it is probably the best resource to answer your question. But the distinction isn't always so clearcut. For example, one might categorize the various box commands as typesetting, but would conditionals involving boxes be programming or typesetting. Similar questions will arise in other types of commands too. – Alan Munn Feb 23 '15 at 15:49
• TeX is a programming language for typesetting. There is no distinction between programming elements and typesetting ones, since the purpose of the programming is typesetting. – musarithmia Feb 23 '15 at 17:10