I have a custom environment for handling a code interface declaration that is specified as:
\begin{decl}{FOO}
\param{in}{bar} the bar input parameter
\param{out}{baz} the baz input parameter
\end{decl}
This is being typeset as a nested list by my package (note: reality is much more complicated, but this captures the idea, mostly).
\newrobustcmd*{\param}[2]{
\item[#1 #2]
}
\newenvironment{decl}[1]{
\begin{enumerate}
\item #1(<param names here>)
\begin{description}
}{
\end{description}
\end{enumerate}
}
My problem is that I need to accumulate the \param names, and then in the \end{decl} handler I need to inject them in the location tagged as <param names here>. Unfortunately, I don't know the list I want to inject at the time that I'm generating that item.
Is there a canonical way to do this?
I was considering using the etoolbox list functionality to build internal lists as I process \params, and then generating the whole enumerate structure in the \end{decl} handler, but I don't know how to capture the "description" \parbox for the \param for use later without using \par, which as far as I know requires a paragraph break between \param items, which doesn't exist in the source. I could introduce a third parameter to \param such that the description can be dealt with as a third parameter, but this involves quite a large change to the .tex source base.
I'd really prefer a way to \appto a command used in place of <param names here>, but this doesn't seem to work because use of the \apptoed command is eagerly expanded in the \begin{decl} handler and the appended strings aren't getting used.



\documentclass{...}and ending with\end{document}? Include also an example how you use your environment/command and how it should look like. And: The syntax for\newenvironmentis backslash-less:\newenvironment{decl}…– Qrrbrbirlbel Mar 28 '13 at 16:50