Answer the question
In order to leave comments, you need to log in
How to hide certain environment in latex?
I create my own environment, but in the document it must be hidden if it is defined using a \def
variable and equals true.
For example:
\usepackage{ifthen}
% ...
\def\showmyenv{true}
% ...
\newenvironment{myenv} {
\ifthenelse{ \equal{\showmyenv}{true} } {
% отобразить содержимое окружения
}{
% не отображать содержимое окружения
}
} {}
\begin{myenv}
and is not displayed \end{myenv}
? Answer the question
In order to leave comments, you need to log in
I decided to rewrite the code so as not to use capacious constructions \ifthenelse
inside environments. I left the flag variable, cleared the environment from ifthenelse, and after the environment (or at the end of the preamble) I use the environment redefinition after checking the flag variable.
\usepackage{ifthen}
\usepackage{environ}
% ...
\def\showmyenv{true}
% ...
\newenvironment{myenv} {
% содержимое окружения
}{}
% ...
\ifthenelse{\equal{\showmyenv}{false}}{
\RenewEnviron{myenv}{}
}{}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question