3

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}
}
tschm
  • 199

1 Answers1

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

David Carlisle
  • 757,742