# Insert caption text to body

The \ref command can refer only the number of the table, like the following code.

\documentclass{article}
\begin{document}
According to Table \ref{table} [[HERE]], we blah blah.
\begin{table}[tb]
\caption{The caption of the table}
\label{table}
\begin{center}
\begin{tabular}{ll}\hline foo & bar \\ \hline\end{tabular}
\end{center}
\end{table}
\end{document}


I would like to insert the caption text into body after \ref (the position [[HERE]]).

like

According to Table 1: "The caption of the table", we blah blah.

Not

According to Table 1, we blah blah.

Are there any ways to insert caption text into body?

For example, packages nameref or titleref provides to reference the title of captions (and sections, ...):

\documentclass{article}
\usepackage{booktabs}% nicer table lines
\usepackage{nameref}
\usepackage{csquotes}% quotes with multilingual support
\usepackage{caption}% fixes the spacing around caption for tables
\begin{document}
According to Table \ref{table} \enquote{\nameref{table}}, we blah blah.
\begin{table}[tb]
\centering % avoids additional vertical space of environment center
\caption{The caption of the table}
\label{table}
\begin{tabular}{ll}
\toprule
foo & bar \\
\bottomrule
\end{tabular}
\end{table}
\end{document}


With package titleref:

\usepackage{titleref}
...\titleref{...}...


• LyX users only: Simply select the "Textual reference" format in the Cross-reference dialog (this use nameref in the background, do not mess with the LaTeX preamble for this).
• And I found that you are one of the main­tainers of nameref! Thank you again for making useful pakcage! (and one of my friends also appreciates that.) Mar 27 '16 at 13:24