# Move tag next to equation in align environment

It's my first time asking here but I have got so much help from this site :D

My particular case is that I need order and tag Maxwell's equations but I need set the tag in a particular location, just after an equation and before explanatory text.

Another question is how could I place (alignment) whole align environment (respect to the page, I mean)?

My code would be this:

\usepackage{amsmath,amsthm,amsfonts,amssymb,graphicx,setspace,multirow,mathtools}
\begin{document}
\begin{align}
&\overrightarrow{\bf{\nabla}}\cdot\overrightarrow{\bf{E}}=\dfrac{\rho}{\varepsilon_0} \nonumber & \\
&\negthickspace
\begin{rcases}
\overrightarrow{\bf{\nabla}}\cdot\overrightarrow{\bf{B}}=0 \nonumber \\
\overrightarrow{\bf{\nabla}}\times\overrightarrow{\bf{E}}=\dfrac{\partial\overrightarrow{\bf{B}}}{\partial{t}} \nonumber
\end{rcases} \hspace{0.5cm}\text{Homogeneous equations}& \\
&\overrightarrow{\bf{\nabla}}\times\overrightarrow{\bf{B}}=\mu_0\overrightarrow{\bf{J}} \hspace{0.5cm}\text{Maxwell studies this equation and compares it with}\hspace{0.2cm}\overrightarrow{\bf{\nabla}}\cdot\overrightarrow{\bf{J}}+\dfrac{\partial \rho}{\partial{t}}=0
\end{align}
\end{document}


I want do that because of possibility to do future references to that equation but I wouldn't like that could be confused with the second equation in that line.

Thank you so much! :D

