10

I have a displaymath environment and an align* environment I would like to display next to each other. My idea was to wrap them in a tabular environment:

\begin{tabular}{c c}
  \[
    %math stuff here
  \]
  &
  \begin{align*}
    %laign stuff here
  \end{align*}
\end{tabular}

Both environments work fine on their own, but as soon as I add in tabular, the following error starts coming up (repeatedly):

Missing $ inserted.

I've also tried the multicol environment as suggested in How to place a program and a text side by side?, but that just led to an error like the following:

Overfull \vbox blah blah blah 

repeat like 20 times.

I am not able to get past this point. How can I get a displaymath environment and an align* environment to be side by side?

knpwrs
  • 1,485

3 Answers3

9

Two possibilities:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\noindent\begin{tabular}{p{0.45\textwidth}p{0.45\textwidth}}
  \[
    A = B
  \]
  &
  \[
  \begin{aligned}
    a&= b \\
    c&= d
  \end{aligned}
  \]
\end{tabular}

\noindent\begin{minipage}{0.45\textwidth}
  \[
    A = B
  \]
  \end{minipage}
  \begin{minipage}{0.45\textwidth}
  \begin{align*}
    a&= b \\
    c&= d
  \end{align*}
\end{minipage}
\end{document}
Moriambar
  • 11,466
Torbjørn T.
  • 206,688
  • Second one worked, thank you very much! The first one was complaining about me using \\[0.3em] at the end of rows in align*. – knpwrs Dec 04 '11 at 09:27
  • @KPthunder You'll notice that I didn't use align* in the first one, but aligned within displaymath. Using \\[0.3em] works fine here. – Torbjørn T. Dec 04 '11 at 09:30
  • @TorbjørnT. Very good! I added an answer with an align* version, to show the OP that it could be used too, if the & for align is hidden from tabular. – Stefan Kottwitz Dec 04 '11 at 09:38
8

Also align* works in a p cell in a tabular environment. A trick to make it work, is grouping the align* environment by curly braces, so the & within align does not act like an & for tabular. Even \\[length] works.

A modification of Torbjørn's table in this way:

\noindent\begin{tabular}{p{0.45\textwidth}p{0.45\textwidth}}
  \[
    A = B
  \]
  &
  {
    \begin{align*}
      a &= b \\[0.5ex]
      c &= d
    \end{align*}
  }
\end{tabular}
Stefan Kottwitz
  • 231,401
4

It is quite possible you need only:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{align*}
\begin{aligned}
a &= 1 \\
b &= 1+2 \\
c &= 1+2+3 
\end{aligned}
&&
A = B
\end{align*}
\end{document}

Forget complex tabulars and boxes.

Moriambar
  • 11,466
Leo Liu
  • 77,365