본문에 캡션 텍스트 삽입

본문에 캡션 텍스트 삽입

\ref명령은 다음 코드와 같이 테이블 번호만 참조할 수 있습니다.

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

\ref캡션 텍스트를 본문 ([[여기]] 위치) 뒤에 삽입하고 싶습니다 .

좋다

표 1: "표의 캡션"에 따르면, 우리는 어쩌고 저쩌고 합니다.

아니다

표 1에 따르면, 우리는 어쩌고 저쩌고.

본문에 캡션 텍스트를 삽입하는 방법이 있나요?

답변1

예를 들어 캡션(및 섹션 ...) 제목을 참조하기 위한 패키지 nameref또는 제공은 다음과 같습니다.titleref

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

결과

패키지 포함 titleref:

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

추가 힌트는 주석을 참조하세요.

관련 정보