在 TeX 中,数学模式与其他模式有何不同?

在 TeX 中,数学模式与其他模式有何不同?

我正在学习 TeX,在一个包含一堆方程式的文件的输出中showlists,我根本看不到数学模式。我没有看到“mathop”或“mathrel”或“overline”或任何东西,我看到的都是“hbox”和“kern”之类的东西——你在水平模式下看到的东西。

我确实看到了我排版的方程式——它们看起来就像是我在水平模式下写的一样(大量的字距和粘合、字体变化等等)。

有人能帮我理解一下吗?数学模式在某种程度上……是人为的吗?它只是语法糖,用于在水平或垂直模式下输入非常烦人的内容吗?

这里是包含我的一个方程式的 hbox:(和\showboxbreadth等于\showboxdepth1000):

\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

答案1

启动数学模式时,使用$$$(我说的是原始层面),数学列表开始。匹配$$$将结束列表的构建并开始进一步的处理步骤:将数学列表转换为由框、粘合、紧排、惩罚(以及一些其他可能的项目)组成的水平列表。

此步骤在 TeXbook 附录 G“从公式生成框”中有完整描述。

如果你测试

\showboxbreadth=\maxdimen
\showboxdepth=\maxdimen
\tracingonline=1

$n_1+n\showlists$\showlists

\bye

您将获得以下诊断信息:

### 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

更复杂的公式,例如

\showboxbreadth=\maxdimen
\showboxdepth=\maxdimen
\tracingonline=1

$$\sqrt{1+\sqrt{5}\over n_{x+y}}\showlists$$\showlists

\bye

将产生

### 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

您可以在其中看到更多详细信息:例如,分数分子中的项目标记为.\,分母中的项目标记为./。从数学列表转换为水平列表的结果由外部 来显示\showlist

相关内容