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? – user36296 Dec 18 '18 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 Dec 18 '18 at 15:55
  • I think that the comment package is perfect for this... osl.ugr.es/CTAN/macros/latex/contrib/comment/comment.pdf – Rmano Dec 18 '18 at 16:14

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/

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.