在表格内对齐方程式

在表格内对齐方程式

如何在表格内对齐方程式?我想在图片旁边放置几行方程式。但事实证明,我无法使用 \& 将等号移至另一个之下。

\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}

我希望它是这样的: 在此处输入图片描述

答案1

正如评论中指出的那样,你的线太宽了

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

由于段落缩进和4 \tabcolsep(15+4*6=39pt)。

如果您简化标记,删除表格,该行将适合页面,并且可以align毫无问题地使用:

在此处输入图片描述

\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}

答案2

如果我们使用aligned而不是align,它在表格中是可以接受的。我建议用合适的、较小的括号代替\left和。\right

根据评论的要求进行编辑:请注意,这aligned并不调用数学模式,因此应该激活这种模式。

\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}

在此处输入图片描述

相关内容