[Tex/LaTex] Remove all proof environments

amsthmenvironments

I have a document containing some proofs and want to create a version only containing the theorems (and corollaries and lemmas and examples and …), but no proofs at all.

Is there an easy, automatic way to do that?

Best Answer

I personally use the versions package for this kind of work.

\documentclass[12pt]{scrartcl}
\usepackage{amsthm}
    \newtheorem{thm}{Theorem}

\usepackage{versions}
    \includeversion{prop}
    %\excludeversion{prop}
    \includeversion{dem}
    %\excludeversion{dem}

\usepackage{mathtools, amssymb, amsthm}

\begin{document}
\begin{prop}
    \begin{thm}
        \( (a+b)^2 = a^2 + 2ab + b^2\).
    \end{thm}
\end{prop}
\begin{dem}
    \begin{proof}
        \( (a+b)^2 = (a+b)(a+b) = a^2 + ab + ba + b^2 = a^2 + 2ab + b^2 \).
    \end{proof}
\end{dem}
\end{document}

Since I've commented here both \excludeversion{prop} and \excludeversion{dem} out, both thm and proof environments appear:

enter image description here

But if I choose to comment \includeversion{dem} and comment out \excludeversion{dem}, it makes the proof disappear.

\usepackage{versions}
    \includeversion{prop}
    %\excludeversion{prop}
    %\includeversion{dem}
    \excludeversion{dem}

enter image description here

The same will apply to all your proof environments if you've enclosed them in this dem environment defined by versions.

To the contrary, you can choose to make the proof environments stay and the thm environments vanish if you apply the same maneuver to those thm environment (enclosing them in the prop environment defined by versions, commenting in/out the adequate lines:

\usepackage{versions}
    %\includeversion{prop}
    \excludeversion{prop}
    \includeversion{dem}
    %\excludeversion{dem}

enter image description here

The wide variety of possibilities makes this solution most flexible.

Related Question