# Aligning two adjacent numbered equations central to the vertical, and the horizontal

So I have an issue aligning two equations which I wish to label/number. I wish to place the equations adjacent to each other, with equidistant spacing in the horizontal (between the equations and the page maxima), and also aligned such that the equal-signs of both equations are in the same line of action horizontally. It may be easier to show you...

These are my three, inadequate, solutions thus far:

Solution 1):

\begin{minipage}[t]{.48\linewidth}
$$\vec{B}_{trap}(\vec{J}_c, \vec{r}) = k \mu_o \vec{J}_c \ \vec{\hat{r}}$$\break
\end{minipage}%
\begin{minipage}[t]{.48\linewidth}
$$k = \frac{t}{2a}{\rm{ln}}\left ( \frac{a}{t} + \sqrt{1 + \left ( \frac{a}{t}\right )^{2}} \right )$$
\end{minipage}


Solution 2):

\begin{align*}
\vec{B}_{trap}(\vec{J}_c, \vec{r}) = k \mu_o \vec{J}_c \ \vec{\hat{r}} \label{eq:btrap}
& & k = \frac{t}{2a}{\rm{ln}}\left ( \frac{a}{t} + \sqrt{1 + \left ( \frac{a}{t}\right )^{2}} \right ) \\
\end{align*}


Solution 3):

\begin{multicols}{2}
$$\vec{B}_{trap}(\vec{J}_c, \vec{r}) = k \mu_o \vec{J}_c \ \vec{\hat{r}}$$
$$k = \frac{t}{2a}{\rm{ln}}\left ( \frac{a}{t} + \sqrt{1 + \left ( \frac{a}{t}\right )^{2}} \right )$$
\end{multicols}


Which typesets as so:

As you can see, method 1 and 3 produce numbered and referenced equations, as I need, as they both support the equation environment, however they also are not aligned in the horizontal plane - the equals signs do not share the same line of action horizontally. Whilst the align method allows this horizontal alignment I have failed to reference more than one equation as it can only handle one \ref{eq1}. I need to stay away from using tabular or array as my thesis document would pick up these equations as a table and list them in the 'tables' section of my document. I think so far the best method is align* but I am unable to produce references and numbered equations with that method (which again, must be seen as equations or my 'equations' page will not list them)

Any ideas? Thanks!

• your statement about avoiding tabular isn't correct, you may or may not want to use tabular (or array) but neither force the use of a float and the table environment or an entry in the list of tables. – David Carlisle Jan 25 at 10:01
• Welcome to TeX.SE! – Mico Jan 25 at 10:39

What's messing up your first, minipage-based solution is an inappropriate choice of widths. Also, don't use the [t] location specifiers for the minipage environments -- you want both equations centered vertically on the = symbols, right?

Also, note that I replaced {\rm{ln}} with \ln.

\documentclass{article}
\renewcommand\vec[1]{\mathbf{#1}}
\usepackage{amsmath} % for "\numberwithin" macro
\numberwithin{equation}{section} % optional

\begin{document}
\setcounter{section}{2} % just for this example

\noindent % <-- new
\begin{minipage}{.4\linewidth} % <-- new
$$\vec{B}_{\mathrm{trap}}(\vec{J}_c, \vec{r}) = k \mu_o \vec{J}_c \hat{\vec{r}}$$
\end{minipage}\hfill
\begin{minipage}{.5\linewidth}
$$k = \frac{t}{2a}\ln\biggl( \frac{a}{t} + \sqrt{1 + \Bigl( \frac{a}{t}\Bigr)^{\!2}}\, \biggr)$$
\end{minipage}
\end{document}


It's not that easy to do this without adding unwanted spaces and having all the features of math displays.

Here's a quite general version. The optional argument to halfequation (default 0.5) is the fraction of the width reserved for the equation.

In this particular case it seems best to reserve more for the larger equation.

\documentclass{article}
\usepackage{amsmath,array}

\usepackage{lipsum} % for context

\newenvironment{halfequation}[1][0.5]
{\vcenter\bgroup
\hsize=#1\displaywidth
\setlength{\abovedisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}
$$} {$$\egroup}

\begin{document}

\lipsum*[4]
$\begin{halfequation}[0.4]\label{a} \vec{B}_{\mathrm{trap}}(\vec{J}_c, \vec{r}) = k \mu_o \vec{J}_c \, \vec{\hat{r}} \end{halfequation} \begin{halfequation}[0.6]\label{b} k = \frac{t}{2a}\ln\left ( \frac{a}{t} + \sqrt{1 + \left ( \frac{a}{t}\right )^{2}} \right ) \end{halfequation}$
\lipsum*[5]

\clearpage

\lipsum*[4]
$$k = \frac{t}{2a}\ln\left ( \frac{a}{t} + \sqrt{1 + \left ( \frac{a}{t}\right )^{2}} \right )$$
\lipsum*[5]

\end{document}


I added another page to show that the vertical spacings are the same.