0

I am trying to define captions in longtable enviroment. According to Adding a caption to a graphic inside a longtable I should define:

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

and then use

 \figcaption{my caption}

However defining \figcaption produce the following error in texstudio: "Illegal parameter number in definition of \figcaption." I think there is a conflict with some package... maybe hyperref ? What can I do?

EDIT

Thanks to David Carlisle there was a missing '}' However, corrected the definition, and adding

\figcaption{lol} 

after

\includegraphics[keepaspectratio,width=0.1\linewidth]{image}

gives a new errors: You can't use `\hrule' here except with leaders. \figcaption{lol} Missing number, treated as zero. \figcaption{lol} Illegal unit of measure (pt inserted). \figcaption{lol} Missing \endgroup inserted. \figcaption{lol} ....

What happened??

  • 1
    Please provide a full MWE that generates the problem behavior you're looking to fix. Please be sure to state which TeX distribution you use, which packages you load, and a minimal longtable environment that contains a \figcaption statement. – Mico Apr 8 '15 at 2:35
  • Your sample definition is missing a closing } it has four { and only three } – David Carlisle Apr 8 '15 at 7:36
  • 1
    hmm Just saw where you copied that from:-) I fixed it there. – David Carlisle Apr 8 '15 at 7:38
2

I solved the problem: the trick is use \parbox{..} e.g.:

\parbox{5cm}{
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) { \includegraphics[scale=0.8]{image} };
\end{tikzpicture}
\figcaption{label: lol.}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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