2

I want to test landscape tables, and started with the sideways environment. However the code does not compile, I get the error:

(./content/landscapetable.tex
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.6 \begin{center}

Here is a minimal example:

\documentclass{scrartcl} 
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{rotating}
\begin{document}
\begin{sideways}
\begin{center}
  \centering 
%  \captionsetup{type=table}
%  \caption{Sehr breite Tabelle.}
\begin{tabularx}{0.8\textheight}{XXX}
\hline
head & head & head \\
\hline
text which is considereably longer than 
the width of the column & 
text which is considereably longer than 
the width of the column & 
text which is considereably longer than 
the width of the column \\
\hline
\end{tabularx}  
\end{center}
\end{sideways}
\end{document}

Remove the sideways environment, and it compiles.

EDIT: when the center env is removed, and centering is left and the caption is introduced again another error with the caption occurs.

\begin{sideways}
  \centering
  \captionsetup{type=table}
  \caption{Sehr breite Tabelle.}
\begin{tabularx}{1.0\textheight}{*{6}{X}}
\hline
head & head & head & head & head & head \\
...
\end{tabularx}  
\end{sideways}

The error is then

! Missing \endgroup inserted.
<inserted text>
\endgroup
l.5 \caption{Sehr breite Tabelle.}

With sidewaystable it works, but that is not what I want.

1

1 Answer 1

4

Why both \centering and the center environment? Remove the latter and the example compiles fine.


(New solution, based on comment.)

If you did not want to rotate the caption, why put the caption in the sideways environment? What you could do is to place the table in a normal table environment, and then put just the tabularx in sideways.

\documentclass{scrartcl} 
\usepackage[utf8]{inputenc}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{rotating}
\begin{document}
\begin{table}
  \centering 
  \captionsetup{type=table}
  \caption{Sehr breite Tabelle.}
  \begin{sideways}
  \begin{tabularx}{0.8\textheight}{XXX}
    \hline
    head & head & head \\
    \hline
    text which is considereably longer than 
    the width of the column & 
    text which is considereably longer than 
    the width of the column & 
    text which is considereably longer than 
    the width of the column \\
  \hline
  \end{tabularx}
  \end{sideways}
\end{table}
\end{document}

enter image description here

On the other hand, I think it would be better to use sidewaystable, and have the caption rotated as well. Having to turn the page between reading the caption and reading the table would be awkward and inconvenient.

2
  • I know booktabs, but this was a minimal example. sidewaystable is something different (the caption is rotated too), which I do not want. I updated the question with a new error Commented Nov 16, 2011 at 10:09
  • @MatthiasPospiech Ah, I see. You should add a line stating what you do want to your question as well, just to make it clear (tabular rotated, caption not rotated). Commented Nov 16, 2011 at 10:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .