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?

  • 1
    Did you use the proof environment? – egreg Feb 25 '15 at 9:02
  • 4
    You can use comment package and \excludecomment{proof}. – Ignasi Feb 25 '15 at 9:03
  • use this answer: tex.stackexchange.com/questions/106457/… – akraf Feb 25 '15 at 9:06
  • @egreg: Yes, I do. – Keba Feb 25 '15 at 9:36
  • @Ignasi: Thanks, that seems to be very easy. :) – Keba Feb 25 '15 at 9:37

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



\usepackage{mathtools, amssymb, amsthm}

        \( (a+b)^2 = a^2 + 2ab + b^2\).
        \( (a+b)^2 = (a+b)(a+b) = a^2 + ab + ba + b^2 = a^2 + 2ab + b^2 \).

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.


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:


enter image description here

The wide variety of possibilities makes this solution most flexible.

| improve this answer | |
  • Thanks, but does version have any advantages over comment? – Keba Feb 25 '15 at 9:38
  • 1
    Excerpt from the documentation: 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 9:49
  • @fpast From your answer (and a quick test) I understand that we need to surround 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
  • @Ignasi Yes, it is possible to use \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
  • @fpast Understood. Thank you for this reference to versions. I didn't know it. – Ignasi Feb 25 '15 at 11:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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