Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm getting the following error from my Latex code:

\begin{document} ended by \end{table}

But the error is not what the message says, because the begin{document} is ended by \end{document}. The problem is with the command \begin{table}, when I turn it in comment, the table works fine, but when I turn it on, the table disappear and the message appears.

\begin{table}[ht]
\begin{center}
\begin{tabular}{cc}
\hline
\multicolumn{2}{c}{\textbf{Variância das séries}} \\
\hline
\hline
Dados originais & 0,01065676 \\
1ª diferença & 0,003638648 \\
\hline
\caption{Variância das séries}
\end{tabular}
\end{center}
\end{table}

And these are the packages that I'm using

\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{tikz,blindtext}
\usepackage[T1]{fontenc}
\usepackage{palatino}
\usepackage{chngpage,calc}
\usepackage{hyperref}
\usepackage{kpfonts}
\usepackage{conf}
\usepackage{graphicx}
\usepackage[portuguese, english, brazil]{babel} 
\usepackage{setspace}
\usepackage{cite}

Anyone can help me?

share|improve this question
3  
Hi Filipe, welcome to TeX.sx! As far as I can see, \caption is in the wrong place - move it outside the tabular environment. You can also use \centering instead of \begin{center}...\end{center}. :) –  Paulo Cereda Jul 2 '12 at 1:37

1 Answer 1

The error you mentioned is actually the last error in the compilation process and comes as a consequence of this one:

! Missing \endgroup inserted.
<inserted text> 
                \endgroup 
l.27 \caption{Variância das séries}

\caption is in the wrong place, we need to move it outside the tabular environment. A MWE is as follows:

\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel} 

\begin{document}

\begin{table}[ht]
\centering
\begin{tabular}{cc}
\hline
\multicolumn{2}{c}{\textbf{Variância das séries}} \\
\hline
\hline
Dados originais & 0,01065676 \\
1ª diferença & 0,003638648 \\
\hline
\end{tabular}
\caption{Variância das séries}
\label{tab:varianciaseries}
\end{table}

\end{document}

The output:

Image

Note that I added a \label{tab:varianciaseries} to the code, so you can refer to this table later in the document by simply using it:

De acordo com a Tabela~\ref{tab:varianciaseries}, ...

Hope it helps. :)

share|improve this answer
    
Thanks! Now the table is working great. –  Filipe Ferminiano Jul 3 '12 at 0:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.