Pergunta

Eu estou tentando adicionar uma legenda a uma tabela em látex, no entanto ele lança este erro "Erro de LaTeX:. \ Caption fora flutuar" Desde o erro que eu estou supondo meio de ti que é fora da tabela, mas eu colocá-lo claramente dentro.

\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}
Foi útil?

Solução

O ambiente tabular não vai tomar uma legenda. Você precisa fazer algo como isto:

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

Outras dicas

Se você não quiser usar um "float" (por exemplo, tabela ou figura), que irá "flutuar" a partir do lugar que você defini-lo, você pode adicionar:

\usepackage{capt-of}

no preâmbulo e, em seguida, fazer algo como:

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

para adicionar uma legenda de numeração automática a um não-float.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top