mercredi 3 décembre 2014

Apply a figure caption inside of a longtable


I'm using the 'longtable' environment to display a number of figures. I'd like to include a caption at the bottom of the first page as a Figure caption, not as a table (so that it also shows up in the list of figures, not list of tables). I found in another post how to define a new 'figcaption', but I'm getting a 'you can't use \hrule here' error when I compile the following code.


It works when I use 'figcaption' outside of the longtable environment, but I need it to be at the bottom of the first page.


Can someone please point me in the right direction?



\documentclass{article}
\usepackage{array}
\usepackage{caption}
\usepackage{longtable}


\makeatletter
\def\figcaption{%
\refstepcounter{figure}%
\@dblarg{\@caption{figure}}}
\makeatother

\begin{document}
\listoftables
\listoffigures

\begin{longtable}[h]{cc}

\endfirsthead
\endhead
\figcaption{This should be a figure caption}\label{fig:MyFigRef}
\endfoot
\endlastfoot

\rule{5cm}{5cm} & \rule{5cm}{5cm} \\
\rule{5cm}{5cm} & \rule{5cm}{5cm} \\
\rule{5cm}{5cm} & \rule{5cm}{5cm} \\
\rule{5cm}{5cm} & \rule{5cm}{5cm} \\
\rule{5cm}{5cm} & \rule{5cm}{5cm} \\
\rule{5cm}{5cm} & \rule{5cm}{5cm} \\

\end{longtable}

\end{document}




Aucun commentaire:

Enregistrer un commentaire