I am writing macros to help in the description of an API. I have one environment and one command
The command accumulate informations in a macro used by the closing part of the environment to display the informations in good order:
The environment is as follow :
Code: Select all
\newenvironment{arguments}{%
\def\arglist{}
\def\empty{}
\def\argdesc{}
}
{
{\tt \servicereturn\ \servicename(\arglist);}
{\bf Arguments of \servicename\ are:}
\argdesc
}
Code: Select all
\newcommand{\argument}[3]{%
\edef\argdesc{\argdesc\par\begingroup\hangindent=2em\hangafter=1 #2 #3\par\endgroup}
\ifx\arglist\empty
\def\arglist{#1 #2}
\else
\edef\arglist{\arglist, #1 #2}
\fi
}
Code: Select all
\begin{arguments}
\argument{TaskType}{TaskID}{the id of the task}
\argument{EventMaskType}{Mask}{the event mask}
\end{arguments}
Code: Select all
\edef\argdesc{\argdesc\par\begingroup\hangindent=2em\hangafter=1 #2 #3\par\endgroup}
I get an error :\edef\argdesc{\argdesc\par\begingroup\hangindent=2em\hangafter=1 {\tt #2} #3\par\endgroup}
If I use \texttt, I get a different error :! Missing control sequence inserted.
<inserted text>
\inaccessible
l.73 \end{arguments}
I tried to use \protect before #2 but it does not change anything.! Undefined control sequence.
<argument> \@nil
l.72 ...e}{TaskID}{The id of the task to activate}
I am a little bit lost and need a TeX guru
