8

I am trying to put all the equations of my presentation made with Beamer into a single table to summarize them. They are however in various frames within \align environments. How can I achieve this?

cmhughes
  • 100,947
user17947
  • 121

2 Answers2

6

You can use the collect* environment from the collect package; a simple example:

\documentclass{beamer}
\usepackage{collect}

\definecollection{equations}

\begin{document}

\begin{frame}
\frametitle{A frame with an equation}
\begin{collect*}{equations}{}{}{}{}
\begin{align*}
a &= b \\
&=c.  
\end{align*}
\end{collect*}
\end{frame}

\begin{frame}
\frametitle{Another frame with an equation}
\begin{collect*}{equations}{}{}{}{}
\begin{align*}
x &= y \\
&=z.  
\end{align*}
\end{collect*}
\end{frame}

\begin{frame}
\frametitle{List of Equations}
\includecollection{equations}
\end{frame}

\end{document}

enter image description here

Moriambar
  • 11,466
Gonzalo Medina
  • 505,128
0

Here's a solution that borrows from Write content of box to a file

I've used the etoolbox to wrap the align and equation environment with

% surround the align environment with
%   \begin{lrbox}{\mybox}
%       \begin{minipage}{\linewidth}
% 
%       CONTENT
%       
%       \end{minipage}
%   \end{lrbox}

which saves the content to the box \mybox; the content is of course outputted to the screen, but it is also saved for use later on in the box \savedeqns

screenshot

\documentclass{beamer}
\usepackage{amsmath}
\usepackage{etoolbox}

% to store the contents of a SINGLE equation
\newsavebox{\mybox}

% to store the contents of ALL of the equations
\newbox\savedqns
\setbox\savedqns\vbox{}

% surround the align environment with
%   \begin{lrbox}{\mybox}
%       \begin{minipage}{\linewidth}
% 
%       CONTENT
%       
%       \end{minipage}
%   \end{lrbox}
\BeforeBeginEnvironment{align}{\begin{lrbox}{\mybox}\noindent\begin{minipage}{\linewidth}}
\AfterEndEnvironment{align}{%
        \end{minipage}%
        \end{lrbox}%
        \vspace{\abovedisplayskip}%
        \noindent\usebox{\mybox}%
       % save the equations for later
         \global\setbox\savedqns\vbox{%
           \unvbox\savedqns
             \bigskip
               \filbreak
                 \noindent\usebox{\mybox}}%
        }

% do the same for the equation environment
\BeforeBeginEnvironment{equation}{\begin{lrbox}{\mybox}\noindent\begin{minipage}{\linewidth}}
\AfterEndEnvironment{equation}{%
        \end{minipage}%
        \end{lrbox}%
        \vspace{\abovedisplayskip}%
        \noindent\usebox{\mybox}%
       % save the equations for later
         \global\setbox\savedqns\vbox{%
           \unvbox\savedqns
             \bigskip
               \filbreak
                 \noindent\usebox{\mybox}}%
        }


\begin{document}

\begin{frame}{An align environment...}
\begin{align}
  y&=x^2+2\\
  &=2+x^2
\end{align}
\end{frame}

\begin{frame}{An equation environment...}
\begin{equation}
  y=mx+b
\end{equation}
\end{frame}

\begin{frame}{My very important equations- SUMMARY}
\unvbox\savedqns
\end{frame}
\end{document}
David Carlisle
  • 757,742
cmhughes
  • 100,947