# In TeX, is math mode somehow different from the others?

I'm learning TeX, and in the output of showlists on a file with a bunch of equations, I don't see math mode at all. I don't see "mathop" or "mathrel" or "overline" or anything, all I see are stuff like "hbox" and "kern" -- the stuff you see in horizontal mode.

I do see the equations I've typeset -- they're just written seemingly as if I had written them in horizontal mode (oodles of kerns and glue and font changes and stuff).

Can someone please help me understand this? Is math mode somehow... artifical, in some sense? Is it just syntactic sugar for what would be very annoying to type in horizontal or vertical mode?

Here is the hbox containing one of my equations: (with \showboxbreadth and \showboxdepth equal to 1000):

\hbox(14.5001+9.50012)x340.38124, shifted 64.68687, display .\hbox(14.26508+8.3595)x95.86403 ..\hbox(14.26508+8.3595)x95.86403 ...\hbox(0.0+0.0)x1.2, shifted -2.5 ...\vbox(14.26508+8.3595)x93.46404 ....\hbox(7.5+2.5)x93.46404 .....\tenrm ( .....\teni n .....\hbox(4.51111+0.0)x4.48613, shifted 1.49998 ......\sevenrm 1 .....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 .....\tenrm + .....\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 .....\teni n 

• Try issuing the \showlists command within math mode, as in $n_1+n \showlists$.
– GuM
Jan 19 '19 at 21:07

When math mode is started, with either $ or $$ (I'm talking at the primitive level), a math list is started. The matching  or $$ will end building the list and start a further processing step: transforming the math list into a horizontal list made by boxes, glue, kerns, penalties (and a few other possible items). This step is completely described in Appendix G of the TeXbook, “Generating boxes from formulas”. If you test \showboxbreadth=\maxdimen \showboxdepth=\maxdimen \tracingonline=1$n_1+n\showlists$\showlists \bye  you get the following diagnostic information: ### math mode entered at line 5 \mathord .\fam1 n _\fam0 1 \mathbin .\fam0 + \mathord .\fam1 n ### horizontal mode entered at line 5 \hbox(0.0+0.0)x20.0 spacefactor 1000 ### vertical mode entered at line 0 prevdepth ignored ! OK. l.5$n_1+n\showlists
$\showlists ? ### horizontal mode entered at line 5 \hbox(0.0+0.0)x20.0 \mathon \teni n \hbox(4.51111+0.0)x4.48613, shifted 1.49998 .\sevenrm 1 \glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 \tenrm + \penalty 700 \glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 \teni n \mathoff spacefactor 1000 ### vertical mode entered at line 0 prevdepth ignored ! OK. l.5$n_1+n\showlists$\showlists  A more complex formula such as \showboxbreadth=\maxdimen \showboxdepth=\maxdimen \tracingonline=1 $$\sqrt{1+\sqrt{5}\over n_{x+y}}\showlists$$\showlists \bye  will produce ### display math mode entered at line 5 \radical"270370 .\fraction, thickness = default .\\mathord .\.\fam0 1 .\\mathbin .\.\fam0 + .\\radical"270370 .\.\fam0 5 ./\mathord ./.\fam1 n ./_\mathord ./_.\fam1 x ./_\mathbin ./_.\fam0 + ./_\mathord ./_.\fam1 y ### vertical mode entered at line 0 ### current page: \glue(\topskip) 10.0 \hbox(0.0+0.0)x469.75499, glue set 449.75499fil .\hbox(0.0+0.0)x20.0 .\penalty 10000 .\glue(\parfillskip) 0.0 plus 1.0fil .\glue(\rightskip) 0.0 total height 10.0 goal height 643.20255 prevdepth 0.0, prevgraf 1 line ! OK. l.5 $$\sqrt{1+\sqrt{5}\over n_{x+y}}\showlists$$\showlists ? ### horizontal mode entered at line 5 spacefactor 1000 ### vertical mode entered at line 0 ### current page: \glue(\topskip) 10.0 \hbox(0.0+0.0)x469.75499, glue set 449.75499fil .\hbox(0.0+0.0)x20.0 .\penalty 10000 .\glue(\parfillskip) 0.0 plus 1.0fil .\glue(\rightskip) 0.0 \penalty 10000 \glue(\abovedisplayshortskip) 0.0 plus 3.0 \glue(\lineskip) 1.0 \hbox(19.39662+11.00365)x42.95554, shifted 213.39973 .\hbox(19.39662+11.00365)x42.95554 ..\hbox(0.39998+29.60031)x10.00002, shifted -18.59666 ...\tenex s ..\vbox(19.39662+9.7206)x32.95552 ...\kern0.39998 ...\rule(0.39998+0.0)x* ...\kern2.75941 ...\hbox(15.83725+9.7206)x32.95552 ....\hbox(0.0+0.0)x1.2, shifted -2.5 ....\vbox(15.83725+9.7206)x30.55553 .....\hbox(9.07217+1.32779)x30.55553 ......\tenrm 1 ......\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 ......\tenrm + ......\glue(\medmuskip) 2.22217 plus 1.11108 minus 2.22217 ......\hbox(9.07217+1.32779)x13.33337 .......\hbox(0.39998+9.6)x8.33336, shifted -8.27222 ........\tensy p .......\vbox(9.07217+0.0)x5.00002 ........\kern0.39998 ........\rule(0.39998+0.0)x* ........\kern1.82777 ........\hbox(6.44444+0.0)x5.00002 .........\tenrm 5 .....\kern2.73729 .....\rule(0.39998+0.0)x* .....\kern4.85397 .....\hbox(4.30554+2.86108)x30.55553, glue set 4.53639fil ......\glue 0.0 plus 1.0fil minus 1.0fil ......\teni n ......\hbox(4.33334+1.3611)x15.4804, shifted 1.49998 .......\seveni x .......\sevenrm + .......\seveni y .......\kern0.25116 ......\glue 0.0 plus 1.0fil minus 1.0fil ....\hbox(0.0+0.0)x1.2, shifted -2.5 \penalty 0 \glue(\belowdisplayshortskip) 7.0 plus 3.0 minus 4.0 total height 48.40027 plus 6.0 minus 4.0 goal height 643.20255 prevdepth 11.00365, prevgraf 4 lines ! OK. <recently read> \showlists l.5 ...sqrt{5}\over n_{x+y}}\showlists$\$\showlists

where you see much more detailed information: the items in the numerator of the fraction are marked .\, those in the denominator ./, for instance. The result of the conversion from the math list to a horizontal list is displayed by the outer \showlist.