As title goes, I want to find a way to get the access of the words inside the environment. To be exactly, given some command \operate with one variable, I want to define an environment foo such that
\begin{foo}
This is the inside words.
\end{foo}
outputs like \operate{This is the inside words. }.
Roughly speaking, I want a command help me get access to the words between \begin{foo} and \end{foo}.
This problem is fundamentary in some ways.
- If the command is empty, it is just what the package
commentdid. (Note that it is impossible to define\newenvironment{comment}{\iffalse}{\fi}, since the expansion of\fiis later than\iffalse) - If the command is
\fbox{#1}, it is just what the packagemdframeddid. This answer explain why it is not easy .
I try to figure out a solution as follow
\newenvironment{foo}{}{\endgroup}
\long\def\foo#1\end{\begingroup\noindent\fbox{\vbox{#1\unskip}}\end}
\begin{foo}
This is the inside words.
\end{foo}
But the problem is that we cannot use other environment inside this environment.
environpackage does this. – schtandard Sep 09 '19 at 15:17\NewEnviron(from theenvironpackage), the contents of the argument are contained in\BODY. You can likely, in the environment, say\expandafter\operate\expandafter{\BODY}to get\operateto operate on the contents of\BODY.. – Steven B. Segletes Sep 09 '19 at 15:25\verb|This is verbatim|also? (That is something the environ-packe does not afaik.) – Ulrich Diez Sep 09 '19 at 19:11\endlinechar-thingie come into being at the ends of lines, e.g., at the end of the line\begin{foo}or at the end of the last line within the environmentfoo? – Ulrich Diez Sep 09 '19 at 19:17