# Writing Notes, want my equations organized at the end of document

I'm writing up my textbook notes in LateX. As I am writing paragraphs, I am inserting equations while I'm writing.

I want to somehow display all of my numbered equations at the end of my document in the same order that they were numbered. Is there a way to easily do this in LaTex with an unknown command that I might not know???

-
Welcome to TeX.SE. It might be helpful to know how you are producing your document as the solutions might depend on that. – Peter Grill Oct 1 '12 at 21:10
You may want to look at tex.stackexchange.com/questions/67550/… – David Carlisle Oct 2 '12 at 0:15

This solution borrows very heavily from David Carlisle's solution to Write content of box to a file

The idea is to renew the equation environment so that it not only outputs to the page, but its contents are also written to a vbox that is outputted at the end of the document.

You can extend the idea easily to other environments (such as align, for example).

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum}

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

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

% we're going to renew the equation environment
% using the original definition as a base
\let\oldeqn\equation
\let\oldendeqn\endequation

% renew the equation environment
\renewenvironment{equation}{%
\begin{lrbox}{\mybox}%
\begin{minipage}{\linewidth}%
\oldeqn%\begin{equation*}
}
{%
\oldendeqn%\end{equation*}
\end{minipage}%
\end{lrbox}%
% output the box to the page
\vspace{\abovedisplayskip}%
\noindent\usebox{\mybox}%
\vspace{\belowdisplayskip}%
% save the equations for later
\global\setbox\savedqns\vbox{%
\unvbox\savedqns
\bigskip
\filbreak
\noindent\usebox{\mybox}}
}

\begin{document}

\lipsum[1]
$$y=mx+b$$
\lipsum[2]
$$y=ax^2+bx+c$$
\lipsum[1]
\begin{equation*}$$y=mx+b$$\end{equation*}
\lipsum[1]

\section*{Copied equations}
\unvbox\savedqns

\end{document}

-