What I want is something like this:
\hidemyenvironment \begin{myenvironment} This text is not displayed, it is "hidden". \end{myenvironment} \showmyenvironment \begin{myenvironment} This text is visible! \end{myenvironment} I want the command \hidemyenvironment to make it not appear on the PDF, while the command \showmyenvironment will make it reappear again. I was thinking of using an if statement so I can switch it on and off in the document and have some environments displayed and others hidden.
Here is a MWE:
\documentclass{article} \usepackage[utf8]{inputenc} \makeatletter \newif\if@hidemyenvironment \newcommand{\hidemyenvironment}{\@hidemyenvironmenttrue} \newcommand{\showmyenvironment}{\@hidemyenvironmentfalse} \newenvironment{myenvironment}{ \if@hidemyenvironment % some code to ignore the environment? \else % just show whatever is in the environment/ do nothing \fi }{} \makeatother \begin{document} Hello!\par \hidemyenvironment \begin{myenvironment} Hidden text! \end{myenvironment} \par \showmyenvironment \begin{myenvironment} \begin{equation} x+y=z \end{equation} \end{myenvironment} \end{document} Is there perhaps a command that can comment everything inside the environment, or another solution? I would prefer that you can write equations, tables and other things inside the environment and that it is only used to hide/ display parts of the output PDF.
The output of the MWE should be:
