Inserir texto da legenda no corpo

Inserir texto da legenda no corpo

O \refcomando pode referir-se apenas ao número da tabela, como o código a seguir.

\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}

Gostaria de inserir o texto da legenda no corpo após \ref(a posição [[AQUI]]).

como

Conforme Tabela 1: “A legenda da tabela”, a gente blá blá.

Não

De acordo com a Tabela 1, blá, blá.

Existe alguma maneira de inserir texto de legenda no corpo?

Responder1

Por exemplo, empacota namerefou titlereffornece para fazer referência ao título das legendas (e seções, ...):

\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}

Resultado

Com pacote titleref:

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

Veja também os comentários para dicas adicionais.

informação relacionada