# booktabs rotating table

\documentclass[a4paper,openany]{book}

\usepackage{booktabs}
\usepackage[counterclockwise]{rotating}

\begin{document}
\begin{sidewaystable}
\begin{center}
\begin{table}
\begin{tabular}{@{}ccccccc@{}}
\toprule
.... &.... & ........... & ...... & \begin{tabular}[c]{@{}c@{}}...../\\
.....\end{tabular} & .... & .... \\ \midrule

& Paper A & .... & & & & \\ \bottomrule

\end{tabular}
\end{table}
\end{center}
\caption {...}
\end{sidewaystable}
\end{document}


Can't seem to rotate my table. I copied the relevant code above. Error message is "Not in outer par mode. \begin" when I try to compile. If I remove the table environment it seems to work, but then the caption is at the bottom of the table.

A sidewaystable is a table environment. Also don't use the center environment: it adds unwanted spacing. Simply use this:

\documentclass[a4paper,openany]{book}

\usepackage{booktabs}
\usepackage[counterclockwise]{rotating}

\begin{document}
\begin{sidewaystable}
\centering
\begin{tabular}{@{}ccccccc@{}}
\toprule
.... &.... & ........... & ...... & \begin{tabular}[c]{@{}c@{}}...../\\
.....\end{tabular} & .... & .... \\ \midrule

& Paper A & .... & & & & \\ \bottomrule

\end{tabular}
\caption {...}
\end{sidewaystable}

\end{document}

• Thanks. I had to also move the \caption so it appears like this: \centering \caption .... – slew123 Jul 15 '18 at 15:31
• In my test, the caption is centred (w.r.t. the table). Perhaps you have to compile twice. – Bernard Jul 15 '18 at 15:34
• Sorry, I was not clear. The caption still appeared underneath the table until I moved where it was located in the latex document. – slew123 Jul 15 '18 at 15:41
• It's not yet very clear to me: the caption must be rotated like the tabular, but above it (for the landscape layout, i.e. on the left for the portrait layout)? – Bernard Jul 15 '18 at 15:57
• Yes, just as you describe. I wanted the caption above the table, like in this example: tex.stackexchange.com/questions/253064/… – slew123 Jul 15 '18 at 16:46