跳到主要内容

Display_style_in_math_mode

这篇文章解释了如何手动调整数学排版的风格--但我们首先要快速提醒一下内联式和 显示式数学之间的明显区别。

包含在段落文本内的排版数学需要比在段落文本外作为独立的、显示风格的材料排版的相同数学占用更少的空间。为了在实践中看到这一点, 让我们解释一下,方程f(x)=∑ni=0ai1+x可能发散或收敛,取决于x的值。

偶尔你可能想改变用于排版一块数学的默认样式。例如,你可能想改变内联数学,如f(x)=11+x,并将其包含在段落中,但以显示样式排版:f(x)=11+x,尽管它对行距有很大影响。

TeX引擎提供了几个命令,可以用来覆盖数学作品的默认排版样式。

\textstyle:应用于段落中数学排版的风格

\displaystyle:应用于数学本身的排版风格。

\脚本风格:应用于下标或上标的风格

\脚本风格(scriptscriptstyle):应用于二阶下标或上标的风格

\[
a_0+{1\over a_1+
{1\over a_2+
{1 \over a_3 +
{1 \over a_4}}}}
\]

默认的排版风格可以通过使用 \displaystyle 命令来修改:

\[
a_0+{1\over\displaystyle a_1+
{1\over\displaystyle a_2+
{1 \over\displaystyle a_3 +
{1 \over\displaystyle a_4}}}}
\]

下面是另一个例子,展示了\textstyle、\scriptstyle和\scriptscriptstyle的效果。

\[
\begin{eqnarray*}
f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\textstyle f(x) = \textstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptstyle f(x) = \scriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptscriptstyle f(x) = \scriptscriptstyle \sum_{i=0}^{n} \frac{a_i}{1+x}
\end{eqnarray*}
\]

这里有一个例子,你可以在Overleaf中打开:

\documentclass{article}
\usepackage{amsmath}
\title{Exploring math display styles}
\author{Overleaf team}
\begin{document}
\maketitle
Depending on the value of \(x\) the equation \( f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \) may diverge or converge.

\[ f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \]

\vspace{1cm}

Inline maths elements can be set with a different style: \(f(x) = \displaystyle \frac{1}{1+x}\). The same is true for display math material:

\begin{eqnarray*}
f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\textstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x} \\
\scriptscriptstyle f(x) = \sum_{i=0}^{n} \frac{a_i}{1+x}
\end{eqnarray*}
\end{document}