4

I started learning LaTeX and these words appear a lot in both questions and answers. Do they all mean the same thing or are they different concepts?

user202729
  • 7,143
ains94997
  • 41
  • 1

1 Answers1

6

A "primitive" is a command defined by the tex system. So for example \hbox if you ask tex how this is defined

\show\hbox

You get

> \hbox=\hbox.
l.1 \show\hbox

?

Note that the csname \hbox can be given a non-primitve definition. After \def\hbox{abc} the above would produce

> \hbox=macro:
->abc.
l.2 \show\hbox

?

Similarly the primitive functionality can be assigned to other names. After \let\qqqq\hbox then \show\qqqq would produce

> \qqqq=\hbox.
l.2 \show\qqqq

?


A register is a specific storage location, these are addressed by number, originally 256 of each type but etex extends this to 2^15 (over 32 thousand) and luatex extends this again. So integer values can be stored in \count50, lengths (dimen(sions)) can be stored in \dimen222 etc. Usually a format such a latex provides allocation routines so that you do not deal with numbers directly eg \newdimen\textwidth makes \textwidth access a dimen register and the following \newdimen would access the next. \show\textwidth produces (in latex)

> \textwidth=\dimen116.
l.1 \show\textwidth

?


A macro is a command defined by \def which expands to it' replacement text. It is defined by TeX code not part of the tex program source. After \def\cmd{abc} \show\cmd produces

> \cmd=macro:
->abc.
l.2 \show\cmd

?

David Carlisle
  • 757,742