Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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???

share|improve this question
1  
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
2  
You may want to look at tex.stackexchange.com/questions/67550/… –  David Carlisle Oct 2 '12 at 0:15
add comment

1 Answer

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]
\begin{equation}
  y=mx+b
\end{equation}
\lipsum[2]
\begin{equation}
  y=ax^2+bx+c
\end{equation}
\lipsum[1]
\begin{equation*}
  y=mx+b
\end{equation*}
\lipsum[1]

\section*{Copied equations}
\unvbox\savedqns

\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.