7

LaTeX defines \vec as

\DeclareMathAccent{\vec}{\mathord}{letters}{"7E}

which eventually is expanded to

\mathaccent"017E\relax

whereas plainTeX defines it as

\def\vec{\mathaccent"017E }

replacing \relax with a space.

Is there any practical difference?

  • Most of the time a space will work, but \relax will always work. – John Kormylo Feb 19 at 3:58
6

The syntax for \mathaccent is (TeXbook, p. 291)

\mathaccent⟨15-bit number⟩⟨math field⟩

A ⟨15-bit number⟩ is an integer (in any denotation allowed by LaTeX) in the range 0–215. What's a ⟨math field⟩? We find it on page 289

⟨math field⟩ → ⟨filler⟩⟨math symbol⟩ | ⟨filler⟩{⟨math mode material⟩}

A ⟨filler⟩ is any sequence of space tokens and \relax tokens which are ignored (doing expansion) when processing the input stream looking for something that fits the syntax rule.

Thus in LaTeX the \relax will be gobbled as a ⟨filler⟩, whereas in plain TeX the space terminates the specification for the number and is ignored as well.

Why does LaTeX use \relax? The answer is in the definition of \DeclareMathAccent that internally uses \set@mathaccent:

% latex.ltx, line 3596:
\def\set@mathaccent#1#2#3#4{%
  \xdef#2{\mathaccent"\mathchar@type#3\hexnumber@#1#4\relax}}

The choice might depend on the fact that when writing to an auxiliary file \relax is better suited to the job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.