B
B
Boris Dergachev2015-08-13 13:21:31
TeX
Boris Dergachev, 2015-08-13 13:21:31

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 \defvariable and equals true.
For example:

\usepackage{ifthen}
% ...
\def\showmyenv{true}
% ...
\newenvironment{myenv} {
    \ifthenelse{ \equal{\showmyenv}{true} } {
        % отобразить содержимое окружения
    }{
        % не отображать содержимое окружения
    }
} {}

How to specify that the content between \begin{myenv}and is not displayed \end{myenv}?
The need is that I need to generate several documents, one of which will not contain the specified blocks.
Are there alternative options?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Dergachev, 2015-08-19
@froex

I decided to rewrite the code so as not to use capacious constructions \ifthenelseinside 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 question

Ask a Question

731 491 924 answers to any question