0

I have a sideways table that does not fill the whole page. It is centered, but I want it to be left aligned (or if you turn the book around, to the top). Is there a way to do that? Please find below an example.

\documentclass[DIV12, a4paper, 12pt, listof=totocnumbered, bibliography=totoc]{book}
\usepackage[figuresright]{rotating}
\usepackage{threeparttable}
\usepackage{longtable, booktabs, tabularx}

\begin{document}

\begin{sidewaystable}
    \caption{Overview of the literature}
  \label{tab2:overviewliterature}
  \begin{threeparttable}
\begin{tabularx}{\textwidth}{lXlXX}

\toprule
Year & Author(s) & Method & (+) & (--) \\
\midrule

xx & xx & xx & xx   \\
\addlinespace


    \bottomrule

  \end{tabularx}
  \begin{tablenotes}[para,flushleft]
  \footnotesize
  \item\hspace{-2.5pt}\noindent\textit{Continued on the next page.}  
  \end{tablenotes}
  \end{threeparttable}

\end{sidewaystable}

\end{document}
1
  • The good news is that you can control the positioning using \rotFPtop and \rotFPbot. The bad news is that sideways table sets the height depth and width of \rot@float@box to zero, making it impossible to align the edges. The information icannot be recovered. OTOH, it is pretty easy to replace sideways table using \rotatebox and a normal table. Commented Aug 25, 2020 at 3:27

2 Answers 2

2

This solution uses \rotatebox (adjustbox package) to implement sideways tables. It uses a minpage covering the text area. The alignment is handled by the third optional argument: [t] [b] [c] and [s] for stretch (user supplied glue).

\documentclass[DIV12, a4paper, 12pt, listof=totocnumbered, bibliography=totoc]{book}
%\usepackage[figuresright]{rotating}
\usepackage{threeparttable}
\usepackage{longtable, booktabs, tabularx}
\usepackage{adjustbox}
\usepackage{showframe}% MWE only

\begin{document}

\begin{table}[p]
\rotatebox{90}{\begin{minipage}[b][\textwidth][t]{\textheight}
  \caption{Overview of the literature}
  \label{tab2:overviewliterature}
  \begin{threeparttable}
\begin{tabularx}{\textwidth}{lXlXX}

\toprule
Year & Author(s) & Method & (+) & (--) \\
\midrule

xx & xx & xx & xx   \\
\addlinespace


    \bottomrule

  \end{tabularx}
  \begin{tablenotes}[para,flushleft]
  \footnotesize
  \item\hspace{-2.5pt}\noindent\textit{Continued on the next page.}  
  \end{tablenotes}
  \end{threeparttable}
\end{minipage}}
\end{table}

\end{document}

demo

1
  • Thanks, the only problem is that the table caption hasnt been rotated. Any idea how to fix this? I cant upload images here so i answered my question to show how it looks like
    – MANGo 92
    Commented Aug 25, 2020 at 17:00
1
  • instead of sidewaystable see if the use of the pdflandscape (or if you prefer lscape package) and afterpage packages gives desired result:
\documentclass[DIV12, a4paper, 12pt, listof=totocnumbered, bibliography=totoc]{book}
\usepackage{pdflscape}
\usepackage{booktabs, longtable, tabularx}
\usepackage[referable]{threeparttablex}
\usepackage{afterpage}
\usepackage{lipsum} % for dummy text, not needed in real document

\begin{document}
\lipsum[1]
\afterpage{
\begin{landscape}
\begin{threeparttable}
    \caption{Overview of the literature}
    \label{tab2:overviewliterature}
\begin{tabularx}{\linewidth}{lXlXX}
    \toprule
Year    & Author(s) & Method    & $(+)$         & $(-)$         \\
    \midrule
xx      & xx        & xx        & \lipsum[66]   & \lipsum[11]   \\
    \bottomrule
\end{tabularx}
    \begin{tablenotes}[para,flushleft]\footnotesize
\textit{Continued on the next page.}
    \end{tablenotes}
\end{threeparttable}
\vfill\mbox{}
\end{landscape}
}

\lipsum[2-9]
\end{document}

enter image description here

  • it is not clear, why you use threeparttable and tablenotes with note that table is continued on the next page?
  • If this is case, than the use of tabularx will not enable to write to write table over few pages. Instead it you should use for example xltabular table environment and use threeparttable only if you need table notes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .