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

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}

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}

The wide variety of possibilities makes this solution most flexible.
Included environments never form groups in ‘comment’, here user may choose whether they form groups or not, at least for simple including (not with marks). ‘comment’ includes by writing on and reading from disk, present package needs no writing on disk… ‘Comment’ sometimes produces wrong spaces and discovers ‘\end{comment}’ only if nothing else is in the input line.
– Franck Pastor
Feb 25 '15 at 09:49
proof and thm environments with external environments (prop and dem) in order to be excluded or included through versions package. Is not possible to use \excludeversion{thm}?
– Ignasi
Feb 25 '15 at 10:32
\excludeversion{thm} with would result in the disappearance of every thm environments, but if you use \includeversion{thm} then only the contents of thm environments would be printed, without any feature coming from the amsthm package. For this reason, and at the cost of some more lines in my programs, I prefer surrounding the thm environment by another defined with versions (as dem here).
– Franck Pastor
Feb 25 '15 at 11:12
versions. I didn't know it.
– Ignasi
Feb 25 '15 at 11:30
proofenvironment? – egreg Feb 25 '15 at 09:02commentpackage and\excludecomment{proof}. – Ignasi Feb 25 '15 at 09:03