I want to rotate a table because it is too wide. I'm forced to use \documentclass[11pt,a4paper]{article}
, so changing that is not a solution.
Many packages rotate the whole page, but I just wan't to rotate the table.
I have a design sample of a table, that I must use. In my tex code that is my first table.
The second snippet is how I can rotate a table. Yet I'm missing a required caption on the table.
The third snippet is what I actually want, but I'm getting a LaTeX Error: Not in outer par mode
. I found a similar question Rotate table with caption: "Not in outer par mode. \begin{table}[h]" but the answer provided a solution with sidewaystable and that is just plain ugly in my case, because then the rotated table occupies a whole page on its own.
\documentclass[11pt,a4paper]{article}
\usepackage[graphicx]{realboxes}
\usepackage{verbatim}
\begin{document}
\begin{table}[htb]
\begin{center}
\begin{tabular}{|l|c|c|c|c|c||c|c|c|c|c||c|c|c|c|c|}
\hline
\bf Some text & \rotatebox{90}{column 1 } & \rotatebox{90}{column 2} & \rotatebox{90}{column 3 } & \rotatebox{90}{column 4 } & \rotatebox{90}{column 5 } & \rotatebox{90}{column 6 } & \rotatebox{90}{column 7} & \rotatebox{90}{column 8 } & \rotatebox{90}{column 9 } & \rotatebox{90}{column 10 } & \rotatebox{90}{column 11 } & \rotatebox{90}{column 12} & \rotatebox{90}{column 13 } & \rotatebox{90}{column 14 } & \rotatebox{90}{column 15 }\\
\hline \hline
first row lorem ipsum & 692 & 535 & 85 & 48 & 24 & 692 & 535 & 85 & 48 & 24 & 2 & 3 & 3 & 4 & 5 \\
\hline
\end{tabular}
\end{center}
\caption{My caption lorem ipsum}\label{tab_aaa}
\end{table}
%rotated
\rotatebox{90}{
\begin{tabular}{|l|c|c|c|c|c||c|c|c|c|c||c|c|c|c|c|}
\hline
\bf Some text & \rotatebox{90}{column 1 } & \rotatebox{90}{column 2} & \rotatebox{90}{column 3 } & \rotatebox{90}{column 4 } & \rotatebox{90}{column 5 } & \rotatebox{90}{column 6 } & \rotatebox{90}{column 7} & \rotatebox{90}{column 8 } & \rotatebox{90}{column 9 } & \rotatebox{90}{column 10 } & \rotatebox{90}{column 11 } & \rotatebox{90}{column 12} & \rotatebox{90}{column 13 } & \rotatebox{90}{column 14 } & \rotatebox{90}{column 15 }\\
\hline \hline
first row lorem ipsum & 692 & 535 & 85 & 48 & 24 & 692 & 535 & 85 & 48 & 24 & 2 & 3 & 3 & 4 & 5 \\
\hline
\end{tabular}
}
\begin{comment}
%% what i want
\rotatebox{90}{
\begin{table}[htb]
\begin{center}
\begin{tabular}{|l|c|c|c|c|c||c|c|c|c|c||c|c|c|c|c|}
\hline
\bf Some text & \rotatebox{90}{column 1 } & \rotatebox{90}{column 2} & \rotatebox{90}{column 3 } & \rotatebox{90}{column 4 } & \rotatebox{90}{column 5 } & \rotatebox{90}{column 6 } & \rotatebox{90}{column 7} & \rotatebox{90}{column 8 } & \rotatebox{90}{column 9 } & \rotatebox{90}{column 10 } & \rotatebox{90}{column 11 } & \rotatebox{90}{column 12} & \rotatebox{90}{column 13 } & \rotatebox{90}{column 14 } & \rotatebox{90}{column 15 }\\
\hline \hline
first row lorem ipsum & 692 & 535 & 85 & 48 & 24 & 692 & 535 & 85 & 48 & 24 & 2 & 3 & 3 & 4 & 5 \\
\hline
\end{tabular}
\end{center}
\caption{My caption lorem ipsum}\label{tab_b}
\end{table}
}
\end{comment}
\end{document}
How can I add a caption to the second snippet?