\begin{equation}
\begin{aligned}
\label{mat:mom}
\rho g\textsubscript{x} &- \frac{\partial p}{\partial x} + \mu(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}) &=\quad \rho\frac{\partial u}{\partial t} \\
\underbrace{\rho g\textsubscript{z}}_{Body forces per unit volume} &- \underbrace{\frac{\partial p}{\partial z}}_{Pressure forces per unit volume} + \underbrace{\mu(\frac{\partial^2 w}{\partial x^2} + \frac{\partial^2 w}{\partial y^2} + \frac{\partial^2 w}{\partial z^2})}_{Viscous forces per unit volume} &= \underbrace{\quad \rho\frac{\partial w}{\partial t}}_{Inertial forces per unit volume}
\end{aligned}
\end{equation}
下括号中的文本太长,导致方程式错位。如何将下括号中的文本分成两行。我试过用,\\
但似乎没有帮助。
答案1
我首先要避免重复“单位体积的力”。像这样的图表需要一点手动工作才能获得正确的对齐。
\documentclass{article}
\usepackage{amsmath,array}
\newcommand{\textunderbrace}[2]{{%
\underbrace{#1}_{\text{#2}}
}}
\begin{document}
\begin{equation}\label{mat:mom}
\setlength{\arraycolsep}{0pt}
\newcolumntype{e}{>{\displaystyle}c}
\newcolumntype{o}{>{{}}c<{{}}}
\newcommand{\vs}{\vphantom{\biggl(\frac{\partial^2 w}{\partial x^2}}}
\textunderbrace{
\renewcommand{\arraystretch}{2.5}
\begin{array}{ e o e o e o e }
\rho g_{x}
&-& \frac{\partial p}{\partial x}
&+& \mu\biggl(\frac{\partial^2 u}{\partial x^2}
+ \frac{\partial^2 u}{\partial y^2}
+ \frac{\partial^2 u}{\partial z^2}\biggr)
&=& \rho\frac{\partial u}{\partial t} \\
\textunderbrace{\rho g_{z}\vs}{Body}
&-& \textunderbrace{\frac{\partial p}{\partial z}\vs}{\makebox[0pt]{Pressure}}
&+& \textunderbrace{\mu\biggl(\frac{\partial^2 w}{\partial x^2}
+ \frac{\partial^2 w}{\partial y^2}
+ \frac{\partial^2 w}{\partial z^2}\biggr)}{Viscous}
&=& \textunderbrace{\rho\frac{\partial w}{\partial t}\vs}{\makebox[0pt]{Inertial}}
\end{array}
}{forces per unit volume}
\end{equation}
\end{document}
答案2
stackengine
我加载了一个带有 的变体,esdiff
用于更简单地输入偏导数:
\documentclass{article}
\usepackage[a4paper]{geometry}
\usepackage[usestackEOL]{stackengine}
\usepackage{mathtools}
\usepackage{esdiff}
\newcommand{\textub}[1]{\scriptsize\Shortunderstack{#1}}
\begin{document}
\begin{equation}
\begin{alignedat}{3}
\label{mat:mom}
\rho g\textsubscript{x} &- \diffp{p}{x} & & + \mu\biggl(\diffp[2]{u}{x} + \diffp[2]{u}{y} + \diffp[2]{u}{z}\biggr) & & =\rho\diffp{u}{t} \\
\underbrace{\rho g\textsubscript{z}}_{\textub{Body\\ forces}} &- \underbrace{\diffp{p}{z}}_{\clap{\textub{Pressure\\ forces}}} & & + \underbrace{\mu\biggl(\diffp[2]{w}{x} + \diffp[2]{w}{y} + \diffp[2]{w}{z}\biggr)}_{\textub{Viscous forces}} & &= \underbrace{\rho\diffp{w}{t}}_{\clap{\textub{Inertial forces}}}\\
& & & \rlap{\scriptsize per unit volume}
\end{alignedat}
\end{equation}
\end{document}
答案3
您应该使用\text
来表示下括号下面的文本,将其与一些\raisebox
和\mathllap
和\mathrlap
(由 提供mathtools
)相结合,您可以得到类似以下的内容。但这看起来不太好...
另一种方法是用一些计数器标记代码并引用这些标记来解释代码。我\raisebox
在那里使用了一些 es,以便更好地垂直对齐(带圆圈的字母太靠近括号的尖端)。
另外,您不应该\textsubscript
在数学模式下使用单字母索引(甚至多个单字母),而应该使用_{<indices>}
和来表示完整的单词或缩写_{\text{<index>}}
。
并且您可以考虑使用\left
,\right
括号(或使用类似的东西手动调整大小\big(
)。
\documentclass[]{article}
\usepackage{mathtools}
% Using \mylabel to hide the \label from amsmath
\let\mylabel\label
\newcounter{eqannotate}[equation]
\renewcommand*\theeqannotate{\textcircled{\footnotesize\alph{eqannotate}}}
\newcommand*\eqannotate[1][]
{%
\hbox
{%
\begingroup
\refstepcounter{eqannotate}%
\if\relax\detokenize{#1}\relax
\else
\mylabel{#1}%
\fi
\endgroup
\theeqannotate
}%
}
\begin{document}
\begin{equation}
\begin{aligned}
\label{mat:mom}
\rho g_{x}
&- \frac{\partial p}{\partial x}
+ \mu\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2
u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}\right)
&= \rho\frac{\partial u}{\partial t} \\
\underbrace{\rho g_{z}}_{\mathllap{\text{Body forces per unit volume}}}
&- \underbrace{\frac{\partial p}{\partial z}}
_{\mathclap{\text{\raisebox{-1.5ex}{Pressure forces per unit volume}}}}
+ \underbrace{\mu\left(\frac{\partial^2 w}{\partial x^2} + \frac{\partial^2
w}{\partial y^2} + \frac{\partial^2 w}{\partial z^2}\right)}
_{\hspace{-2em}\mathrlap{\text{\raisebox{-2ex}{Viscous forces per unit
volume}}}}
&= \underbrace{\rho\frac{\partial w}{\partial t}}
_{\mathrlap{\text{Inertial forces per unit volume}}}
\end{aligned}
\end{equation}
\begin{equation}
\begin{aligned}
\label{mat:mom2}
\rho g_{x}
&- \frac{\partial p}{\partial x}
+ \mu\left(\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2
u}{\partial y^2} + \frac{\partial^2 u}{\partial z^2}\right)
&= \rho\frac{\partial u}{\partial t} \\
\underbrace{\rho g_{z}}_{\raisebox{-.5ex}{\eqannotate[an:first]}}
&- \underbrace{\frac{\partial p}{\partial
z}}_{\raisebox{-.5ex}{\eqannotate[an:sec]}}
+ \underbrace{\mu\left(\frac{\partial^2 w}{\partial x^2} +
\frac{\partial^2 w}{\partial y^2} + \frac{\partial^2 w}{\partial
z^2}\right)}_{\raisebox{-.5ex}{\eqannotate[an:third]}}
&= \underbrace{\rho\frac{\partial w}{\partial
t}}_{\raisebox{-.5ex}{\eqannotate[an:fourth]}}
\end{aligned}
\end{equation}
With
\ref{an:first} being the body forces per unit volume,
\ref{an:sec} the pressure forces per unit volume,
\ref{an:third} the viscous forces per unit volume,
and \ref{an:fourth} the inertial forces per unit volume.
\end{document}