4

I want to rotate a large table with the caption. However, I can not rotate the caption for the table. Do you have any ideas how to rotate the caption for this layout? Thanks a lot.

Here my text code is below

\rotatebox{90}{
% \caption{Comparison} I cannot use this function like that
\begin{tabular}{l*{6}{c}r}
\hline
Names  & A & B & C & D \\
\hline
\hline
Jobs   & A & B & C & D \\
\hline
Types   & A & B & C & D \\
\hline
\end{tabular}    
}
  • 1
    Real quick: Why did you set the tags biblatex and table-of-contents? – Mico May 18 '17 at 14:33
  • You can not use the standard \caption-command outside of floats (figure or table). – Skillmon May 18 '17 at 14:37
  • OK, thanks a lot for your comment. I will remove the tags as you suggested. – user3727281 May 18 '17 at 14:49
6

I tried this:

\documentclass{article}
\usepackage{rotating}

\begin{document}

\begin{sidewaystable}
\centering
\caption{Comparison}
\begin{tabular}{l*{6}{c}r}
\hline
Names  & A & B & C & D \\
\hline
\hline
Jobs   & A & B & C & D \\
\hline
Types   & A & B & C & D \\
\hline
\end{tabular}    

\end{sidewaystable}

\end{document}

enter image description here

4

While iacopo's answer is the way I'd choose, here is a different solution:

\documentclass[]{scrartcl}

\usepackage{rotating}

\begin{document}

\rotatebox{90}{
\vbox{
    \centering
    \captionaboveof{table}{Comparison}
    \begin{tabular}{l*{6}{c}r}
    \hline
    Names  & A & B & C & D \\
    \hline
    \hline
    Jobs   & A & B & C & D \\
    \hline
    Types   & A & B & C & D \\
    \hline
    \end{tabular}    
}
}
\end{document}

If you don't use a KOMA-class you can use the package caption and replace \captionaboveof with \captionof.

3

As an alternative option to the previous two, for really large tables I prefer to rotate the whole page instead:

\documentclass{article}

\usepackage{pdflscape}
\usepackage{afterpage}

\begin{document}

\afterpage{%
\clearpage% Flush earlier floats (otherwise order might not be correct)
\begin{landscape}% Landscape page
\begin{table}
\centering
\caption{Comparison}
\begin{tabular}{l*{6}{c}r}
\hline
Names  & A & B & C & D \\
\hline
\hline
Jobs   & A & B & C & D \\
\hline
Types   & A & B & C & D \\
\hline
\end{tabular}    
\end{table}
\end{landscape}
\clearpage% Flush page
}
\end{document}

This has the advantage that the page displays correctly in software and prints like normal with headers and footers in normal orientation. It really depends on your requirements.

enter image description here

(credit to Martin Scharrer for this answer)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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