参照表格

参照表格

所以我有以下想要参考的表格。

\begin{table}

{\captionof{table}\\
\begin{center}\textbf{Calculation variables} \end{center}\\    \footnotesize{Each variable is calculated according to the proper equation. We tabulated the equations for each of the variables. In the first column we included all the categories in which all the variables fall in. For every variable we formulated an abbreviation, these are included in the second column of the table. The last column shows all the equations that were used to calculate the variables for each company.}}

\label{tab:datavariables}

\begin{tabular}{ccccccc}

\end{tabular}

当尝试在文本中引用它时(使用\ref{tab:datavariables}),它只会返回“??”。我该怎么办。

答案1

您的代码似乎过于复杂。特别是,由于您正在使用table环境,因此似乎没有理由使用\captionof而不是\caption。另一件事:该指令\footnotesize是一个 switch,即它不接受参数。

请仔细研究以下代码;我希望它能够实现您想要实现的目标。

\documentclass{article}
\usepackage[font=bf,skip=0.333\baselineskip]{caption} % typeset captions in bold
\begin{document}

\begin{table}
\caption{Calculation variables}
\label{tab:datavariables}

{\footnotesize Each variable is calculated according to the proper equation. 
We tabulated the equations for each of the variables. In the first column we 
included all the categories in which all the variables fall in. For every 
variable we formulated an abbreviation, these are included in the second 
column of the table. The last column shows all the equations that were used 
to calculate the variables for each company.\par}

\medskip\centering
\begin{tabular}{ccccccc}
\hline
a & b & c & d & e & f & g \\
\hline
\end{tabular}
\end{table}

A cross-reference to Table \ref{tab:datavariables}.
\end{document}

与所有 LaTeX 交叉引用问题一样,请务必编译两次以解决交叉引用问题。

相关内容