# Aligning 4 equations with label

I did the following code :

\begin{align}
div(\bm{E})=& \frac{\rho}{\epsilon_0}           &  div(\bm{B})&=0 \\
\bm{curl}(\bm{E})=& -\partial_t \bm{B}           &  \bm{curl}(\bm{B})&= \mu_0 \bm{j} + \mu_0 \epsilon_0 \partial_t \bm{E}
\label{eq_maxwell}
\end{align}


It gives this result :

You can see that the alignment is correct but I only have two label corresponding to the two lines. I would like a label for each of the equations.

How can I make it ?

• Do you want a single label for each side, or two labels (4 labels in all)? – Bernard Jun 2 at 16:09
• @koleygr: I've forgotten a lot about Maxwell's equations… ;o) – Bernard Jun 2 at 16:13
• @Bernard... Can be happen to anyone ... Even to me... I can just recognize them right now, but can't really solve or use non of them (didn't tried... but sure can't) :P... Deleting – koleygr Jun 2 at 16:16

A solution with two side by side minipages – and div, curl in uprightshape:

\documentclass{article}

\usepackage{mathtools, bm}
\DeclareMathOperator{\Div}{div}
\DeclareMathOperator{\curl}{\mathbf{curl}}

\begin{document}

\begin{minipage}[t]{0.45\linewidth}
\begin{align}
\Div(\bm{E})=& \frac{\rho}{\epsilon_0} \\
\curl(\bm{E})=& -\partial_t \bm{B}
\label{eq_maxwell}
\end{align}
\end{minipage}
\hfill
\begin{minipage}[t]{0.45\linewidth}
\begin{align}
\Div(\bm{B})&=0\vphantom{\frac{\rho}{\epsilon_0}} \\
\curl(\bm{B})&= \mu_0 \bm{j} + \mu_0 \epsilon_0 \partial_t \bm{E}
\label{eq_maxwell}
\end{align}
\end{minipage}

\end{document}


• I was faster for a few seconds or may be miliseconds ... but haven't screenshot installed ... So I cheated ... Deleting mine – koleygr Jun 2 at 16:21
• Why so? I'm not competing, and anyway, I can post a variant with tabularx, for instance. – Bernard Jun 2 at 16:24
• Mine was too fast without really caring about anything than the solution of the problem (the addition of minipages)... Yours already including this solution and also some useful corrections ... So, mine doesn't really offer something more and also, without a screenshot seems worse (forgot that haven't screenshot here while writing the answer)... No competition for me too... Better choice for the community is your answer... (You could just add different \labels for more improvement in future \ref ) Have a nice day @Bernard and StarBuck.... – koleygr Jun 2 at 16:27

Here's my suggestion. Since the left part is narrower than the right part, I set them in different width boxes.

You may be surprised at the usage of $$. It's true that it should not be used in LaTeX, except in select cases. Of course, this is not effective if fleqn is used, so in that case a different trick has to be used. I also suggest subequations so you get subordinate numbering and can refer to the set of equations by a single \eqref{eq_maxwell}, still being able to call each one by the corresponding label. \documentclass{article} \usepackage{amsmath,bm} \usepackage{lipsum} % for mock context \DeclareMathOperator{\Div}{div} % \div is already taken \DeclareMathOperator{\Curl}{\mathbf{curl}} \begin{document} \lipsum[1] \begin{subequations}\label{eq_maxwell}$$
\begin{minipage}{0.4\displaywidth}
\abovedisplayskip=0pt\belowdisplayskip=0pt
\begin{align}
\Div(\bm{E})  &= \frac{\rho}{\epsilon_0}\label{eq_maxwell-A} \\
\Curl(\bm{E}) &= -\partial_t \bm{B}\label{eq_maxwell-B}
\end{align}
\end{minipage}\hspace{0.1\displaywidth}
\begin{minipage}{0.5\displaywidth}
\abovedisplayskip=0pt\belowdisplayskip=0pt
\begin{align}
\Div(\bm{B})  &= 0 \label{eq_maxwell-C} \vphantom{\frac{\rho}{\epsilon_0}}\\
\Curl(\bm{B}) &= \mu_0 \bm{j} + \mu_0 \epsilon_0 \partial_t \bm{E} \label{eq_maxwell-D}
\end{align}
\end{minipage}

\end{subequations}
\lipsum[2]

\end{document}


• Hi, prof. Can you have an explanation, please? Why you use double dollar into your code? Just a curiosity. – Sebastiano Jun 2 at 19:50
• @Sebastiano The idea is to get the standard behavior that a math display is not detached from the preceding text by a page break (which is difficult to get with a center environment); on the other hand, $...$ cannot be used, because of how amsmath implements it. Artists know when they need to break the rules. ;-) – egreg Jun 2 at 19:52
• It is wonderful your final comment ahahahahh. Chapeau :-) at the great artist :-) – Sebastiano Jun 2 at 19:56