Latex 在桌子外面?

Latex 在桌子外面?,latex,Latex,我正在尝试向latex中的表添加标题,但它会引发以下错误“!latex错误:\caption outside float。” 从这个错误我猜ti意味着它在表外,但我已经清楚地把它放在了表内 \begin{tabular}{|c|c|c|c|c|c|} \caption{Table1} Potentiometer & Resistance & \multicolumn{2}{c}{Calculated V\textsubscript{32}} & \multicolumn

我正在尝试向latex中的表添加标题,但它会引发以下错误“!latex错误:\caption outside float。” 从这个错误我猜ti意味着它在表外,但我已经清楚地把它放在了表内

\begin{tabular}{|c|c|c|c|c|c|}
\caption{Table1}
Potentiometer & Resistance  & \multicolumn{2}{c}{Calculated V\textsubscript{32}} & \multicolumn{2}{c|}{Measured V\textsubscript{32}}\\ \cline{3-6}
Position & R\textsubscript{34} & Amplitude & Phase & Amplitude & Phase\\ \hline \hline
1 & 303.8 & & 2.73 & 28.2 & 2.51\\
2 & 1.141k & & 1.81 & 28.2 & 1.63\\
3 & 3.453k & & 0.79 & 28.2 & 0.5\\
4 & 5.33k & & 0.53 & 28.2 & 0.38\\
5 & 7.45k & & 0.38 & 28.2 & 0.25\\
6 & 9.54k & & 0.30 & 28.2 & 0.13\\
7 & 10.84k & & 0.27 & 28.2 & 0.13\\
\hline
\end{tabular}

表格环境不带标题。您需要这样做:

\begin{table}
\begin{tabular}{|c|c|c|c|c|c|}
Potentiometer & Resistance  & \multicolumn{2}{c}{Calculated V\textsubscript{32}} & \multicolumn{2}{c|}{Measured V\textsubscript{32}}\\ \cline{3-6}
Position & R\textsubscript{34} & Amplitude & Phase & Amplitude & Phase\\ \hline \hline
1 & 303.8 & & 2.73 & 28.2 & 2.51\\
2 & 1.141k & & 1.81 & 28.2 & 1.63\\
3 & 3.453k & & 0.79 & 28.2 & 0.5\\
4 & 5.33k & & 0.53 & 28.2 & 0.38\\
5 & 7.45k & & 0.38 & 28.2 & 0.25\\
6 & 9.54k & & 0.30 & 28.2 & 0.13\\
7 & 10.84k & & 0.27 & 28.2 & 0.13\\
\hline
\end{tabular}
\caption{Table1}
\label{tab:xyz}
\end{table}

如果您不想使用“浮动”(例如表格或图形)来“浮动”您定义的位置,您可以添加:

\usepackage{capt-of}
在序言中,然后执行以下操作:

\begin{center}
  \captionof{table}{Caption text goes here}
  \label{table1} % for use in \ref{table1} if you want to refer to the table number
  \begin{tabular}{|c|c|c|c|c|c|}
  % etc.
  \end{tabular}
\end{center}

将自动编号的标题添加到非浮点数。

+1。当您的用户正在使用时,在其中粘贴一个\标签{}。我把标题移到了底部,因为这是默认情况下应该出现的位置(否则间距将是错误的)。如果你想把它移到顶部,看看标题包。我的新的。一般来说,我不鼓励这样做——TeX知道很多关于好的布局的知识——但是知道它在那里是很好的;默认情况下,它应该在下面。这实际上对我很有帮助,我需要在一个特殊的单列环境中,在一个两列文档中为一个表添加一个标题。我使用的单列环境不会采用表格形式,但会采用表格形式,因此您可以使用它并获得良好的结果。同意dmckee,但一般不鼓励。谢谢你提到的标题。命名一个不浮动的表怎么会是糟糕的布局?不在表列表中列出(大)表是错误的。
caption
包提供了在浮动环境之外使用标题的相同功能