2009-04-29 48 views
22

我想添加一个标题到乳胶表中,但是它会抛出这个错误“!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} 

回答

37

表格环境不会标题。你需要做这样的事情:

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

+1。将\ label {}粘贴在那里,而你在那里。它的风格是放在一个浮动,而不是至少引用一次。 – dmckee 2009-04-29 18:04:22

+2

我将标题移到了底部,因为这是默认情况下的预期位置(否则间距将会出错)。如果您想将它移动到顶部,请查看标题包。 – 2009-04-30 00:18:59

20

如果不希望使用“浮动”(如表格或图形)将从你定义它的地方“漂走”,你可以添加:

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

到自动编号标题添加到非流通股。