[Tex/LaTex] How to exclude text portions by simply setting a variable or option

macrostext manipulation

I'm writing a document where some text portions are confidential and would therefore like to create an environment (e.g. confidential) which I can then exclude from the PDF by simply setting a variable or option.

Is there any way of doing this in LaTeX, or better yet, is there a package for this?

Best Answer

You want the comment package. This provides the \includecomment and \excludecomment macros:

\documentclass{article}
\usepackage{comment}
\excludecomment{confidential}
\begin{document}
Some text

\begin{confidential}
Some secret text
\end{confidential}

\end{document}
Related Question