One would define \mathbf as say:

\DeclareMathAlphabet      {\mathbf}{OT1}{cmr12}{bx}{n}

I was wondering, then with that, how \mathbf would be defined? (what is its meaning?).

  • 3
    You should try \def\pshow#1{{\let\protect\show #1}} \pshow\mathbf, as suggested by The definitions of LaTeX commands.
    – Werner
    Jun 25, 2012 at 18:07
  • Sorry to bother you; in this question tex.stackexchange.com/a/71393/3954 I proposed the use of the floatrow package, but then the OP mentioned an incompatibility with your bidi package. Is there a workaround to make the floatrow package cooperate with bidi? Sep 13, 2012 at 15:28
  • Regarding the issue I mentioned in my previous comment, I found a workaround and included it in my answer (link in previous comment). Anyways, if you could take a look, that would be ideal. Sep 14, 2012 at 2:00

2 Answers 2


Rather than looking straight at the code with \meaning, \show, \tracingall or the like it might be interesting to read the main articles on NFSS (the then New Font Selection Scheme). They are a bit aged now (1989 :-) ) so they predate LaTeX2e and even TeX3, but I think they will give you some ideas, especially the first one, on the underlying concepts. Be aware though that these papers describe the initial version of NFSS. For LaTeX2e some interfaces got changed and we further optimized the code for speed and compactness.

NFSS base macros in Tugboat 1989

NFSS user interface in Tugboat 1990

The current code (and its documentation) can be found as part of the LaTeX distribution, look for files called ltfsssomething.dtx and typeset them. They are fairly well documented (give or take) but the documentation mainly concerns the micro level not the big picture.


Run the following through LaTeX

\expandafter\show\csname mathbf \endcsname
\expandafter\show\csname M@OT1\endcsname

You'll get

> \mathbf=macro:
->\protect \mathbf  .

> \mathbf =macro:
->\select@group \mathbf  \M@OT1 \OT1/cmr/bx/n .

> \select@group=macro:
#1#2#3#4->\ifx \math@bgroup \bgroup \else \relax \expandafter \@firstofone \fi 
{\ifmmode \ifnum \csname c@mv@\math@version \endcsname <\sixt@@n \begingroup \e
scapechar \m@ne \getanddefine@fonts {\csname c@mv@\math@version \endcsname }#3\
globaldefs \@ne \math@fonts \endgroup \init@restore@version \xdef #1{\noexpand 
\use@mathgroup \noexpand #2{\number \csname c@mv@\math@version \endcsname }}\gl
obal \advance \csname c@mv@\math@version \endcsname \@ne \else \let #1\relax \@
latex@error {Too many math alphabets used in version \math@version }\@eha \fi \
else \expandafter \non@alpherr \fi #1{#4}}.

> \M@OT1=macro:
->\default@M .

> \default@M=macro:

It's quite frightening, but not too much.

The bulk of course is \select@group, which must check whether the corresponding mathgroup (math family in TeXbook terminology) has already been allocated. Then essentially it opens a group, sets the mathgroup and typesets the argument, unless the command has been given outside of math mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .