如何将单词“direção x”、“direção y”与单词“continuidade”对齐?
\begin{equation}\label{eq:mx}
\frac{\partial u}{\partial t} = - \left(u\frac{\partial u}{\partial x}
+ v\frac{\partial u}{\partial y}\right) - \frac{\partial P}{\partial
x} +
\frac{1}{Re}\left(\frac{\partial^2u}{\partial x^2} +
\frac{\partial^2u}{\partial y^2}\right)
\hspace{8ex}
\mbox{direção x}
\end{equation}
\begin{equation}\label{eq:my}
\frac{\partial v}{\partial t} = - \left(u\frac{\partial v}{\partial x}
+ v\frac{\partial v}{\partial y}\right) - \frac{\partial P}{\partial
y} +
\frac{1}{Re}\left(\frac{\partial^2v}{\partial x^2} +
\frac{\partial^2v}{\partial y^2}\right)
\hspace{8ex}
\mbox{direção y}
\end{equation}
\begin{equation}\label{eq:cm}
\frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} = 0
\hspace{8ex}\mbox{continuidade}
\end{equation}
编辑:我只想对齐单词:“direção x”、“direção y”和“continuidade”。方程式可以保持与图中相同的位置。
答案1
由于align
使用 r/l 对齐,仍然需要进行一些手动调整才能使底部方程准中心。
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
\label{eq:mx}
\frac{\partial u}{\partial t} = - \left(u\frac{\partial u}{\partial x}
+ v\frac{\partial u}{\partial y}\right) - \frac{\partial P}{\partial
x} +
\frac{1}{Re}\left(\frac{\partial^2u}{\partial x^2} +
\frac{\partial^2u}{\partial y^2}\right)
&\hspace{8ex}
\mbox{direção x}
\\\label{eq:my}
\frac{\partial v}{\partial t} = - \left(u\frac{\partial v}{\partial x}
+ v\frac{\partial v}{\partial y}\right) - \frac{\partial P}{\partial
y} +
\frac{1}{Re}\left(\frac{\partial^2v}{\partial x^2} +
\frac{\partial^2v}{\partial y^2}\right)
&\hspace{8ex}
\mbox{direção y}
\\\label{eq:cm}
\frac{\partial u}{\partial x} + \frac{\partial v}{\partial y} = 0
\hspace{17.8ex}&\hspace{8ex}\mbox{continuidade}
\end{align}
\end{document}
答案2
我提出这些变体的依据如下flalign
:
\documentclass[brazil]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{esdiff}
\begin{document}
\begin{flalign}
\label{eq:mx}
& & \diffp{u}{t}= - \left(u\diffp{u}{x} + v\diffp{u}{y}\right)& - \diffp{P}{x} +
\frac{1}{Re}\left(\diffp[2]{u}{x} + \diffp[2]{u}{y}\right)
&&
\text{\small direção $x$} \\[0.5ex]
\label{eq:my}
& & \diffp{v}{t}= - \left(u\diffp{v}{x} + v\diffp{v}{y}\right) &- \diffp{P}{y} +
\frac{1}{Re}\left(\diffp[2]{v}{x} + \diffp[2]{v}{y}\right)
&&
\text{\small direção $y$} \\[0.5ex]
\label{eq:cm}
& & \diffp{u}{x}& + \diffp{v}{y} = 0
& &\text{\small continuidade}
\end{flalign}
\begin{flalign}
\label{eq:mx}
& & \diffp{u}{t}= - \left(u\diffp{u}{x} + v\diffp{u}{y}\right)& - \diffp{P}{x} +
\frac{1}{Re}\left(\diffp[2]{u}{x} + \diffp[2]{u}{y}\right)
&
\text{\small direção $x$}& \\[0.5ex]
\label{eq:my}
& & \diffp{v}{t}= - \left(u\diffp{v}{x} + v\diffp{v}{y}\right) &- \diffp{P}{y} +
\frac{1}{Re}\left(\diffp[2]{v}{x} + \diffp[2]{v}{y}\right)
&
\text{\small direção $y$}& \\[0.5ex]
\label{eq:cm}
& & \diffp{u}{x}& + \diffp{v}{y} = 0
&\text{\small continuidade} &
\end{flalign}
\end{document}
答案3
使用与https://tex.stackexchange.com/a/209732/4427
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{amsmath}
\newcommand{\pder}[3][]{%
\frac{\partial^{#1} #2}{\partial #3^{#1}}%
}
\makeatletter
\newcommand{\colwidth@}[1]{%
\ifcase\expandafter#1\maxcolumn@widths\fi
}
\newcommand{\Cen}[1]{%
\ifmeasuring@
\else
\makebox[0pt][l]{%
\kern-\colwidth@{1}%
\makebox[\dimexpr\colwidth@{1}+\colwidth@{2}]{$\displaystyle#1$}%
}%
\fi&
}
\makeatother
\begin{document}
\begin{align}
\label{eq:mx}
\pder{u}{t} &= - \left(u\pder{u}{x} + v\pder{u}{y}\right) - \pder{P}{x} +
\frac{1}{Re}\left(\pder[2]{u}{x} + \pder[2]{u}{y}\right)
&&
\text{direção $x$}
\\
\label{eq:my}
\pder{v}{t} &= - \left(u\pder{v}{x} + v\pder{v}{y}\right) - \pder{P}{y} +
\frac{1}{Re}\left(\pder[2]{v}{x} + \pder[2]{v}{y}\right)
&&
\text{direção $y$}
\\
\label{eq:cm}
\Cen{\pder{u}{x} + \pder{v}{y} = 0}
&&\text{continuidade}
\end{align}
\end{document}
另外,最后一行不居中:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{amsmath}
\newcommand{\pder}[3][]{%
\frac{\partial^{#1} #2}{\partial #3^{#1}}%
}
\begin{document}
\begin{align}
\label{eq:mx}
\pder{u}{t} &= - \left(u\pder{u}{x} + v\pder{u}{y}\right) - \pder{P}{x} +
\frac{1}{Re}\left(\pder[2]{u}{x} + \pder[2]{u}{y}\right)
&&
\text{direção $x$}
\\
\label{eq:my}
\pder{v}{t} &= - \left(u\pder{v}{x} + v\pder{v}{y}\right) - \pder{P}{y} +
\frac{1}{Re}\left(\pder[2]{v}{x} + \pder[2]{v}{y}\right)
&&
\text{direção $y$}
\\
\label{eq:cm}
\pder{u}{x} &+ \pder{v}{y} = 0
&&\text{continuidade}
\end{align}
\end{document}
另一种方法是IEEEeqnarray
使用IEEEtrantools
:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage{amsmath}
\usepackage{IEEEtrantools}
\newcommand{\pder}[3][]{%
\frac{\partial^{#1} #2}{\partial #3^{#1}}%
}
\begin{document}
\begin{IEEEeqnarray}{rCl'l}
\label{eq:mx}
\pder{u}{t} &=& - \left(u\pder{u}{x} + v\pder{u}{y}\right) - \pder{P}{x} +
\frac{1}{Re}\left(\pder[2]{u}{x} + \pder[2]{u}{y}\right)
&
\text{direção $x$}
\\
\label{eq:my}
\pder{v}{t} &=& - \left(u\pder{v}{x} + v\pder{v}{y}\right) - \pder{P}{y} +
\frac{1}{Re}\left(\pder[2]{v}{x} + \pder[2]{v}{y}\right)
&
\text{direção $y$}
\\
\IEEEeqnarraymulticol{3}{c}{\pder{u}{x} + \pder{v}{y} = 0}
&\text{continuidade}
\label{eq:cm}
\end{IEEEeqnarray}
\end{document}
答案4
第一次至少编译两次以下内容:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,eqparbox}
\begin{document}
\begin{align}
\eqmakebox[LHS]{$\displaystyle\frac{\partial u}{\partial t} =
- \left(u\frac{\partial u}{\partial x}
+ v\frac{\partial u}{\partial y}\right) - \frac{\partial P}{\partial x}
+ \frac{1}{Re}\left(\frac{\partial^2u}{\partial x^2}
+ \frac{\partial^2u}{\partial y^2}\right)$} &&&
\text{direção $x$} \\
\eqmakebox[LHS]{$\displaystyle\frac{\partial v}{\partial t} =
- \left(u\frac{\partial v}{\partial x}
+ v\frac{\partial v}{\partial y}\right) - \frac{\partial P}{\partial y}
+ \frac{1}{Re}\left(\frac{\partial^2v}{\partial x^2}
+ \frac{\partial^2v}{\partial y^2}\right)$} &&&
\text{direção $y$} \\
\eqmakebox[LHS]{$\displaystyle\frac{\partial u}{\partial x}
+ \frac{\partial v}{\partial y} = 0$} &&&
\text{continuidade}
\end{align}
\end{document}
包裹eqparbox
确保所有\eqmakebox[<tag>]
拥有<tag>
相同最大限度宽度。默认设置是c
输入这些框内的内容,但您可以通过align
( ) 更改该设置\eqmakebox[<tag>][<align>]
。