1

I am writing a report, where I in between text provide a couple of tables that fill an entire page. The code below is an example of how I have structured my report:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=2.5cm]{geometry}
\usepackage{multirow}
\usepackage{mathtools}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{siunitx}
\usepackage{lscape}
\usepackage{lipsum}
\usepackage[labelfont=bf, justification=centering]{caption}
\begin{document}
\lipsum[1-10] % some text before table
\begin{landscape}
\begin{table}%[h]
\def\arraystretch{1.25}
\sisetup{table-format=2.2, table-number-alignment=center, table-column-                                    width=18mm}
\setlength{\tabcolsep}{5pt}
\centering
\captionof{table}{\textbf{Descriptive Statistics on Some Variables}\\[1ex]\parbox{\linewidth}{\small Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}}
%\resizebox{\columnwidth}{!}{
\begin{tabular}{@{}lS[table-format=-2.2]*{4}{S}S[table-format=-2.2]@{}}
\toprule
\multicolumn{1}{c}{Description}&{Variable A} & {Variable B} & {Variable C} & {Variable D} & {Variable E} & {Variable F}\\
\midrule
Mean & 0.43 & 0.24 & 0.32 & 0.34 & 0.32 & 0.39 \\
Median & 0.89 & 0.48 & 0.22 & 0.36 & 0.15 & 0.24 \\
Standard Deviation & 4.06 & 1.31 & 2.27 & 1.46 & 1.58 & 3.57 \\
Variance & 17.22 & 3.35 & 5.17 & 2.13 & 3.33 & 15.60 \\
Kurtosis & 1.22 & 2.45 & 5.37 & 2.04 & 4.93 & 7.62 \\
Skewness & -0.12 & -0.51 & 0.57 & 0.06 & 0.31 & -0.39 \\
Range & 30.33 & 16.79 & 2.18 & 11.51 & 16.50 & 42.57 \\
Minimum & -19.62 & -8.82 & -9.54 & -5.41 & -6.38 & -24.16 \\
Maximum & 11.11 & 7.47 & 11.64 & 6.10 & 9.22 & 17.51 \\
Count & {326} & {316} & {321} & {226} & {426} & {454} \\
\bottomrule
\end{tabular}
%} % end of resize box
\end{table}
\end{landscape}
\lipsum[11-20] % some text after table
\end{document}

Currently, the code will produce the first text part (Lipsum[1-10]), and subsequently insert the table at the exact place it is listed in the code. In the page following, the second text part (Lipsum[11-20]) comes.

I am trying to make LaTeX continue to write text until the page is full, then insert the table, and then continue with the text afterwards. In this example, it implies that Lipsum[11-20] would continue for a bit on the second page until the page is full, then insert the table, and then finish the Lipsum[11-20] from page 4 and onwards (the table is then placed on page 3).

I know that this seems like a very trivial question, but I have been unable to find a solution for my case. I have looked at questions such as this and this, but their issue seemed to be to wrap text and figure on the same page. Not to wrap text and figure, where the figure fills an entire page itself.

Thanks in advance!

3

if i understood your question correctly, than you have two options for solving of the your problem:

  • use the package afterpage:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=2.5cm]{geometry}
\usepackage{booktabs}
\usepackage{mathtools}
\usepackage{siunitx}
\usepackage{lscape}
\usepackage{lipsum}
\usepackage[labelfont=bf, justification=centering]{caption}

\begin{document}
\lipsum[1-5] % some text before table
\afterpage{
    \begin{landscape}
\def\arraystretch{1.25}
\setlength{\tabcolsep}{5pt}
    \centering
\captionof{table}{Descriptive Statistics on Some Variables}
\parbox{\linewidth}{\small
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. }
\begin{tabular}{@{}
                l
           *{6}{S}[table-format=-2.2]
                @{}}
    \toprule
\multicolumn{1}{c}{Description}&{Variable A} & {Variable B} & {Variable C} & {Variable D} & {Variable E} & {Variable F}\\
\midrule
Mean & 0.43 & 0.24 & 0.32 & 0.34 & 0.32 & 0.39 \\
Median & 0.89 & 0.48 & 0.22 & 0.36 & 0.15 & 0.24 \\
Standard Deviation & 4.06 & 1.31 & 2.27 & 1.46 & 1.58 & 3.57 \\
Variance & 17.22 & 3.35 & 5.17 & 2.13 & 3.33 & 15.60 \\
Kurtosis & 1.22 & 2.45 & 5.37 & 2.04 & 4.93 & 7.62 \\
Skewness & -0.12 & -0.51 & 0.57 & 0.06 & 0.31 & -0.39 \\
Range & 30.33 & 16.79 & 2.18 & 11.51 & 16.50 & 42.57 \\
Minimum & -19.62 & -8.82 & -9.54 & -5.41 & -6.38 & -24.16 \\
Maximum & 11.11 & 7.47 & 11.64 & 6.10 & 9.22 & 17.51 \\
Count & {326} & {316} & {321} & {226} & {426} & {454} \\
    \bottomrule
\end{tabular}
\end{landscape}}
\lipsum[11-20] % some text after table
\end{document}
  • use the environment sidewaystable from the package rotating:

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=2.5cm]{geometry}
\usepackage{booktabs, multirow}
\usepackage{mathtools}
\usepackage{siunitx}
\usepackage{rotating}
\usepackage{lipsum}
\usepackage[labelfont=bf, justification=centering]{caption}

