[Tex/LaTex] Rotate table with caption: “Not in outer par mode. \begin{table}[h]”

captionsrotatingtables

I would like to rotate one table with caption however it returns me an error

Missing \endgroup inserted ...omparação de Gerenciadores de Documento}
Undefined control sequence \end{sideways}
 Undefined control sequence \end{sideways}
Undefined control sequence \end{sideways}
Undefined control sequence \end{sideways}
\begin{table} on input line 18 ended by \end{sideways}. \end{sideways}
Too many }'s
Extra \endgroup

I am using the code below

\begin{table}[h]
\begin{sideways}
\begin{tabular}{|c|c|c|c|c|c|}
    \hline  Nome        & Linguagem & Full-Text Indexing & Controle de Versão & Workflow & Controle de Usuários \\
    \hline  Quotero     & Java      &  Sim              &                       &           &       \\
    \hline  OpenKM      & Java      &                   &                       &           &       \\
    \hline  xinco DMS   & PHP       &                   &                       &           &       \\
    \hline
\end{tabular}
\caption{Comparação de Gerenciadores de Documento}
\end{sideways}
\end{table}

How can I solve that error? It only happens if I have the caption.

Best Answer

In order to rotate the entire table, including the caption, use the sidewaystable environment:

enter image description here

\documentclass{article}
\usepackage{rotating}% http://ctan.org/pkg/rotating
\begin{document}
\begin{sidewaystable}[ht]
  \centering
  \begin{tabular}{|c|c|c|c|c|c|}
    \hline  Nome        & Linguagem & Full-Text Indexing & Some text & Workflow & Some text \\
    \hline  Quotero     & Java      & Sim                &           &          &           \\
    \hline  OpenKM      & Java      &                    &           &          &           \\
    \hline  xinco DMS   & PHP       &                    &           &          &           \\
    \hline
  \end{tabular}
  \caption{My caption}
\end{sidewaystable}
\end{document}