Latex is creating a blank page before a sideways table. Initially, I thought this was a problem with sideways table (see Landscape mode causes a blankpage). Indeed the blank page goes away if I use any of the solutions proposed on that page (i.e., the afterpage package or removing the "H" float placement). However, I need the tables, as well as the section headings, exactly where they appear on the document. If I use either solution, then stuff moves around.
Then, during my several attempts to create a replicable example, I discovered that, by removing hyperref, the problem goes away. According to this thread, the float package should be loaded before hyperref. It doesn't say anything about rotfloat, though. Is there any incompatibility between the two? (Needless to say, I can't simply remove hyperref from the document altogether, as I need it elsewhere.)
Example:
\documentclass[12pt,letterpaper]{article}
\usepackage{rotfloat}
\usepackage{hyperref}
\usepackage{dcolumn}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\doublespacing
\frenchspacing
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\begin{document}
\section{Section Heading}
\subsection{Subsection Heading}
\subsubsection{First Sub-Subsection Heading}
\begin{table}[H] \centering
\caption{A smallish table}
\begin{tabular}{@{\extracolsep{5pt}} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
\\[-1.8ex]\hline \\[-1.8ex]
\multicolumn{1}{c}{} & \multicolumn{1}{c}{Column 1} & \multicolumn{1}{c}{Column 2} & \multicolumn{1}{c}{Column 3} \\
\hline \\[-1.8ex]
\multicolumn{1}{c}{Row 1} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 2} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 3} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 4} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 5} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 6} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 7} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 8} & 0.00 & 0.00 & 0.00 \\
\hline \\[-1.8ex]
\multicolumn{4}{l}{A note} \\
\multicolumn{4}{l}{Another note} \\
\end{tabular}
\end{table}
\begin{table}[H] \centering
\caption{another smallish table}
\begin{tabular}{@{\extracolsep{5pt}} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
\\[-1.8ex]\hline \\[-1.8ex]
\multicolumn{1}{c}{} & \multicolumn{1}{c}{Column 1} & \multicolumn{1}{c}{Column 2} & \multicolumn{1}{c}{Column 3} \\
\hline \\[-1.8ex]
\multicolumn{1}{c}{Row 1} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 2} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 3} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 4} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 5} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 6} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 7} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 8} & 0.00 & 0.00 & 0.00 \\
\hline \\[-1.8ex]
\multicolumn{4}{l}{A note} \\
\multicolumn{4}{l}{Another note} \\
\end{tabular}
\end{table}
\subsubsection{Second Sub-Subsection Heading}
\begin{sidewaystable}[H] \centering
\caption{A very large table}
\footnotesize
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
\\[-1.8ex]\hline \\[-1.8ex]
\\[-1.8ex] & \multicolumn{6}{c}{Table heading} \\
\\[-1.8ex] & \multicolumn{1}{c}{Column 1} & \multicolumn{1}{c}{Column 2} & \multicolumn{1}{c}{Column 3} & \multicolumn{1}{c}{Column 4} & \multicolumn{1}{c}{Column 5} & \multicolumn{1}{c}{Column 6} \\
& \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} \\
& \multicolumn{3}{c}{Heading for columns 1-3} & \multicolumn{3}{c}{Heading for columns 4-6} \\
\hline \\[-1.8ex]
Row 1 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 2 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 3 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 4 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 5 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 6 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 7 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 8 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 9 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 10 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 11 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 12 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 13 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 14 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 15 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 16 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 17 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 18 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 19 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 20 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 21 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 22 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 23 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 24 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 25 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 26 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
\hline \\[-1.8ex]
\multicolumn{7}{l}{A note} \\
\multicolumn{7}{l}{Another note} \\
\multicolumn{7}{l}{Yet another note} \\
\end{tabular}
\end{sidewaystable}
\end{document}
Output here.
The problem goes away if I don't load hyperref
\documentclass[12pt,letterpaper]{article}
\usepackage{rotfloat}
\usepackage{dcolumn}
\usepackage[margin=1in]{geometry}
\usepackage{setspace}
\doublespacing
\frenchspacing
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[american]{babel}
\begin{document}
\section{Section Heading}
\subsection{Subsection Heading}
\subsubsection{First Sub-Subsection Heading}
\begin{table}[H] \centering
\caption{A smallish table}
\begin{tabular}{@{\extracolsep{5pt}} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
\\[-1.8ex]\hline \\[-1.8ex]
\multicolumn{1}{c}{} & \multicolumn{1}{c}{Column 1} & \multicolumn{1}{c}{Column 2} & \multicolumn{1}{c}{Column 3} \\
\hline \\[-1.8ex]
\multicolumn{1}{c}{Row 1} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 2} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 3} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 4} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 5} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 6} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 7} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 8} & 0.00 & 0.00 & 0.00 \\
\hline \\[-1.8ex]
\multicolumn{4}{l}{A note} \\
\multicolumn{4}{l}{Another note} \\
\end{tabular}
\end{table}
\begin{table}[H] \centering
\caption{another smallish table}
\begin{tabular}{@{\extracolsep{5pt}} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
\\[-1.8ex]\hline \\[-1.8ex]
\multicolumn{1}{c}{} & \multicolumn{1}{c}{Column 1} & \multicolumn{1}{c}{Column 2} & \multicolumn{1}{c}{Column 3} \\
\hline \\[-1.8ex]
\multicolumn{1}{c}{Row 1} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 2} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 3} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 4} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 5} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 6} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 7} & 0.00 & 0.00 & 0.00 \\
\multicolumn{1}{c}{Row 8} & 0.00 & 0.00 & 0.00 \\
\hline \\[-1.8ex]
\multicolumn{4}{l}{A note} \\
\multicolumn{4}{l}{Another note} \\
\end{tabular}
\end{table}
\subsubsection{Second Sub-Subsection Heading}
\begin{sidewaystable}[H] \centering
\caption{A very large table}
\footnotesize
\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} D{.}{.}{-2} }
\\[-1.8ex]\hline \\[-1.8ex]
\\[-1.8ex] & \multicolumn{6}{c}{Table heading} \\
\\[-1.8ex] & \multicolumn{1}{c}{Column 1} & \multicolumn{1}{c}{Column 2} & \multicolumn{1}{c}{Column 3} & \multicolumn{1}{c}{Column 4} & \multicolumn{1}{c}{Column 5} & \multicolumn{1}{c}{Column 6} \\
& \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} & \multicolumn{1}{c}{Column subheading} \\
& \multicolumn{3}{c}{Heading for columns 1-3} & \multicolumn{3}{c}{Heading for columns 4-6} \\
\hline \\[-1.8ex]
Row 1 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 2 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 3 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 4 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 5 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 6 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 7 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 8 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 9 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 10 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 11 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 12 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 13 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 14 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 15 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 16 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 17 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 18 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 19 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 20 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 21 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 22 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 23 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 24 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 25 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
Row 26 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 \\
\hline \\[-1.8ex]
\multicolumn{7}{l}{A note} \\
\multicolumn{7}{l}{Another note} \\
\multicolumn{7}{l}{Yet another note} \\
\end{tabular}
\end{sidewaystable}
\end{document}
Output here.
[H]placement specifier with asidewaystableenvironment. Don't do it, and the all-empty page disappears -- irrespective of whether or not thehyperrefpackage is loaded. If you want the table to show up on the same page as the subsubsection-level header, don't use asidewaystableenvironment; instead, use asidewaysenvironment. – Mico Oct 21 '19 at 19:01rotfloatpackage to combinerotatingpackage and[H], instead I wrote it to combinerotatingand floats defined with\newfloatoffered by thefloatpackage. I second the statement from Mico, it's wrong to use[H]with asidewaystableenvironment... However, using[H]with sideways-floats could make sense in special situations, for example when combining it with\afterpageoffered by theafterpagepackage. – Oct 21 '19 at 19:26rotatingpackage -- and especially its section 5, "Sideways figures and tables". You'll learn, inter alia, that thesidewaystableandsidewaysfigureenvironments are meant to occupy an entire page at a time. If you try to shoehorn a subsubsection-level header onto a page with asidewaystableenvironment (via the[H]specifier), you'll necessarily get a massively overfull page -- as indeed your code does. – Mico Oct 21 '19 at 19:28