内联方程式与句子一起出现,
可以注意到,包含变量 E 的特定句子的行距已局部增加。如何自动缩小方程式以使其完美地内联显示而不改变行距?
答案1
在内联数学方程中使用 \displaystyle
或可能会产生这种不良副作用。最好只使用。使用手动缩放的分隔符而不是自动缩放也是更好的选择。\dfrac
\frac
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{mathtools} % loads »amsmath«
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\begin{document}
[\ldots] where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=\bigl(e+\frac{\norm{\vec{u}}_2^2}{2}\bigr)$ is the total specific energy per unit mass and $e$ is the specific internal energy. [\ldots]
\end{document}
另外,你也可以写$E=\bigl(e+\frac{1}{2}\norm{\vec{u}}_2^2}\bigr)$
。
答案2
在内联数学模式下编写方程式时,请勿使用\dfrac
(“显示样式分数”)。请使用\frac
,例如 ,\frac{1}{2}
或使用“斜除法符号”,即$(1/2)$
。
以下是您提供的段落的三种可能的解决方案。第一种解决方案使用\frac{1}{2}
。请注意,我会不是对于内联数学表达式,将平方范数项放在分数表达式的分子上,因为这样做几乎肯定会使段落中文本行的单倍行距无法保留。第二种解决方案使用(1/2)
,第三种解决方案通过将平方范数项除以来节省一些符号2
,内联数学样式。
选择最适合您风格的解决方案。
\documentclass{article}
\usepackage{mathtools} % for \DeclarePairedDelimiter macro
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\begin{document}
\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=(e+\frac{1}{2}\norm{\vec{u}}_2^2)$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots
\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=(e+(1/2)\norm{\vec{u}}_2^2)$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots
\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=(e+\norm{\vec{u}}_2^2/2)$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots
\end{document}
答案3
如果您发现文本分数太小,该nccmath
包定义了“中等数学”命令和环境(大约占 displaystyle 的 80%)。这些通常不会增加行间距。在最坏的情况下,您可能需要借助该setspace
包将 \baselinestretch 增加几个百分点(针对整个文档)。以下代码将让您比较\tfrac
和\mfrac
:
\documentclass[12pt]{article}
\usepackage{mathtools} %
\usepackage{nccmath}
\usepackage{setspace}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}
\usepackage{nccmath}
\usepackage{setspace}
\setstretch{1.1}
\begin{document}
\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=e+\mfrac{\norm{\vec{u}}_2^2 }{2}$ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots
\noindent
where $\rho$ is the fluid density, $\vec{u}$ is the velocity, $E=e+\frac{\norm{\vec{u}}_2^2 }{2} $ is the total specific energy per unit mass, and $e$ is the specific internal energy. The objective is to calculate the primitive variables \dots
\end{document}