Is there any command which allows me to make some blocks of text invisible only if initially I said so?

I.e., I would like to mark some lines throughout the text that would only appear in the compiled pdf if in the beggining of the document I said something like: "those blocks of text ON"; and I don't want them to appear if I said something like "those blocks of text OFF".

The purpose of this is to generate two different documents: one with more deitailed information and another one without those details.

Note that this is not the same as the phantom or comment commands.

  • Should the space of such blocks be preserved ? Which documentclass do you use? Does these blocks contain things like labels which are necessary in the remaining text? Commented Dec 18, 2018 at 15:50
  • No, the space should not be preserved, i.e., when I say that I don't want those lines to appear, I really don't want any trace of that text in the compiled document. Also: these blocks of text which I'm refering to are simple text lines: no labels, no pics, etc.
    – AJHC
    Commented Dec 18, 2018 at 15:55
  • I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf
    – Rmano
    Commented Dec 18, 2018 at 16:14
  • Be aware that making the text "invisible" is not the same as making it "not there." If the text in question has private content. some methods for making it "invisible" will still leave the text in the PDF, where it can be extracted. The accepted answer is OK, as is use of comment package.
    – user287367
    Commented Jan 24 at 22:27

5 Answers 5


The simplest way would be to do something like this in the preamble:


and then put all of those lines into that macro like this:

\additionalInfo{I am additional}

If you don't want the lines to show up just replace above macro definition with


Not as elegant as the other answers but in my opinion the simplest solution...


% switch comment to disable additional info
% \newcommand{\additionalInfo}[1]{}

I am always here

\additionalInfo{I am additional}

One possibility is the multiaudience package:


% remove comment from the following line for the long version


normal text
   Text for execs
normal text 


You could use the ifthen package to implement this:




\ifthenelse{\boolean{somevariable}}{Text if somevariable is true.}{Text if somevariable is false.}


I usually do this using new ifs:



See e.g. https://www.bersling.com/2016/05/22/programming-in-latex/


An approach using the version package:




all versions

only in version foo


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .