2

For my appendix I need to make a table in landscape mode, since the three columns containg quite a lot information and it has to fit on one page. Rotation for the table works just fine with both lscape and rotating (with sidewaystable) packages.

However, I am not able to fit the section/chapter title to the same page as the rotated table. The chapter/section is always on the page before the table. Including the chapter/section within the landscape mode boundaries does not work, since the title/chapter should be in normal portrait mode and only the table in landscape.

I have looked up already this question and this one. The solution of the first one does not work and I can not get the \hvfloat suggestion of the second one to work.

So the page should look somewhat like this:

\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs}

\begin{document}

\section{Section Title Here}

\begin{sidewaystable}
\centering
\caption{Caption here}
\begin{tabular}{@{}lcc@{}}
\toprule
Column A  & Column B      & Column C                   \\ \midrule
1234  & AAAAAAAAAAAAAAAAAAAAAAAAA    &  BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB\\
\bottomrule
\end{tabular}
\end{sidewaystable}

\end{document}
4
  • 1
    Welcome to TeX.SX! Do you really need to rotate the table? Probably you can get away with keeping the table in a portrait orientation while allowing linebreaks inside of the two wide columns? This however depends a lot on the actual contents of the table.
    – leandriis
    Apr 17, 2021 at 9:34
  • 1
    As I understand it, this is a feature of the rotating package: rotated floats (sidewaystable and sidewaysfigure) always occupy an entire page.
    – chsk
    Apr 17, 2021 at 9:47
  • @leandriis unfortunately yes, the table contains quite a lot information and would be confusing using portrait mode.
    – user239213
    Apr 17, 2021 at 10:21
  • @chsk Oh that would make sense, since section/chapter title never fits independent of table size.
    – user239213
    Apr 17, 2021 at 10:21

1 Answer 1

1

To provide an actual answer to your question and not just a comment, you can use \rotatebox from the rotating package to manually rotate the tabular (this will not affect the caption though):

\documentclass{article}
\usepackage{rotating}
\usepackage{booktabs}
\begin{document}
    \section{Section Title Here}
        \begin{table}[tp]
            \centering
            \rotatebox{90}{
                \begin{tabular}{@{}lcc@{}}
                \toprule
                    Column A & Column B & Column C \\
                \midrule
                    1234     &   Foo    &   Bar    \\
                \bottomrule
                \end{tabular}
            }
            \caption{Caption here}
        \end{table}
\end{document}

enter image description here

Two notes:

  • the \caption is not rotated this way, and
  • the table is subject to the usual rules for placing floats.

Both are on purpose. FWIW I've used tp as placement options here --- I tend to believe that this produces the best-looking documents.

That said, if your appendix primarily contains wide tables and little associated text, I think having each of these tables on a page of its own would actually be the best option.

Another note: a better alternative (IMO) to sidewaystable is to put a regular table on a rotated page using pdflscape and afterpage:

\documentclass{article}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{booktabs}
\begin{document}
    \section{Section Title Here}
    \afterpage{%
        \clearpage%
        \begin{landscape}
        \begin{table}[p]
            \centering
            \begin{tabular}{@{}lcc@{}}
            \toprule
                Column A & Column B & Column C \\
            \midrule
                1234     &   Foo    &   Bar    \\
            \bottomrule
            \end{tabular}
            \caption{Caption here}
        \end{table}
        \end{landscape}
    }
\end{document}

The nice thing about this is that the page will appear as a landscape page in any decent PDF viewer (so those viewing your document on a computer screen won't have to hurt their necks), while printing as portrait page with content that just so happens to be sideways.

5
  • Thank you very much for your answer. Unfortunately, the second suggestions does not solve the problem of separate pages for section/chapter title and the table. However, thanks for 'landscape' good to know that such a alternative exists. I guess since you already outlined that the caption of your first solution is not rotated there is no solution to that? Because with this suggestion I at least the section/chapter title is on the same page as the table.
    – user239213
    Apr 19, 2021 at 7:59
  • @user239213 I would be surprised if there was no solution to rotating the caption as well, but I don't know how to do that; I'm no wizard (yet). You could perhaps ask in the chat about this, or post a new question.
    – chsk
    Apr 19, 2021 at 8:02
  • Thanks for your time and advice, I appreciate the help!
    – user239213
    Apr 19, 2021 at 9:59
  • @user239213 You're welcome --- happy to help!
    – chsk
    Apr 19, 2021 at 12:06
  • @user239213 BTW, if this answer helped you, it'd be nice if you could accept it by clicking on the checkmark symbol.
    – chsk
    May 3, 2021 at 9:53

You must log in to answer this question.

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