# How to make my unusual environment accept one argument?

I cannot find a good title to express my question. Therefore, please parse the following code first.

# Minimal Code

\documentclass[dvips,dvipsnames,cmyk,table]{book}
\usepackage[a5paper,margin=20mm]{geometry}
\usepackage{longtable,array,calc}

\usepackage{listings}
\lstset{basicstyle=\scriptsize,tabsize=3}

\usepackage{fancyvrb}
\fvset{tabsize=3}
\newcommand\gtemp[1]{&&#1\tabularnewline\hline}
\newcommand{\args}{}
\newenvironment{Row}[1]
{\renewcommand{\args}{#1}\VerbatimEnvironment\begin{VerbatimOut}{\jobname.tmp}}
{\end{VerbatimOut}\aftergroup\gtemp{\args}}

\newcolumntype{A}
{
>{\begin{minipage}{0.3333\linewidth-2\tabcolsep-2\arrayrulewidth}\vspace{\tabcolsep}}%
c%
<{\vspace{\tabcolsep}\end{minipage}}%
}

\newenvironment{ComparisonTable}%
{%
\begin{longtable}%
{%
|A<{\lstinputlisting{\jobname.tmp}}%
|A<{\input{\jobname.tmp}}%
|A%
|%
}%
\hline\ignorespaces%
}%
{\end{longtable}}

\begin{document}
\begin{ComparisonTable}
%
% Row 1
\begin{Row}%
{
}
$$y=ax^2+bx+c$$
\end{Row}
%
% Row 2
\begin{Row}{LaTeX in action}
\Huge\LaTeXe
\end{Row}
\end{ComparisonTable}
\end{document}


# Objective

I want \Row to accept an argument such that I can change

\begin{Row}
$$y=ax^2+bx+c$$
\end{Row}


to

\begin{Row}{Some description...}
$$y=ax^2+bx+c$$
\end{Row}


How to do this?

-
I think there is a strong hint in this answer: tex.stackexchange.com/questions/7769/… –  Harald Hanche-Olsen Jan 15 '11 at 12:16
@Harald: The business with the & is already solved by the \aftergroup; see the previous question of xport. –  Hendrik Vogt Jan 15 '11 at 12:23
@Hendrik: Um, okay, then. I admit I didn't read the code that carefully. –  Harald Hanche-Olsen Jan 15 '11 at 13:01

OK, there are two problems with the code you posted: 1. \aftergroup can only put one token (here \gtemp) after the group, and your \renewcommand doesn't give a global redefinition, so it won't be in effect after the group. This works:

\documentclass[dvips,dvipsnames,cmyk,table]{book}
\usepackage[a5paper,margin=20mm]{geometry}
\usepackage{longtable,array,calc}

\usepackage{listings}
\lstset{basicstyle=\scriptsize,tabsize=3}

\usepackage{fancyvrb}
\fvset{tabsize=3}
\newenvironment{Row}[1]
{\gdef\gtemp{&&#1\tabularnewline\hline}\VerbatimEnvironment\begin{VerbatimOut}{\jobname.tmp}}
{\end{VerbatimOut}\aftergroup\gtemp}

\newcolumntype{A}
{
>{\begin{minipage}{0.3333\linewidth-2\tabcolsep-2\arrayrulewidth}\vspace{\tabcolsep}}%
c%
<{\vspace{\tabcolsep}\end{minipage}}%
}

\newenvironment{ComparisonTable}%
{%
\begin{longtable}%
{%
|A<{\lstinputlisting{\jobname.tmp}}%
|A<{\input{\jobname.tmp}}%
|A%
|%
}%
\hline\ignorespaces%
}%
{\end{longtable}}

\begin{document}
\begin{ComparisonTable}
%
% Row 1
\begin{Row}%
{
$$y=ax^2+bx+c$$