# How to get caption of figure/table using table reference?

How can I get the caption of figures and tables using their references?

Something along the lines of \refcaption{tab:mytable} would print This is a pretty table., which is the caption of the table below.

\documentclass{article}
\usepackage{booktabs,longtable,tabu}
\begin{document}

\begin{longtabu}{lll}
\toprule
h1 & h2 & h3 \\
\midrule
\bottomrule
\caption{This is a pretty table.}
\label{tab:mytable}
\endlastfoot
a & b & c \\
d & e & f \\
\end{longtabu}

Table~\ref{tab:mytable} looks good and its description is the following: \textbf{HOW TO GET DESC?}.

\end{document}

-
this facility may be provided by the nameref package. check the package documentation for more information. (i've never used the package for that purpose, so i'm not sure whether this selection really works.) – barbara beeton Apr 3 '14 at 14:31
@barbarabeeton: \nameref{tab:mytable} yields This is a pretty table, which is what I was looking for. – user3371321 Apr 3 '14 at 14:41

Here you have something to play around with. I hope, you were planing to use the package hyperref.

\documentclass{article}
\usepackage{booktabs,longtable,tabu}
\usepackage{csquotes}
\usepackage{hyperref}
\begin{document}

\begin{longtabu}{lll}
\toprule
h1 & h2 & h3 \\
\midrule
\bottomrule
\caption{This is a pretty table.}
\label{tab:mytable}
\endlastfoot
a & b & c \\
d & e & f \\
\end{longtabu}

\autoref{tab:mytable} looks good and its description is the following: \enquote{\nameref{tab:mytable}.} You can also have a look at \Nameref{tab:mytable}
\end{document}

-
The full document is using hyperref. Thanks! – user3371321 Apr 3 '14 at 14:42
Just \usepackage{nameref} would be sufficient; but hyperref loads it. – egreg Apr 3 '14 at 16:31