5

I'm trying to line up multiple equations next to each other and have them all properly labeled. There is another question discussing this exact problem. Unfortunately, all the solutions proposed there produce output with the equations sitting on different baselines, which is extremely jarring.

Here's the document I'm working with:

\documentclass{article}
\usepackage{amsmath, amsfonts}
\begin{document}
\begin{equation}
  \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^n a_ib_i
  \qquad
  \mathbf{a} \cdot \mathbf{b} =
    \lVert \mathbf{a} \rVert
    \lVert \mathbf{b} \rVert \cos \theta
\end{equation}
\end{document}

When written this way, it appears that both left-hand sides use the same baseline and the output looks quite pleasing. Unfortunately I couldn't achieve the same effect using the suggestions from the linked question (which are tabularx, multicol or minipage).

Please help!

Update. I realize that the question is a bit poorly worded. What I really want here, is an ability to arrange equations on a grid, in a way similar to how various align environments work, but at the same time also labeling equations that end up on the same row. I hope that makes sense.

  • Can you show the code where you tried and failed to get them side-by-side? If I wrap each of the equations in a minipage without a blank line between the two minipages they line up correctly, as in the linked question. – Alan Munn Dec 8 '11 at 1:29
6

The minipage solution from the question you linked to can actually be used here, provided that you supply the second minipage with an optional [b] argument (the argument can be t for top, c for center, b, see parboxes on tug and minipages on tug for more details).

screenshot

\documentclass{article}
\usepackage{amsmath, amsfonts}
\begin{document}


\noindent\begin{minipage}{.5\textwidth}
\begin{equation}
  \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^n a_ib_i
\end{equation}
\end{minipage}%
\begin{minipage}[b]{.5\textwidth}
 \begin{equation}
  \mathbf{a} \cdot \mathbf{b} =
    \lVert \mathbf{a} \rVert
    \lVert \mathbf{b} \rVert \cos \theta
\end{equation}
\end{minipage}
\end{document}

Following the updated question and the comments, here is an example of how you can use the above idea in a tabular* environment

screenshot2

\documentclass[draft]{article}
\usepackage{amsmath, amsfonts}

\newenvironment{minipeqn}[1][]{\begin{minipage}[#1]{.45\textwidth}\begin{equation}}{\end{equation}\end{minipage}}
\begin{document}

\noindent\begin{tabular*}{\textwidth}{ll}
 \begin{minipeqn}
  \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^n a_ib_i
\end{minipeqn}&
\begin{minipeqn}[b]
  \mathbf{a} \cdot \mathbf{b} =
    \lVert \mathbf{a} \rVert
    \lVert \mathbf{b} \rVert \cos \theta
\end{minipeqn}\\
\begin{minipeqn}
  \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^n a_ib_i
\end{minipeqn}&
 \begin{minipeqn}[b]
  \mathbf{a} \cdot \mathbf{b} =
    \lVert \mathbf{a} \rVert
    \lVert \mathbf{b} \rVert \cos \theta
\end{minipeqn}\\
\begin{minipeqn}
  \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^n a_ib_i
\end{minipeqn}&
 \begin{minipeqn}[b]
  \mathbf{a} \cdot \mathbf{b} =
    \lVert \mathbf{a} \rVert
    \lVert \mathbf{b} \rVert \cos \theta
\end{minipeqn}
\end{tabular*}

\end{document}
  • You could add % after the first \end{minipage} to prevent a spurious blank space. – Gonzalo Medina Dec 8 '11 at 1:44
  • @GonzaloMedina Thanks, great suggestion! Done :) – cmhughes Dec 8 '11 at 1:45
  • Hi. Thank you. Is it possible to extend this approach to more equations? For example, if I copy each equation environment, ending up with two equations on each page, then only the bottom equations are aligned. – Anonymous Dec 8 '11 at 1:50
  • @Anonymous Could you clarify: are you putting more than one equation environment in each minipage? – cmhughes Dec 8 '11 at 2:09
  • Yes, I'm trying now to put multiple equation blocks in every minipage and the vertical alignment gets pretty strange. I updated the question too. Or should I just create two minipages for each row instead? – Anonymous Dec 8 '11 at 2:12

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.