2

This question already has an answer here:

This is my first attempt to define my own environment. I fail with the number of parameters. LateX complains Illegal parameter number in definition of endperformance. This should be a standard textbook example but I can't see what I am doing wrong.

\newenvironment{performance}[1]
{
\begin{table}[ht]
\begin{tabular}
{llllllll}  
\toprule
{} &   {Return} & {Annua Return} & {Volatility} & {Sharpe Ratio} & {Max DD} & {YTD}  & {2015}\\
}
{
\bottomrule
\end{tabular}
\caption{#1}
\end{table}
}

marked as duplicate by egreg environments Jan 22 '16 at 13:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

You can not use the arguments in the end code, but you can save the caption: start the begin code with

\def\savedcaption{\caption{#1}}%

then replace your existing \caption{#1} in the end code with \savedcaption

Not the answer you're looking for? Browse other questions tagged or ask your own question.