TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Below is part of the code for my notes. I would like to "easily" create a new document displaying only the definitions, theorems, and lemmas. I can copy and paste this and just delete what I do not want, but if there is an easier way, that would be great.


\usepackage{amsmath}    % just math
\usepackage{amssymb}    % allow blackboard bold (aka N,R,Q sets)
\usepackage{amsthm} % allows thm environment
\usepackage{graphicx, framed} % allows graphics
\usepackage[none]{hyphenat} % allows graphics
\definecolor{Nt}{rgb}{1,0.08, 0.58}
\linespread{1.6}    % double spaces lines

\textwidth 6.5truein  % These 4 commands define more efficient margins
\textheight 9.4truein
\oddsidemargin 0.0in
\topmargin -0.6in

\parskip 5pt  % Also, a bit of space between paragraphs


\newcommand{\QEDend}{\linebreak \begin{flushright}\textbf{QED}\end{flushright}}
\newcommand{\QEDish}{\linebreak \begin{flushright}\textbf{$\approx$QED}\end{flushright}}
\newcommand{\done}{\hfill \mbox{\raggedright \rule{0.1in}{0.1in}}}




\parindent 30pt


\linespread{1.5}    % 1.5 space lines

\section{Course Notes}

%January 23, 2012

\subsection{Metric Spaces}

\begin{definition}The metric space $M$ is a \underline{complete metric space} if every Cauchy sequence is convergent in $M$.

$\bb{R}$ is a complete metric space\done

$C[0,1]$ is a complete metric space with $d(f,g) = \sup \mid f(t) - g(t) \mid$, $t \in [0,1]$.\done

Any closed subset $A$ of a complete metric space $M$ is complete.

Let $A \subset M$ be closed and $<x_n>$ be any Cauchy sequence in $A$. Since $M$ is a complete metric space, $<x_n>$ is convergent in $M$, so $x_n \rightarrow x \in M$. Since $A$ is closed, $x \in A$. Thus, $A$ is complete.

share|improve this question
Please consider adding a minimum working example (MWE) of your code, with more information on what you're trying to achieve. The first and second sentences of your current posting, I'm afraid to say, sound a bit contradictory. Plus, are you using a package such as amsthm or ntheorem? – Mico Feb 27 '12 at 2:01
Mico, I have added some sample code showing the packages I am using and rephrased my question. Sorry about the confusion. – Tyler Clark Feb 28 '12 at 23:29
up vote 4 down vote accepted

Well, there is still some missing info in your MWE, rendering it a MNWE;). But try this:





as the preamble, compile your file and look into the file short.tex. See the documentation of the extract package for more info (this is important - this package messes with internals of LaTeX and will not work for any commands, for example!). Short info: the extract* environment puts its contents into the generated file (and processes them as usual as well); generate defines the name of the generated file, and extract-cmd and extract-env specify what to extract.

Also, consider avoiding \underline and using \emph instead.

share|improve this answer
This works wonderfully. Thank you! – Tyler Clark Feb 29 '12 at 1:51

Your Answer


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.