In the functional programming paradigm, it is common to have functions accept other functions as parameters. This paradigm can be followed in LaTeX, too: A macro can accept parameters which themselves can be macros or environment names. For this use case, the equivalent of an "identity function" is missing in LaTeX: A macro and an environment that behaves as if it wasn't there.
Basically, I am looking for something along these lines:
\documentclass{article}
\begin{document}
\newenvironment{identity}{}{}
\begin{identity}
This will be parsed as if not surrounded by anything.
\end{identity}
\end{document}
I'm reluctant to define this environment if something similar already exists in standard LaTeX or in any "standard" package. How is "identity" called in LaTeX?
verbatim
environment.\begin{foo}
uses\foo
and\end{foo}
uses\endfoo
if it exists, it is OK but usually not recommend to use a macro name as environment, i.e. you could simply use\begin{relax} .. \end{relax}
or\begin{empty} .. \end{empty}
and take advantage of\relax
and\empty
. Both are basically no-op macros, which\empty
expands to nothing but\relax
is not expandable and represents a lower-level no-op.empty
environment works for me,relax
didn't work as LaTeX complained that\endrelax
is undefined.