[Tex/LaTex] Avoid pagebreak in landscape

landscapepage-breakingtables

I'm using the lscape package to landscape certain pages of the document. These pages basically are a section/subsection heading plus a table that must be landscaped. The problem is that entering landscape mode forces a pagrebreak, so I end up having a first blank page with only the section/subsection heading and a second page with the table. This code should illustrate the problem:

\documentclass[12pt,letterpaper]{article}

\usepackage{lscape}

\begin{document}

\section{Foo}

\subsection{Bar}

\begin{landscape}
  Landscaped content
\end{landscape}

\end{document}

Is there any way to avoid the pagebreak and have the heading and the content in the same page?

Note: I don't want to landscape the section/subsection heading.

Best Answer

I answered a similar question in a German forum so I take this example.

I recommend the package hvfloat which does exactly what you want.

\documentclass{report}
\usepackage{geometry}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{hvfloat}
\usepackage{units}
\begin{document}
\section{minimalbeispiel}
\vfill
\begin{center}
   \hvFloat[%
    nonFloat=true,%
    capPos=l,%
    capAngle=90,%
    objectAngle=90,%
]{table}{\tiny%
    \begin{tabular}{llllllll}
    \toprule
    & \multicolumn{4}{c}{Coefficients} & &  \\
    \cmidrule(lr){2-5}
    Clamp. pres. in bar & $b_0$ & $b_1$ & $b_2$ & $b_3$ & $SS_{\text{err}}$ & $R^2$ in \%\\
    \midrule
    15 & $9.63*10^{-1}$ & $-2.16*10^{-3}$ & $3.56*10^{-6}$ & $-3.38*10^{-9}$ & $6.16*10^{-4}$ & 99.88\\
    20 & $9.62*10^{-1}$ & $-2.08*10^{-3}$ & $3.40*10^{-6}$& $-3.27*10^{-9}$ & $8.19*10^{-4}$ & 99.83\\
    25 & $9.64*10^{-1}$ & $-2.08*10^{-3}$ & $3.46*10^{-6}$ & $-3.29*10^{-9}$ & $5.30*10^{-4}$ & 99.89\\
    30 & $9.61*10^{-1}$ & $-1.99*10^{-3}$ & $3.19*10^{-6}$ & $-3.00*10^{-9}$ & $6.99*10^{-4}$ & 99.84\\
    35 & $9.53*10^{-1}$ & $-1.98*10^{-3}$ & $3.09*10^{-6}$ & $-2.92*10^{-9}$ & $6.87*10^{-4}$ & 99.85\\
    40 & $9.53*10^{-1}$ & $-2.04*10^{-3}$ & $3.33*10^{-6}$ & $-3.22*10^{-9}$ & $5.84*10^{-4}$ & 99.88\\
    45 & $9.54*10^{-1}$ & $-2.06*10^{-3}$ & $3.20*10^{-6}$ & $-3.02*10^{-9}$ & $5.24*10^{-4}$ & 99.89\\
    \bottomrule
    \end{tabular}%
}%
[Polarization curve data fitting of clamping pressure testing]{%
Polarization curve data fitting of clamping pressure testing\\ Model: $\frac{U}{V} = b_0 + b_1  \frac{i}{\unitfrac[]{\text{mA}}{\text{cm}^2}} + b_2 \frac{i^2}{\left(\unitfrac[]{\text{mA}}{\text{cm}^2}\right)^2} + b_3 \frac{i^3}{\left(\unitfrac[]{\text{mA}}{\text{cm}^2}\right)^3}$}{tab:3}
\end{center}
\vfill\clearpage
\end{document}

enter image description here

Related Question