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

In a .tex file, there is some self defined command

\mycomment{blah blah}

I hope to be able to skip the command during compilation in my final version, but still compile it in versions before my final version. Are there any ways to do that?

share|improve this question
do you just mean change to \newcommand{\mycomment}[1]{} for the final version? Or something else? – David Carlisle Apr 14 '13 at 23:16
@David: In the final version, \mycomment{blah blah} will be ignored during compilation. – Tim Apr 14 '13 at 23:22
The definition I suggested in the first comment does that, it defines the command to take the argument and do nothing with it – David Carlisle Apr 14 '13 at 23:25

Another fairly intuitive method, particularly if you have several large blocks of code which you want to include in some compilations but not others is the comment package (also saves a lot of time if you are writing a very large manuscript, but only working on a small bit at a time). However its great for small toggles too.




share|improve this answer
\mycomment{blah blah}

And you have Boolean values \finaltrue and \finalfalse. For development versions set \finalfalse somewhere in the preamble after \newif\iffinal, for the final compilation set \finaltrue, or set both and comment out the inactive Boolean:

% \finaltrue
share|improve this answer
BTW I find the bools or toggles from etoolbox much more convenient. – Speravir Apr 14 '13 at 23:39

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.