I have a custom table-environment defined with \newenvironment. I have a caption in this environment, but I want to have it at the end.
My environment looks (a little simplified) like this:
\newenvironment{mytable}[2]{\begin{table}[hbtp]\caption{#1}\label{#1}\begin{center}\begin{tabular}{#2}}{\end{tabular}\end{center}\end{table}}
I want to put the caption at the end, like this:
\newenvironment{mytable}[2]{\begin{table}[hbtp]\label{#1}\begin{center}\begin{tabular}{#2}}{\caption{#1}\end{tabular}\end{center}\end{table}}
But that doesn’t work, because I cannot use the parameters in the end of the environment. How can I solve this problem?
You’ll want to store the caption and label parameters and use them later. (Also, the \label should appear after the \caption.)
Something like this should work:
Use the environment like this:
I haven’t tested this code.