I would like to extend again a bit further my extended figure caption to account for tables as well. Previous questions are
Hypertarget pointing at \thefigure
Automatically "protect" new paragraph in extended figure caption
What the macro does is, defining a command \extcaption{Some extended information about the current figure} to be placed into a figure float, whose content is written into a .efc file then printed somewhere at the end of the document by a command \printextcaption.
To extend it to tables, I do not think I need to recall all the code as, essentially, I would need a function (called \checkwhichfloat in the MWE) that is able to detect in which float it is called, and return the appropriate counter and string.
Here is the code:
\documentclass[10pt]{report}
\newcommand\efccounter{}
\newcommand\efctext{}
% \newcommand\checkwhichfloat{
% If figure
\renewcommand\efccounter{\thefigure}
\renewcommand\efctext{Figure}
% else if table
\renewcommand\efccounter{\thetable}
\renewcommand\efctext{Table}
%
\begin{document}
\begin{figure}
%\checkwhichfloat
\caption{This is \efctext~\efccounter}
\end{figure}
\begin{table}
%\checkwhichfloat
\caption{This is \efctext~\efccounter}
\end{table}
\end{document}
\@captypecontains the current floating environment name. – Dec 07 '15 at 19:57