Graphics, Figures & TablesRotate longtable

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Latex Noob
Posts: 1
Joined: Thu May 01, 2014 1:56 pm

Rotate longtable

Post by Latex Noob »

Hey there!

I have a couple of tables that are both too wide for portrait and too long to fit on one single page. I used to utilize the landscape environment to rotate tables, but I don´t like that this also rotates the section titles, as this is quite unhandy when flipping through the hardcopy version (of course with the digital PDF this is no problem). Thus, I started to use the \rotatebox{90} command. And it works beautifully for one sided tables, but somehow not for longtables. Does someone know how I can make the rotatebox-command work for longtables or can suggest an alternative solution?

Here is my example:

(Note: Since in an earlier post of mine, my code did not work with other users, I included all preamble entries)

\documentclass[12pt, a4paper, toc=flat] {scrartcl}

\usepackage{anysize}
\marginsize{3cm}{2cm}{2cm}{2cm}
\setkomafont{disposition}{\normalfont\bfseries}
\addtokomafont{chapterprefix}{\huge}
\addtokomafont{chapter}{\Huge}

\renewcommand*{\chapterheadstartvskip}{\vspace*{50pt}}
\renewcommand*{\chapterheadendvskip}{\vspace{40pt}}

\usepackage{etoolbox}

\makeatletter
\patchcmd{\@@makechapterhead}{.5\baselineskip}{20\p@}{}{}
\makeatother

\usepackage[markuppercase]{scrpage2}
\clearscrheadfoot
\ohead{\pagemark}
\ihead{\headmark}
\cfoot[\pagemark]{}
\pagestyle{scrheadings}

\usepackage{tocstyle}
\usetocstyle{KOMAlike}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{multirow}
\usepackage{fancybox}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage{rotating}
\usepackage{setspace}
\usepackage[colorlinks=true,linkcolor=cyan]{hyperref}
\usepackage{geometry}
\usepackage{hvfloat}
\usepackage{longtable, lscape}

\linespread{1.6}


\begin{document}


\subsection{Example}
\begin{longtable}{lc}
\rotatebox{90}{
\caption[Example]{Example}
\hline \multicolumn{1}{c}{\textbf{Column A}} & \multicolumn{1}{c}{\textbf{Column B}} \\ \hline
\endfirsthead

\multicolumn{2}{c}
{{\bfseries \tablename\ \thetable{} -- continued from previous page}} \\
\hline \multicolumn{1}{c}{\textbf{Column A}} &
\multicolumn{1}{c}{\textbf{Column B}} \\ \hline
\endhead

\hline \multicolumn{2}{r}{{Continued on next page}} \\
\endfoot

\hline \hline
\endlastfoot
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
Text & 0.0\% \\
\bottomrule
\end{longtable}
}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply