I have a table which has to be rotated given its size. Moreover, in my document it is the first table in the Appendix and hence has to follow the section header. Sidewaystable does not allow to have both the section header as well as the rotated table on the same page. Hence, I have tried the packages hvfloat as well as rotfloat / varwidth, however both don't lead to a perfect solution:
\documentclass[12pt,a4paper]{article}
\usepackage{hvfloat}
\usepackage{rotfloat}
\usepackage{varwidth}
\begin{document}
\section{Test Section 1}
\begin{center}
\hvFloat[nonFloat=true, capPos=t, rotAngle=90, objectPos=c]%
{table}%
{\begin{tabular}{lll}
column 1a & column 2a & column 3a \\
column 1b & column 2b & column 3b \\
column 1c & column 2c & column 3c \\
\end{tabular}}
{A rotated table}
{tab:test1}
\end{center}
\newpage
\section{Test Section 2}
\begin{table}[H]
\begin{center}
\rotatebox{90}{%
\begin{varwidth}{\textheight}
\caption{Another rotated table}\label{tab:test2}
\begin{tabular}{lll}
column 1a & column 2a & column 3a \\
column 1b & column 2b & column 3b \\
column 1c & column 2c & column 3c \\
\end{tabular}
\captionsetup{font=footnotesize}
\caption*{This table is just a test.}
\end{varwidth}}
\end{center}
\end{table}
\end{document}
In both cases I achieve that the tables are on the same page like the section header but:
In the case of hvfloat, (1) despite using the option capPos=t
the caption remains always on the left hand side of the table. I've read the documentation but I have no idea what I'm doing wrong here. (2) I can't find an option to add table notes (in the table environment I'd use \caption*{Table Notes}
but that doesn't work here). The table as such is positioned vertically and horiontally like I would like to have it.
In the case of the rotatebox, I manage to get the caption on top of the table and table notes below the table but whatever I do the table remains at the bottom of the page (while it should be centered horizontally and following the section header vertically).
Any hints would be highly appreciated. Thank you.
tabular
environment or would you be willing to fix the width of the tabular using eithertabularx
ortabular*
?tabular
tabular*
Which environment to use depends on the type of contents in your actual table.