0

I'm writing a document with some full page tables that need to be rotated. This is fine, but float behaviour is not working like I would expect - I have some text 1, an afterpage environ with full page table, some text 2, an afterpage environ with full page table, then some text 3. On the page containing some text 2, there is a lot of white space at the bottom, that I would expect to contain some of some text 3, so long as I avoid \clearpage calls.

Example code here:

\documentclass{article}

\usepackage{booktabs} 
\usepackage{bm}

%for rotated tables
\usepackage{pdflscape}
\usepackage{afterpage}

\newcommand{\vect}[1]{\boldsymbol{\mathbf{#1}}}

\begin{document}

text before tables

\begin{afterpage}
\clearpage
\begin{landscape}

\begin{table*}
\centering
\caption{a wide table} 
\label{tab:simtable}
\begin{scriptsize}
\begin{scalebox}{.9}

\begin{tabular}{llrrrrrrrrrrrrrrr}
  \toprule
   &  & \multicolumn{4}{c}{\textbf{Coverage}} & \multicolumn{4}{c}{\textbf{Mean}} & \multicolumn{3}{c}{\textbf{RMSE}} & \multicolumn{4}{c}{\textbf{CI width}}\\
 \cmidrule(lr){3-6}\cmidrule(lr){7-10}\cmidrule(lr){11-13}\cmidrule(lr){14-17}
 \textbf{Parameter} & \textbf{Symbol} & \textbf{B true} & \textbf{B full} & \textbf{F profile} & \textbf{F SE} & \textbf{True} & \textbf{B true} & \textbf{B full} & \textbf{F} & \textbf{B true} & \textbf{B full} & \textbf{F} & \textbf{B true} & \textbf{B full} & \textbf{F profile} & \textbf{F SE}\\
 \midrule
T0mean\_eta1 & $\vect{\eta}_{1[1]}$ & 0.94 & 0.95 & 0.95 & 0.95 & 1.00 & 1.00 & 1.00 & 1.00 & 0.09 & 0.09 & 0.09 & 0.34 & 0.35 & 0.35 & 0.35 \\ 
  T0mean\_eta2 & $\vect{\eta}_{1[2]}$ & 0.95 & 0.96 & 0.94 & 0.95 & 1.00 & 1.00 & 1.01 & 1.00 & 0.10 & 0.11 & 0.10 & 0.42 & 0.43 & 0.43 & 0.42 \\ 
  drift\_eta1\_eta1 & $\vect{A}_{[1,1]}$ & 0.95 & 0.94 & 0.97 & 0.96 & -0.40 & -0.40 & -0.42 & -0.40 & 0.04 & 0.05 & 0.04 & 0.17 & 0.19 & 0.18 & 0.17 \\
   \bottomrule
\end{tabular}

\end{scalebox}
\end{scriptsize}
\end{table*}

\end{landscape}

\end{afterpage}

between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  between tables  

\begin{afterpage}%

\begin{landscape}

\begin{table*}
\centering
\caption{another table} 
\label{tab:simtable2}
\begin{scriptsize}
\begin{scalebox}{.9}

\begin{tabular}{llrrrrrrrrrrrrrrr}
  \toprule
   &  & \multicolumn{4}{c}{\textbf{Coverage}} & \multicolumn{4}{c}{\textbf{Mean}} & \multicolumn{3}{c}{\textbf{RMSE}} & \multicolumn{4}{c}{\textbf{CI width}}\\
 \cmidrule(lr){3-6}\cmidrule(lr){7-10}\cmidrule(lr){11-13}\cmidrule(lr){14-17}
 \textbf{Parameter} & \textbf{Symbol} & \textbf{B true} & \textbf{B full} & \textbf{F profile} & \textbf{F SE} & \textbf{True} & \textbf{B true} & \textbf{B full} & \textbf{F} & \textbf{B true} & \textbf{B full} & \textbf{F} & \textbf{B true} & \textbf{B full} & \textbf{F profile} & \textbf{F SE}\\
 \midrule
T0mean\_eta1 & $\vect{\eta}_{1[1]}$ & 0.94 & 0.96 & 0.87 & 0.94 & 1.00 & 1.13 & 1.04 & 1.09 & 0.31 & 0.29 & 0.38 & 1.64 & 1.24 & 29.71 & 1.42 \\ 
  T0mean\_eta2 & $\vect{\eta}_{1[2]}$ & 0.95 & 0.96 & 0.89 & 0.96 & 1.00 & 1.17 & 1.04 & 1.08 & 0.44 & 0.37 & 0.51 & 2.33 & 1.66 & 106.23 & 1.92 \\ 
  drift\_eta1\_eta1 & $\vect{A}_{[1,1]}$ & 0.95 & 0.88 & 0.88 & 0.88 & -0.40 & -0.55 & -0.75 & -0.51 & 0.24 & 0.41 & 0.46 & 0.98 & 1.37 & 0.97 & 1.00 \\ 
  drift\_eta2\_eta1 & $\vect{A}_{[1,2]}$ & 0.96 & 0.95 & 0.90 & 0.95 & 0.00 & 0.12 & 0.15 & 0.06 & 0.18 & 0.21 & 0.44 & 0.75 & 0.87 & 0.75 & 0.88 \\ 
  drift\_eta1\_eta2 & $\vect{A}_{[2,1]}$ & 0.97 & 0.89 & 0.90 & 0.90 & 0.10 & 0.17 & 0.27 & 0.15 & 0.13 & 0.21 & 0.30 & 0.60 & 0.76 & 0.57 & 0.64 \\ 
  drift\_eta2\_eta2 & $\vect{A}_{[2,2]}$ & 0.95 & 0.92 & 0.86 & 0.94 & -0.20 & -0.33 & -0.41 & -0.28 & 0.17 & 0.26 & 0.37 & 0.64 & 0.88 & 0.70 & 0.76 \\ 
  manifestvar\_Y1\_Y1 & $\vect{\Theta}_{[1,1]}$ & 0.94 & 0.95 & 0.85 & 0.94 & 1.00 & 0.97 & 0.94 & 0.94 & 0.11 & 0.17 & 0.19 & 0.50 & 0.59 & 0.38 & 24.80 \\
   \bottomrule
\end{tabular}

\end{scalebox}
\end{scriptsize}
\end{table*}

\end{landscape}
\end{afterpage}

text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  text after tables but some should appear before  

\end{document}
3
  • Why do you need afterpage here at all rather than a normal float? Commented Mar 21, 2017 at 23:47
  • I was led to believe based on reading here that it would be an effective way to put in rotated pages...
    – Charlie
    Commented Mar 22, 2017 at 0:06
  • 1
    I'd be very wary of using afterpage in a real document (and I wrote it) if it works Ok, but note the warnings in its documentation Commented Mar 22, 2017 at 0:15

1 Answer 1

1

\afterpage is a command with an argument not an environment so

\begin{afterpage}
\clearpage

is

\begingroup
\afterpage{\clearpage}

so only \clearpage is handled by \afterpage and the \begin{landscape} forces a page break at that point.

2
  • Thanks, I wasn't familiar with that sort of behaviour when calling a non-environment as an environment.... doesn't seem intuitive but I guess it serves a purpose.
    – Charlie
    Commented Mar 22, 2017 at 0:10
  • 1
    @Charlie it's just an artefact of the way enviornments are defined. \begin{foo} is \foo and \end{foo} is \end{foo} so you have \afterpage \clearpage \begin{landscape}... which is the same as \afterpage{\clearpage}\begin{landscape}... by the standard tex argument parsing. Commented Mar 22, 2017 at 0:26

You must log in to answer this question.

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