Suppose I want to define an environment which is essentially a modification of an existing one. I tried something like that:
\newenvironment{newenv}{%
\formatcommand{\begin{oldenv}%
}{%
\end{oldenv}}%
}
I would expect
\begin{newenv}Foo\end{newenv}
to result in the same output as
\formatcommand{\begin{oldenv}Foo\end{oldenv}}
But whenever I use \begin{newenv}
, pdflatex
says
Missing } inserted
and skrews up everything afterwards, of course. Without \formatcommand
everything is fine, so apparently the orphan {
form \formatcommand
is the culprit.
My guess is that pdflatex
tries to treat stuff inside environment definition parts as something syntactically correct---which what I do clearly is not---instead of "just" to replace text and parse afterwards.
Is there a way to get around this, i.e. have a command span from a new environments beginning to end?
Use case:
\newenvironment{card}{%
\resizebox{55mm}{85mm}{\begin{tabular*}{55mm}{| p{50.5mm} |}%
\hline%
}{%
\hline\end{tabular*}}%
}
If I put the same resizebox
around the usage site of card
, it compiles and resizes (even though not the way I intended, but that's for another day).
\begin{oldenv}
to\formatcommand
?\formatcommand
is supposed to do and on whatoldenv
is. A "real world" example is needed.\formatcommand
applied to the whole environmentoldenv
. As I repeatcard
often in the application and need the same resize, I figured an environment def would be the place to put it.