2
\documentclass{article}
\RequirePackage{longtable,nameref}

\begin{document}

\begin{longtable}[t]{l l} 
    \caption{Table caption.}
    \label{tab:table1}

    \\ a & b
    \\ c & \textit{\nameref*{tab:table1}}

\end{longtable}         

\end{document}

Is it possible to use the caption of the current table in one cell without typing its label tab:table1, but rather using a "self-reference" like \currentlabelname -- provided that only one label and one caption are created in the current table environment?

1 Answer 1

3

Package nameref stores the titles in macro \@currentlabelname. However, it is stored locally, therefore it needs to be assigned to a global macro for use in other table cells:

\documentclass{article}
\RequirePackage{longtable,nameref}

\begin{document}

\begin{longtable}[t]{l l}
    \caption{Table caption.}
    \label{tab:table1}
    \global\expandafter
    \let\expandafter\captiontitle\csname @currentlabelname\endcsname
    \\ a & b
    \\ c & \textit{\captiontitle}

\end{longtable}

\end{document}

Result

You must log in to answer this question.

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