0

Known feature of \caption is:

\caption[Text for the list of figures]{Text under the figure} 
\label{fig:theReference}

Target is to include more arguments in \caption and have this arguments displayed on a table

\begin{tabular}{ | m{3cm} | m{4cm}| m{4cm} | m{4cm} |} 
\hline
Fig number & Diplay here the text for the list of figures & Display here the text under the figure & Display here other text which is a new argument for the caption \\
\hline
\ref{fig:theReference} & How to? & How to? & How to? \\
\hline
\end{tabular}

enter image description here

2
  • Are you open to creating your own \caption-like command, like \mycaption[<LoF>]{<regular caption>}{<other argument>}?
    – Werner
    Commented Aug 17, 2018 at 5:10
  • Certain document classes and packages limit what you can do with captions, but let's assume that isn't the case. You don't need to put the tabular INSIDE the \caption, Adding it after the \caption will work just fine. The function of \caption is mostly to increment the figure counter and add the caption to the LOF, and you don't want the tabular going to the LOF anyway. Commented Aug 17, 2018 at 14:42

1 Answer 1

0

Some kind of automation

\documentclass[a4paper, 12pt]{article}
\usepackage{mwe}
\usepackage{array}
\usepackage{xparse}

\makeatletter
\def\tableau{}
\NewDocumentCommand{\mycaption}{mO{#3}mO{#3}}{%\mycaption{label}[caption for lof (default = caption)]{caption}[optional other text (default = caption)]
    \caption[#2]{#3}
    \label{#1}
    \g@addto@macro{\tableau}{\ref{#1} & #2 & #3 & #4\tabularnewline}
}
\makeatother
%
\begin{document}
    \listoffigures
    \section*{Introduction}
    \begin{figure}[h!]
        \centering
        \includegraphics[width=.7\linewidth]{example-image}
        \mycaption{fig:theReference}[Text for the list of figures]{Text under the figure}[Other text]
    \end{figure}

    \begin{figure}[h!]
        \centering
        \includegraphics[width=.7\linewidth]{example-image-a}
        \mycaption{fig:theReferencea}[Text for the list of figures a]{Text under the figure a}
        %           \label{fig:theReference}
    \end{figure}

    \begin{tabular}{|m{3cm}|m{4cm}|m{4cm}|m{4cm}|} 
        \hline
        Fig number & Diplay here the text for the list of figures & Display here the text under the figure & Display here other text which is a new argument for the caption \\
        \hline
        \tableau
    \end{tabular}
\end{document}
4
  • Your solution works, just add \label{#1} after \caption[#2]{#3}
    – rcomander
    Commented Aug 20, 2018 at 15:10
  • Shame on me… ;)
    – NBur
    Commented Aug 21, 2018 at 7:34
  • No shame at all, it really helped. Some visual fixes for the horizontal lines, added a \hline after "\g@addto@macro{\tableau}{" to draw the table and moved the \hline at the end of the file after the call to \tableau to have the last horizontal line of the table. Thanks a lot.
    – rcomander
    Commented Aug 21, 2018 at 9:23
  • As you are dealing with visual effects, I recommend to have a look at Mori's paper and booktabs documentation
    – NBur
    Commented Aug 21, 2018 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .