2

The formatting guidelines that I am bound to require me to have tables either at the top or bottom of a page. Up to now, I used a longtable for every table - even if it does not span multiple pages (but for the sake of consistency).

I found a post by Mico and his proposal to use afterpage which seems to go in the right direction. However, in the following example, the table does not start on the next page as desired but on the page after that. Is there a way to force it on the next page (without manual typesetting)?

\documentclass[]{scrbook}

\usepackage{afterpage} 
\usepackage{longtable}
\usepackage{blindtext}


\begin{document}

    \blindtext[1]
    This is where I inserted afterpage. 

    \afterpage{%
        \footnotesize
        \renewcommand*{\arraystretch}{1.2}
        \begin{longtable}{{ll}}
            \caption{some text}\\
            Head & Head \\
            A & B\\ 
        \end{longtable}
    }

    \blindtext[5]
\end{document}

image

  • If you comment out the blindtext[5] then the table appears at the top of page 2. It must be something about the additional text that's forcing it onto page 3. Can you footnote it instead? That would force it to the bottom of the page. – wolf_math Feb 26 '17 at 1:33
  • @wolf_math Thanks for the suggestion! However, I guess that I would have to change a couple of things if I would move the table in a footnote, is there another way? – Max Feb 26 '17 at 2:38
1

You need a \par at the end:

\documentclass[]{scrbook}

\usepackage{afterpage}
\usepackage{longtable}
\usepackage{blindtext}


\begin{document}

    \blindtext[1]
    This is where I inserted afterpage.

    \afterpage{%
        \footnotesize
        \renewcommand*{\arraystretch}{1.2}
        \begin{longtable}{{ll}}
            \caption{some text}\\
            Head & Head \\
            A & B\\
        \end{longtable}
    }

    \blindtext[5]\par %<--- or an empty line ...
\end{document}

But imho it would be much better to use a normal float like table + tabular.

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.