
此\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
(位置 [[HERE]])之後。
喜歡
根據表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{...}...
另請參閱評論以獲取其他提示。