I am getting an error while trying to compile this minimal example:
min.cls:
\ProvidesClass{min}
\LoadClass{minimal}
\NeedsTeXFormat{LaTeX2e}
\newenvironment{myenv}{}{
\def\aaa{test }
\expandafter\def\csname bbb\endcsname{$4\sqrt{2}$}
\bbb
\edef\aaa{\aaa \bbb}
\aaa
}
\endinput
mintest.tex:
\documentclass{min}
\begin{document}
\begin{myenv}
Test
\end{myenv}
\end{document}
Running latex over mintest.tex produces this error:
ERROR: Use of \@sqrt doesn't match its definition.
--- TeX said ---
\@ifnextchar ...eserved@d =#1\def \reserved@a {#2}
\def \reserved@b {#3}\futu...
l.7 \end{myenv}
Peculiar. I want to expand the definition of \aaa by concatenation. Any thoughts?
\edef. It's difficult to say more from your example, but\protected@edef\aaa{\aaa\bbb}should work. – egreg Oct 29 '12 at 10:07