[Tex/LaTex] Landscape table without creating new page

landscapepositioningtables

I am having problems with a table in landscape orientation. This table occupies an entire page and it is preceded by a chapter title. Even though there is nothing else on the page, the table is placed on a new page. I already tried to reduce the number of rows on the table, but even if it has only one row, it is still placed on a new page.
Here is what I have:

\begin{landscape}

\chapter{Title}

\begin{table}[h]
\centering
\begin{tabular}{|c|l|l|}
 ....
\end{tabular}
\end{table}

\end{landscape}

I also tried to have a sidewaystable, but I keep having the same problem. Even without the landscape environment, the title stays on one page and the table is in the next one. So I have one page with a title and nothing else and another one with a table.

Can anyone help me understand what the problem is? Thank you.

Best Answer

You can use the hvfloat package; in this way, you can control at will the rotation of the table and its eventual caption; the nonFloat=true option guarantees that no flotation will happen:

\documentclass{book}
\usepackage{hvfloat}
\usepackage{booktabs}

\begin{document}

\chapter{Test chapter}

\hvFloat[%
nonFloat=true,
objectAngle=90,%
capPos=r,%
capAngle=90,
capWidth=0.5]{table}{%
\begin{tabular}{cccc}
  \toprule
  text & text & text & text \\
  text & text & text & text \\
  text & text & text & text \\
  text & text & text & text \\
  text & text & text & text \\
  \bottomrule
\end{tabular}%
}{this is a caption for the rotated table in the example}{tab:test}

\end{document}

enter image description here

Related Question