2

I'm writing a paper and I want to replicate this set of equations in my latex document. But when I'm trying to do the align with & many times I get error.

Set of equations

\begin{eqnarray}
    \label{Eq:GeosWind}
    \frac{\partial u}{\partial t} &+& \overrightarrow{v}\nabla u + \frac{1}{\rho}\frac{\partial p}{\partial x}  -fv +f^{\ast}w \mp v \frac{\vert\overrightarrow{v}\vert}{r}  + F_x = 0 \label{a}\\
    \frac{\partial v}{\partial t} + \overrightarrow{v}\nabla u + \frac{1}{\rho}\frac{\partial p}{\partial y} + fu \pm u \frac{\vert\overrightarrow{v}\vert}{r} +F_y = 0 \label{b}\\
    \frac{\partial w}{\partial t} + \overrightarrow{v}\nabla w + \frac{1}{\rho}\frac{\partial p}{\partial y} -g -f^{\ast}u  + F_z = 0 \label{c}\\
    I &&   II    III   IV    V    VI   VII
\end{eqnarray}
3

Here's a solution with alignat (7columns) and eqparbox. I also loaded the esdiff and esvect packages for a simpler typing of partial differential, and nicer arrow tips:

\documentclass{article}
\usepackage[b]{esvect}
\usepackage{esdiff}
\usepackage{eqparbox}
\newcommand{\eqmathbox}[2][M] {\eqmakebox[#1]{$\displaystyle#2$}}
\usepackage{amsmath}

\begin{document}

    \begin{alignat}{7}
 \diffp{u}{t} &+{} &\vv{v}\nabla u & +{} & \frac{1}{\rho}\diffp{p}{x} & & & -{} & fv & +{} & f^{\ast}w & \mp{} & v \frac{\vert\vv{v}\vert}{r}& + F_x = 0 \label{a}\\
 \diffp{v}{t} &+{} & \vv{v}\nabla u & + {} & \frac{1}{\rho}\diffp{p}{ y} & & & +{} & fu & & & \pm{} &\eqmathbox[VI]{u\frac{\vert\vv{v}\vert}{r}} & +F_y = 0 \label{b}\\
   \eqmathbox[I]{\diffp{w}{t}} &+{} &\eqmathbox[II] {\vv{v}\nabla w } & +{} & \eqmathbox[III]{\frac{1}{\rho}\diffp{p}{y}} &-{} & \eqmathbox[IV]{g} & -{} & \eqmathbox[V]{f^{\ast}u} & & & & & + F_z = 0\label{c} \\
   \eqmakebox[I]{I} & & \eqmakebox[II]{II}& & \eqmakebox[III]{III} & & \eqmakebox[IV]{IV}& & \eqmakebox[V]{V} & & & & \eqmakebox[VI]{VI} & \phantom{ + }\text{VII} \notag
    \end{alignat}%

\end{document}

enter image description here

5
  • 1
    +1. A very minor nit to pick: The first instances of + in rows 1 and 2 should be generated by &+{} instead of by &{}+, right?
    – Mico
    Jul 9 '20 at 3:48
  • 1
    @Mico: Not so minor. The reason, I guess, was the way I ended in this code: I initialy wrote a standard alignat wiithout the roman numbers, then redistributed some of the & so as to centre these numbers w.r.t. the above maths expressions, enclosed in \eqmathboxes — and the ampersands were so many… Thanks again!
    – Bernard
    Jul 9 '20 at 8:57
  • I've deleted one final stray } character. :-)
    – Mico
    Jul 9 '20 at 9:20
  • Thanks for your help. I've been a few hours trying to align the equations. So, alignat is a better way to that and the white spaces are represented with {}. Right? Jul 10 '20 at 2:59
  • Not exactly – the distinctive feature of alignat, as opposed to align, is that it adds no space between the alignment columns: it up to you to add the spacing. Here , I added {} after + to ensure it's considered by latex as a mathbin, with the ad hoc spacing on each side (because there's a & before, it would be a mathord without this trick.
    – Bernard
    Jul 10 '20 at 9:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.