# How to align these equations [duplicate]

How to align the equations that the result be like the image?

\newcommand{\barU}{\bar{U}}
\newcommand{\barV}{\bar{V}}
\usepackage{amsmath}

\begin{align}
\label{eq:mx2}
\frac{\partial \barU}{\partial t} + \frac{\partial u}{\partial t} &= - \left[\barU\left(\frac{\partial \barU}{\partial x}
+ \frac{\partial u}{\partial x}\right)
+ u\left(\frac{\partial \barU}{\partial x} + \frac{\partial u}{\partial x}\right) + \barV\left(\frac{\partial \barU}{\partial y}
+ \frac{\partial u}{\partial y}
\right) + v\left(\frac{\partial \barU}{\partial y} + \frac{\partial u}{\partial y}\right)\right] - \frac{\partial \barP}{\partial x}
- \frac{\partial p}{\partial x}
+ \\
&\frac{1}{Re}\left(\frac{\partial^2\barU}{\partial x^2} + \frac{\partial^2u}{\partial x^2} + \frac{\partial^2 \barU}{\partial y^2} +
\frac{\partial^2u}{\partial y^2}\right) \nonumber
\hspace{8ex}
\mbox{direção x} \\
%------------------------
\label{eq:my2}
\frac{\partial \barV}{\partial t} + \frac{\partial v}{\partial t} &= - \left[\barU\left(\frac{\partial \barV}{\partial x} +
\frac{\partial v}{\partial x}\right)
+ u\left(\frac{\partial \barV}{\partial x} + \frac{\partial v}{\partial x}\right) + \barV\left(\frac{\partial \barV}{\partial y}
+ \frac{\partial v}{\partial y}
\right) + v\left(\frac{\partial \barV}{\partial y} + \frac{\partial v}{\partial y}\right)\right] - \frac{\partial \barP}{\partial y}
- \frac{\partial p}{\partial y} + \\
&\frac{1}{Re}\left(\frac{\partial^2\barV}{\partial x^2} + \frac{\partial^2v}{\partial x^2} + \frac{\partial^2\barV}{\partial y^2}
+ \frac{\partial^2v}{\partial y^2}\right) \nonumber
\hspace{8ex}
\mbox{direção y} \\
%-------------------------
\frac{\partial \barU}{\partial x} + \frac{\partial u}{\partial x} + \frac{\partial \barV}{\partial y} + \frac{\partial v}{\partial y} = 0
\hspace{18.8ex}
&\hspace{8ex}
\end{align}


## marked as duplicate by Stefan Pinnow, Andrew, TeXnician, Sebastiano, TroyMay 25 '18 at 6:31

• The alignment isn't very nice… – Bernard May 24 '18 at 21:47

I can propose this alignment. I added the necessary code to use the (extensible) \widebar command from mathabx without loading the package, as I think it looks better than \bar with capital letters. Last, I loaded esdiff which simplifies typing partial derivatives with its \diffp command:

\documentclass[a4paper]{article}
\usepackage[showframe]{geometry}
\usepackage{mathtools, esdiff}
\usepackage{booktabs}

\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
<5><6><7><8><9><10>
<10.95><12><14.4><17.28><20.74><24.88>
mathx10
}{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\widebar}{0}{mathx}{"73}

\newcommand{\barU}{\widebar{U}}
\newcommand{\barV}{\widebar{V}}
\newcommand{\barP}{\widebar{P}}

\begin{document}

\begin{align}
\label{eq:mx2}
\diffp{\barU}{t} + \diffp{u}{t} &=\begin{aligned}[t] & - \left[\barU\left(\diffp{\barU}{x} + \diffp{u}{x}\right) + u\left(\diffp{\barU}{x} + \diffp{u}{x}\right) + \barV\left(\diffp{\barU}{y} + \diffp{u}{y} \right) + v\left(\diffp{\barU}{y} + \diffp{u}{y}\right)\right] \\
& - \diffp{\bar P}{x} - \diffp{p}{x} +\frac{1}{Re}\left(\frac{\partial^2\barU}{\partial x^2} + \frac{\partial^2u}{\partial x^2} + \frac{\partial^2 \barU}{\partial y^2} + \frac{\partial^2u}{\partial y^2}\right) \hspace{8ex}
\mbox{direção x} \end{aligned}\\[1.5ex]
%------------------------
\label{eq:my2}
\diffp{\barV}{t} + \diffp{v}{t} &=\begin{aligned}[t] & - \left[\barU\left(\diffp{\barV}{x} + \diffp{v}{x}\right) + u\left(\diffp{\barV}{x} + \diffp{v}{x}\right) + \barV\left(\diffp{\barV}{y} + \diffp{v}{y} \right) + v\left(\diffp{\barV}{y} + \diffp{v}{y}\right)\right]\\
& - \diffp{\bar P}{y} - \diffp{p}{y} + \frac{1}{Re}\left(\diffp[2]{\barV}{x} + \diffp[2]{v}{x} + \diffp[2]{\barV}{y} + \diffp[2]{v}{y}\right)
\hspace{8ex}
\mbox{direção y} \end{aligned} \\[1.5ex]
% %-------------------------
\diffp{\barU}{x} + \diffp{u}{x} &+ \diffp{\barV}{y} + \diffp{v}{y} = 0
\hspace{18.9em}