• What don't you put the explanations before the equation (rephrasing them if necessary), using \intertext? Aug 4, 2015 at 19:33
• Off-topic: the 3rd equation is wrong ;-): -\dfrac{\partial\overrightarrow{\bf{B}}}{\partial{t}} ... And I would use \vec{} instead of \overrightarrow or the (better?) esvect package
– user31729
Aug 4, 2015 at 19:46
• Yes, @ChristianHupfer when I did take screenshot it was wrong, you are right xD. Your help is very much appreciated; i'll try to use \vec instead of \overrightarrow and improve my style I forgot comment that I'm learning LaTex but I think that's obvious! xD If \bf is deprecated, which command do you recommends me to put text in bold type? (\vec also put the text in bold type?) Finishing... I would like do this how I want, I thought that LaTex is a typographic editor where you could make all things like you want (it's versatile, I mean; since universitary community uses it). Thanks a lot. Aug 4, 2015 at 20:59
• By default \vec{x} puts an arrow above x, but you can change it to whatever you like (see: tex.stackexchange.com/questions/258218/…) and \bf is replaced by \bfseries since the days of LaTeX; the syntax of those two commands is the same. Aug 5, 2015 at 9:59
• @JFernan -- last comment (this isn't a chat room ;). Sure, you can fuse the functionality of both via \newcommand{\boldarrowedvec}[1]{\vec{\mathbf{#1}}}. Aug 5, 2015 at 14:40

How about this? I put the explanations in a \parbox, and I think there is no risk of confusion.

With the eqparbox package, I align all = signs, and the alignat environment allows alignment of the texts. In addition I replaced \overrightarrow with arrows from the esvect package. Also, I used the esdiff package, from the same author, which simplifies typing partial derivatives (especially higher order derivatives).

\documentclass[a4paper, 11pt]{book}
\usepackage[utf8]{inputenc}

\usepackage{mathtools, amsfonts,amssymb, esvect, esdiff,eqparbox}

\begin{document}

\begin{alignat}{2}
& \eqmakebox[LS][r]{$\vv{\boldsymbol{\nabla}}\cdot\vv{\mathbf{E}}$}=\dfrac{\rho}{\varepsilon_0} \nonumber & \\
&\negthickspace
\begin{rcases}
\eqmakebox[LS][r]{$\vv{\boldsymbol{\nabla}}\cdot\vv{\mathbf{B}}$}=0 \nonumber \\
\eqmakebox[LS][r]{$\vv{\boldsymbol{\nabla}}\times\vv{\mathbf{E}}$} =\diffp{\vv{\mathbf{B}}}{t} \nonumber
\end{rcases} & \hspace{0.5cm} & \text{Homogeneous equations} \0.6ex] & \eqmakebox[LS][r]{ \vv{\boldsymbol{\nabla}}\times\vv{\mathbf{B}} }=\mu_0\vv{\mathbf{J}} & \hspace{0.5cm} & \parbox[t]{6cm}{Maxwell studies this equation \\ and compares it with\hspace{0.2cm} \vv{\boldsymbol{\nabla}}\cdot\vv{\mathbf{J}}+\diffp{\rho}{t}=0 } \end{alignat} \end{document}  • Oh! It's nice idea, thank you but... I insist in Latex versatility; there should be someway to do that I want, maybe making manually the tag or something (tagging text... I mean) ... And how you can change alignment of whole environment (respect to the page)? What represents the {2} next to alignat begin? and Which width parameter is [LS]? By last... In your idea would be great that you could put the tag next to "equation" word. Aug 4, 2015 at 22:28 • The whole group is centred with tespect to the margins. To change the alignment, you should specify some more details about what you want. The [2] next to the alignat environment declares the number of (horizontal) groups (hence the usage of 3&. You can see more details in he documentation of amsmath. Finally, [LS] is a tag for all \eqmakebox that share this tag: they will all have the width of the widest contents of the boxes (I'm not sure this is quite clear). Aug 4, 2015 at 23:14 • For your last request, perhaps it would be possible using another counter. I suppose you want to usethe current value of the equation counter? I do not know well enough the intricacies of amsmath, but I'll try to think about it. Aug 4, 2015 at 23:18 • Nice. (+1) (I wish, I could give an extra +1 for the esvect, my favourite package for vector arrows) – user31729 Aug 5, 2015 at 7:07 • @Christian Hupfer: You made me think to add the esdiff package to simplify typing of partial derivatives. Aug 5, 2015 at 9:40 Your writing style is tipical for notes, but is too caotic and moreover difficult to achieve in LaTeX. I suggest to rewrite the equations in a clearer way: \documentclass{article} \usepackage{amsmath,amsthm,amsfonts,amssymb,graphicx,setspace,multirow,mathtools} \begin{document} \begin{align} \vec{\mathbf{\nabla}} \cdot \vec{\mathbf{E}} & = \dfrac{\rho}{\varepsilon_0} \nonumber \\ \vec{\mathbf{\nabla}} \cdot \vec{\mathbf{B}} & = 0 \label{eq:nabla.B} \\ \vec{\mathbf{\nabla}} \times \vec{\mathbf{E}} & = -\dfrac{\partial\vec{\mathbf{B}}}{\partial{t}} \label{eq:nablaxE} \\ \vec{\mathbf{\nabla}} \times \vec{\mathbf{B}} & = \mu_0\vec{\mathbf{J}} \label{eq:nablaxB} \end{align} Equations~\eqref{eq:nabla.B} and~\eqref{eq:nablaxE} are homogeneous. Maxwell studies~\eqref{eq:nablaxB} and compares it with \[ \vec{\mathbf{\nabla}}\cdot\vec{\mathbf{J}}+\dfrac{\partial \rho}{\partial{t}}=0
\end{document}

• \bf is deprecated and I suggest to replace \overrightarrow by \vec
– user31729
Aug 4, 2015 at 20:21
• ... and \bf's syntax would be {\bf...} (It is a font switch and does not take an argument. The braces here are needed for proper grouping.) Aug 4, 2015 at 20:26
• And... How could I align the whole environment? (respect the page?) Aug 4, 2015 at 21:07
• @ChristianHupfer You are right. I correct my answer. Aug 5, 2015 at 9:21
• @JFernan What do you mean? The whole environment is centered respect the textwidth. Aug 5, 2015 at 9:22