11

The problem I have is basically articulated in this thread. According to the veteran respondent, it appears that sideways table does not support placement specifications. However, its behaviour should nonetheless be predictable.

Now the compiled code below should give you a 4-page doc. I have filled the document with dummy text in blocks coloured differently so we can see what is happening. The first block is one page and a bit over. Ok, so the sideways table should start on the first page after the preceding black text has cleared, no problem. So I expect the sideways table to appear on page 3. Instead it waits till after the next block yet (blue) is complete, then it kicks in and tacks my table onto the end on page 4. It should not wait until after the blue text clears entirely because the blue text chronologically comes after the table. If black text is on the page, then fine, even a little, it has to be deferred to the next page. But it should continued to be deferred if there is only blue text, as the blue text comes after the table.

How do I make the table appear on page 3 only after the preceding black text has cleared?

\documentclass[a4paper,12pt]{article}

\usepackage[font=small,labelfont=bf,tableposition=top]{caption} %apparently needs to come first or options clash with other packages will occur

\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{rotating}%to enable sideways table
\usepackage{float}

\usepackage{siunitx}
\sisetup{load-configurations = abbreviations}

\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{color}

\usepackage{float}


\begin{document}

\Blindtext

\begin{sidewaystable}[h!]
\caption{}
\label{}
\begin{tabularx}{\textwidth}{X X X X X X X X}
\toprule
\multicolumn{1}{>{\raggedright}X}{Time of induction (\SI{}{\minute})} & \multicolumn{1}{>{\raggedright}X}{IPTG} & \multicolumn{1}{>{\raggedright}X}{IPTG + Chloramphenicol} & \multicolumn{1}{>{\raggedright}X}{Lactose} &  \multicolumn{1}{>{\raggedright}X}{IPTG (\SI{5}{\micro\Molar}) + Glucose} & \multicolumn{1}{>{\raggedright}X}{IPTG (\SI{10}{\micro\Molar}) + Glucose} & \multicolumn{1}{>{\raggedright}X}{IPTG + Rifampicin} & \multicolumn{1}{>{\raggedright}X}{IPTG + Streptomycin}\\
\midrule
0   &   0.057   &   0       &   0               &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
1   &   0.060   &   0.003   &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
2   &   0.069   &   0.012   &   \num{5.0e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
3   &   0.083   &   0.026   &   \num{1.1e-6}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
4   &   0.120   &   0.063   &   \num{2.6e-6}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
5   &   0.123   &   0.066   &   \num{2.8e-6}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
7   &   0.191   &   0.134   &   \num{5.6e-6}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
10  &   0.310   &   0.253   &   \num{1.1e-5}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
12  &   0.399   &   0.342   &   \num{1.4e-5}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
15  &   0.491   &   0.434   &   \num{1.8e-5}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
30  &   1.179   &   1.122   &   \num{4.7e-5}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
45  &   1.585   &   1.528   &   \num{6.4e-5}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
0c  &   0.056   &   0       &   \num{0}         &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
15c     &   0.057   &   0.001   &   \num{0}         &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
45c     &   0.055   &   0       &   \num{0}         &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}    &   \num{1.3e-7}\\
\bottomrule
\end{tabularx}
\end{sidewaystable}

\textcolor{blue}{\Blindtext}

\end{document}
David Carlisle
  • 757,742
ptrcao
  • 6,603

1 Answers1

15

Changing the following line moves the table from Page 4 to Page 3 as desired:

\begin{sidewaystable}[ph!]

The p says to place the figure on a page containing only floats (which the sidewaystable requires anyway).

See Keeping tables/figures close to where they are mentioned for more details on float options, especially the document Using Imported Graphics in LaTeX and pdfLaTeX which mentions on Page 54 that it is better to provide more float options.

Peter Grill
  • 223,288