# Sidecaptions next to sidewaystables

I'd like to place a caption left/right next to my table which is rotated by 90 degrees. So the caption should be next (e.g. bottom right) to the table and both, the caption and the table should be rotated. I use \begin{sidewaystable} for the actual rotation of the table, but how can that be combined with a sidecaption?

This sidecaption should only be an exception, all other table should have their caption top of the table (caption=tableheading)

\documentclass[caption=tableheading]{scrreprt}
\usepackage{rotating}

%%%%%%%%%%%%%%%
\begin{document}

\begin{sidewaystable}[htbp]
\caption{This is the Table caption that should appear next to the table}
\begin{center}
\begin{tabular}{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}
\end{center}
\end{sidewaystable}

\end{document}


## 1 Answer

Below I present you two options; the first one uses the hvfloat package; the second one, places the caption inside a minipage and uses \rotatebox from graphicx:

\documentclass[caption=tableheading]{scrreprt}
\usepackage{hvfloat}
\usepackage{graphicx}

\begin{document}

\hvFloat[capPos=r,capWidth=0.4,capVPos=b,objectPos=c,rotAngle=90]
{table}
{\raisebox{\height}{\begin{tabular}{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}}%
}%
{This is the Table caption that appears next to the table}%
{tab:testa}

\clearpage

\vfill\begin{table}
\rotatebox{90}{%
\begin{tabular}[b]{ |c|c|c| }
\hline
cell1 & cell2 & cell3 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
cell4 & cell5 & cell6 \\
cell7 & cell8 & cell9 \\
\hline
\end{tabular}\quad%
\begin{minipage}[b]{.5\textwidth}
\caption{This is the Table caption that appears next to the table}
\end{minipage}}%
\end{table}
\clearpage

\end{document}