2

How can I align equations inside tabular? I want to place few lines of equation by side of the picture. But it turns out that I cannot use \& in order to shift equals signs to be one under another.

\documentclass{article}      % Specifies the document class

\usepackage{amsmath, amsfonts, mathtools, xfrac, empheq}
\usepackage{caption}


\begin{document}       % End of preamble and beginning of text.
\begin{tabular}{l r}
\begin{minipage}{0.6\textwidth}
\begin{align}
    V^\pi = E_\pi \{ R_t \mid s_t = s \} \\
    = E_\pi \left \{ \sum\limits_{k=0}^\infty \gamma^k r_{t+k+1} \mid s_t = s \right \}  \notag \\
    = E_\pi \left \{ r_{t+1} + \gamma \sum_{k=0}^\infty \gamma^k r_{t+k+2} \mid s_t =s \right\} \notag
\end{align}
\end{minipage}
&
\begin{minipage}{0.4\textwidth}
%\includegraphics[width=\textwidth]{olcar_L11-8}
\captionof{figure}{Backup diagram}
\end{minipage}
\end{tabular}

\end{document}

I would like it to like this: enter image description here

  • 2
    You could put a {} around the minipage but simpler just remove the outer tabular which isn't doing anything very useful, just put the two minpages on a line separated by (say) \hfill (edit as written your line is overfull as your minipages add up to \linewidth but you have a paragraph indentation on the left and 4\tabcolsep from the padding added by the outer tabular. – David Carlisle Dec 4 '13 at 14:52
4

As noted in comments your line is too wide

Overfull \hbox (39.00003pt too wide) in paragraph at lines 8--22

Due to paragraph indentation and 4 \tabcolsep (15+4*6=39pt).

If you simplify the markup, removing the tabular, the line fits the page, and you can use align with no problems:

enter image description here

\documentclass{article}      % Specifies the document class

\usepackage{amsmath, amsfonts, mathtools, xfrac, empheq}
\usepackage{caption}


\begin{document}       % End of preamble and beginning of text.

\noindent
\begin{minipage}{0.6\textwidth}
\begin{align}
    V^\pi &= E_\pi \{ R_t \mid s_t = s \} \\
    &= E_\pi \left \{ \sum\limits_{k=0}^\infty \gamma^k r_{t+k+1} \mid s_t = s \right \}  \notag \\
    &= E_\pi \left \{ r_{t+1} + \gamma \sum_{k=0}^\infty \gamma^k r_{t+k+2} \mid s_t =s \right\} \notag
\end{align}
\end{minipage}\hfill
\begin{minipage}{0.4\textwidth}
%\includegraphics[width=\textwidth]{olcar_L11-8}
\captionof{figure}{Backup diagram}
\end{minipage}


\end{document}
6

If we use aligned instead of align, it is accepted inside tabular. I would suggest replacing \left and \right by a proper, smaller braces.

Edit, according to the request from the comment: Please observe, that aligned doesn't call math mode, hence such mode should be activated.

\documentclass{article}      % Specifies the document class

%\usepackage{amsmath, amsfonts, mathtools, xfrac, empheq}
\usepackage{amsmath, amsfonts, empheq}
\usepackage{caption}


\begin{document}       % End of preamble and beginning of text.
\begin{tabular}{l r}
\begin{minipage}{0.6\textwidth}
$ % PS
%\begin{align}
\begin{aligned}
    V^\pi &= E_\pi \{ R_t \mid s_t = s \} \\
    &= E_\pi \left \{ \sum\limits_{k=0}^\infty \gamma^k r_{t+k+1} \mid s_t = s \right \}  \notag \\
    &= E_\pi \left \{ r_{t+1} + \gamma \sum_{k=0}^\infty \gamma^k r_{t+k+2} \mid s_t =s \right\} \notag
%\end{align}
\end{aligned} $
\end{minipage}
&
\begin{minipage}{0.4\textwidth}
%\includegraphics[width=\textwidth]{olcar_L11-8}
\captionof{figure}{Backup diagram}
\end{minipage}
\end{tabular}

\end{document}

enter image description here

  • Great answer. Only comment here is that aligned must be applied within a math environment. You have done this with $ but it is not immediately obvious that the align is inside for anyone else who is looking. – twerdster Nov 29 '14 at 3:37

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.