I am trying define a environment that displays a text specified by the parameter of the environment. The following example demonstrates it:
\documentclass{article}
\usepackage{environ}
\usepackage{etoolbox}
\csdef{bla1}{Bla1Text}
\csdef{bla2}{Bla2Text}
\NewEnviron{myenv}[1][]{%
env: #1
\csuse{bla#1} % does not work
\BODY
}
\begin{document}
\csuse{bla1}\\ % works as expected
\begin{myenv}{1} body1 \end{myenv} \\
\begin{myenv}{2} body2 \end{myenv}
\end{document}
Is \NewEnviron
incompatible with the etoolbox
package or is there a possibility to fix my code above?
Note: In a regular environment \csuse
works without problems but I want to change the behavior of the environment so that it hides the content if the \csuse
variable is defined or not and this can AFAIK only be done using \NewEnviron
. And changing \csuse
is not an option as it is already used widely in my real document.