\begin{document}
\lipsum[1-5] % some text before table
    \begin{sidewaystable}
\def\arraystretch{1.25}
\setlength{\tabcolsep}{5pt}
    \centering
\captionof{table}{Descriptive Statistics on Some Variables}
\parbox{\linewidth}{\small
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. }
\begin{tabular}{@{}
                l
           *{6}{S}[table-format=-2.2]
                @{}}
    \toprule
\multicolumn{1}{c}{Description}&{Variable A} & {Variable B} & {Variable C} & {Variable D} & {Variable E} & {Variable F}\\
\midrule
Mean & 0.43 & 0.24 & 0.32 & 0.34 & 0.32 & 0.39 \\
Median & 0.89 & 0.48 & 0.22 & 0.36 & 0.15 & 0.24 \\
Standard Deviation & 4.06 & 1.31 & 2.27 & 1.46 & 1.58 & 3.57 \\
Variance & 17.22 & 3.35 & 5.17 & 2.13 & 3.33 & 15.60 \\
Kurtosis & 1.22 & 2.45 & 5.37 & 2.04 & 4.93 & 7.62 \\
Skewness & -0.12 & -0.51 & 0.57 & 0.06 & 0.31 & -0.39 \\
Range & 30.33 & 16.79 & 2.18 & 11.51 & 16.50 & 42.57 \\
Minimum & -19.62 & -8.82 & -9.54 & -5.41 & -6.38 & -24.16 \\
Maximum & 11.11 & 7.47 & 11.64 & 6.10 & 9.22 & 17.51 \\
Count & {326} & {316} & {321} & {226} & {426} & {454} \\
    \bottomrule
\end{tabular}
\end{sidewaystable}
\lipsum[11-20] % some text after table
\end{document}

in the both cases the result is the same.

  • however, if the table in your mwe is real one, i don't see any reason to rotate it. it is narrower than text width:

enter image description here

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
%\usepackage[english]{babel}
\usepackage[margin=2.5cm]{geometry}
\usepackage{booktabs, multirow}
\usepackage{siunitx}
\usepackage{lipsum}
\usepackage[labelfont=bf, justification=centering]{caption}

\begin{document}
\lipsum[1-5] % some text before table
    \begin{table}[htb]
\def\arraystretch{1.25}
\setlength{\tabcolsep}{0pt}
    \centering

\caption{Descriptive Statistics on Some Variables}
\parbox{\linewidth}{\small
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.}

\medskip
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                            l
                       *{6}{S}[table-format=-2.2]
                            }
    \toprule
\multicolumn{1}{c}{Description}&{Variable A} & {Variable B} & {Variable C} & {Variable D} & {Variable E} & {Variable F}       \\
\midrule
Mean        &   0.43 &  0.24 &  0.32 &  0.34 &  0.32 &  0.39    \\
Median      &   0.89 &  0.48 &  0.22 &  0.36 &  0.15 &  0.24    \\
Standard Deviation 
            &   4.06 &  1.31 &  2.27 &  1.46 &  1.58 &  3.57    \\
Variance    &  17.22 &  3.35 &  5.17 &  2.13 &  3.33 &  15.60   \\
Kurtosis    &   1.22 &  2.45 &  5.37 &  2.04 &  4.93 &  7.62    \\
Skewness    &  -0.12 & -0.51 &  0.57 &  0.06 &  0.31 & -0.39    \\
Range       &  30.33 & 16.79 &  2.18 & 11.51 & 16.50 &  42.57   \\
Minimum     & -19.62 & -8.82 & -9.54 & -5.41 & -6.38 & -24.16   \\
Maximum     &  11.11 &  7.47 & 11.64 &  6.10 &  9.22 &  17.51   \\
Count       & {326}  & {316} & {321} & {226} & {426} & {454}    \\
    \bottomrule
\end{tabular*}
\end{table}
\lipsum[11-20] % some text after table
\end{document}
  • Perfect! Thank you very much, Mr. @Zarko. I just briefly tried to run the first two, and the environment sidewaystable seems to work flawlessly in my case. My real table contains twice as many columns, hence it would not be able to stand vertically. However, I will be having a couple of tables, which are narrow enough to fit vertically. So I will be using your third option for those. I will try to be more specific with the formulation for my next question. Again, thank you, and have a nice day. – Andreas Apr 23 '18 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.