如何在数学模式中减少间距

如何在数学模式中减少间距

LaTeX 命令如下:

Here again, four different simulations are run on networks of size 
$C^{G} = 25 \times\ 25 = 625$, $C^{G} = 50 \times\ 50 = 2500$, $C^{G}
= 250 \times\ 250 = 62500$, and $C^{G} = 500 \times\ 500 = 250000$...

编译时生成以下内容:

数学模式中的间距

数学模式中的间距确实让我很恼火。等号周围的空白太多,乘号的右侧填充比左侧填充多。有什么方法可以减少这个间距吗?

答案1

数学模式中运算符和关系周围的间距由特定跳跃长度控制:(\thinmuskip默认为3mu),\medmuskip(默认为4mu plus 2mu minus 4mu)和\thickmuskip(默认为)。所有这些都以ath nits5mu plus 5mu给出。mu

0mu下面是对这些长度进行修改(将它们设置为 )如何影响输出的说明(我删除了 后的强制空格\times):

数学模式下的间距

\documentclass{article}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}

\verb|Normal:| \par
Here again, four different simulations are run on networks of size 
$C^{G} = 25 \times 25 = 625$, $C^{G} = 50 \times 50 = 2500$, 
$C^{G} = 250 \times 250 = 62500$, and $C^{G} = 500 \times 500 = 250000$. Next,
for each network, the weights of the idiothetic connections are collected and
plotted based on radial distance, finally, they are averaged out over all
neurons and shifted and set about the centre of the graph.

\bigskip

\begingroup
\verb|\thinmuskip=0mu:| \par
\setlength{\thinmuskip}{0mu}
Here again, four different simulations are run on networks of size 
$C^{G} = 25 \times 25 = 625$, $C^{G} = 50 \times 50 = 2500$, 
$C^{G} = 250 \times 250 = 62500$, and $C^{G} = 500 \times 500 = 250000$. Next,
for each network, the weights of the idiothetic connections are collected and
plotted based on radial distance, finally, they are averaged out over all
neurons and shifted and set about the centre of the graph.
\endgroup

\bigskip

\begingroup
\verb|\medmuskip=0mu:| \par
\setlength{\medmuskip}{0mu}
Here again, four different simulations are run on networks of size 
$C^{G} = 25 \times 25 = 625$, $C^{G} = 50 \times 50 = 2500$, 
$C^{G} = 250 \times 250 = 62500$, and $C^{G} = 500 \times 500 = 250000$. Next,
for each network, the weights of the idiothetic connections are collected and
plotted based on radial distance, finally, they are averaged out over all
neurons and shifted and set about the centre of the graph.
\endgroup

\bigskip

\begingroup
\verb|\thickmuskip=0mu:| \par
\setlength{\thickmuskip}{0mu}
Here again, four different simulations are run on networks of size 
$C^{G} = 25 \times 25 = 625$, $C^{G} = 50 \times 50 = 2500$, 
$C^{G} = 250 \times 250 = 62500$, and $C^{G} = 500 \times 500 = 250000$. Next,
for each network, the weights of the idiothetic connections are collected and
plotted based on radial distance, finally, they are averaged out over all
neurons and shifted and set about the centre of the graph.
\endgroup

\end{document}

分组 ( \begingroup... \endgroup) 可局部化长度修改的效果。\medmuskip用于二元运算符(如\times)周围,\thickmuskip用于二元关系(如=)。 最好坚持使用标准 LaTeX 间距,而不是插入自己的间距。

关于这方面的一个很好的阅读材料来源是Herbert Voss 的数学模式文档. 特别是,第11 空间(第 28 页起)。


\medmuskip内联数学是常规文本构造的一部分。这就是为什么和中有一些拉伸\thickmuskip,这允许数学运算符/操作数周围的间距根据它们在段落文本中的位置而变化。删除此粘连允许更一致地设置内联表达式。请参阅保持数学符号之间的距离一致?

但是,它也可能对换行产生一些问题,如下所示:

在此处输入图片描述

\documentclass{article}
\setlength{\parindent}{0pt}% Just for this example
\begin{document}

\verb|Normal:| \par
Here again, four different simulations are run on networks of size 
$C^{G} = 25 \times 25 = 625$, $C^{G} = 50 \times 50 = 2500$, 
$C^{G} = 250 \times 250 = 62500$, and $C^{G} = 500 \times 500 = 250000$. Next,
for each network, the weights of the idiothetic connections are collected and
plotted based on radial distance, finally, they are averaged out over all
neurons and shifted and set about the centre of the graph.

\bigskip

\begingroup
\verb|Math glue removed:| \par
\setlength{\medmuskip}{1\medmuskip}
\setlength{\thickmuskip}{1\thickmuskip}
Here again, four different simulations are run on networks of size 
$C^{G} = 25 \times 25 = 625$, $C^{G} = 50 \times 50 = 2500$, 
$C^{G} = 250 \times 250 = 62500$, and $C^{G} = 500 \times 500 = 250000$. Next,
for each network, the weights of the idiothetic connections are collected and
plotted based on radial distance, finally, they are averaged out over all
neurons and shifted and set about the centre of the graph.
\endgroup

\end{document}

答案2

为什么在命令后添加额外的空格\times。它完全破坏了间距。看起来很糟糕。我建议你写$a \times b$,而不是$a \times\ b$。这样看起来会好得多。请注意,它也部分回答了你的问题,因为你得到的间距更少了。

答案3

消除等号(或类似的运算符,例如 + 或 - )周围空格的一个简单解决方案是将其括在花括号 {} 中。

例如,写

$a{=}b$
$z{=}b{-}\frac{1}{(c{+}d)}$

代替

$a=b$
$z=b-\frac{1}{(c+d)}$.

致谢:感谢用户 @prettygully 于 2012 年 1 月 22 日 21:40 在评论中提到了这一点。

相关内容