2

Is there a way to move a table to the next page if it doesn't fit on the current page?

Currently my table goes off the page because it is too high - I'd like it to realise it's too high and therefore move it to the next page.

An example of the generated pdf: example

An example of the source code:

\documentclass{article}

\usepackage[margin=12mm]{geometry}
\usepackage{ucs} 
\usepackage{multicol}
\usepackage{array}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\newenvironment{Table}
  {\par\bigskip\noindent\minipage{\columnwidth}\centering}
  {\endminipage\par\bigskip}

\newenvironment{SCTable}
  {\vspace{-1em}\begin{Table}\begin{tabular}{m{1.4cm} m{2.2cm} m{1.2cm} m{1.2cm} m{1cm}}\hline\\[-1.5ex]}
  {\end{tabular}\end{Table}}



\begin{document}  


\newpage                                            
\begin{table}                                           
\begin{tabular}{rlrlrlrl}                                           
\textbf{Role:}  & DVR   & \textbf{Diagram:} & STP: IF 233: Su   & \textbf{Schedule Applies:}    &  Sun, 28/06/15    & \textbf{Name:}    & \\
\end{tabular}                                           
\end{table}                                         

\begin{multicols}{2}                                            
\vspace{1em}                                            
\begin{SCTable}                                         
\textbf{TAXI}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
    & Ilford Depot  &       & 06:00 &      \\           
        & Shenfield & 06:30 &       &      \\           
\end{SCTable}                                           

\begin{SCTable}                                         
PU  & 5W07  &       &       &      \\           
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{5W07}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
G:72953 & Shenf MSdg    &       & 07:00 & \\            
        & Shenfield & 07:02 &       & 4\\           
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{2W07}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
S:1021  & Shenfield &       & 07:14 & EL/4\\            
G:81492 & Brentwood & 07:17 & 07:17\textonehalf & 3\\           
        & Harold Wood   & 07:21\textonehalf & 07:22 & 3\\           
        & Gidea Park    & 07:25\textonehalf & 07:26 & EL/3\\            
        & Romford   & 07:28 & 07:28\textonehalf & 4\\           
        & Chad. Heath   & 07:32 & 07:32\textonehalf & 3\\           
        & Goodmayes & 07:34 & 07:34\textonehalf & 3\\           
        & Seven Kings   & 07:36 & 07:36\textonehalf & 3\\           
        & Ilford    & 07:38\textonehalf & 07:39 & EL/3\\            
        & Manor Park    & 07:41 & 07:41\textonehalf & EL\\          
        & Forest Gate   & 07:43 & 07:44 & EL/1\\            
        & Maryland  & 07:45\textonehalf & 07:46 & 1\\           
        & Stratford & 07:47\textonehalf & 07:48\textonehalf & EL/5\\            
        & Liverpool St  & 07:56 &       & 16\\          
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{2C10}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
S:0112  & Liverpool St  &       & 08:17 & EL/16\\           
G:86408 & Stratford & 08:23\textonehalf & 08:24\textonehalf & EL/8\\            
        & Forest Gate   & 08:26\textonehalf & 08:27 & EL/2\\            
        & Manor Park    & 08:28\textonehalf & 08:29 & EL\\          
        & Ilford    & 08:31\textonehalf & 08:32 & EL/4\\            
        & Seven Kings   & 08:34 & 08:34\textonehalf & 4\\           
        & Goodmayes & 08:36 & 08:36\textonehalf & 4\\           
        & Chad. Heath   & 08:38 & 08:38\textonehalf & 4\\           
        & Romford   & 08:42 & 08:42\textonehalf & 5\\           
        & Gidea Park    & 08:46 &       & 4\\           
\end{SCTable}                                           

\begin{SCTable}                                         
RELD    & by GP 205  at     & 08.46 &       &      \\           
\end{SCTable}                                           

\begin{SCTable}                                         
PNB &       &       &       &      \\           
\end{SCTable}                                           

\begin{SCTable}                                         
REL & GP 202  at    & 09.46 &       &      \\           
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{5C14}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
G:87908 & Gidea Park    &       & 09:47 & 4\\           
        & Gid Pk MSdg   & 09:49 &       & \\            
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{5C25}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
G:03029 & Gid Pk MSdg   &       & 10:08 & \\            
        & Gidea Park    & 10:10 &       & 3\\           
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{2C25}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
S:1012  & Gidea Park    &       & 10:11 & EL/3\\            
G:11568 & Romford   & 10:13 & 10:13\textonehalf & 4\\           
        & Chad. Heath   & 10:17 & 10:17\textonehalf & 3\\           
        & Goodmayes & 10:19 & 10:19\textonehalf & 3\\           
        & Seven Kings   & 10:21 & 10:21\textonehalf & 3\\           
        & Ilford    & 10:23\textonehalf & 10:24 & EL/3\\            
        & Manor Park    & 10:26 & 10:26\textonehalf & EL\\          
        & Forest Gate   & 10:28 & 10:29 & EL/1\\            
        & Stratford & 10:31\textonehalf & 10:32\textonehalf & EL/5\\            
        & Liverpool St  & 10:41 &       & 16\\          
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{2W28}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
S:0122  & Liverpool St  &       & 11:05 & EL/16\\           
G:66705 & Stratford & 11:11\textonehalf & 11:12\textonehalf & EL/8\\            
        & Maryland  & 11:13\textonehalf & 11:14 & 2\\           
        & Forest Gate   & 11:15\textonehalf & 11:16 & EL/2\\            
        & Manor Park    & 11:17\textonehalf & 11:18 & EL\\          
        & Ilford    & 11:20\textonehalf & 11:21 & EL/4\\            
        & Seven Kings   & 11:23 & 11:23\textonehalf & 4\\           
        & Goodmayes & 11:25 & 11:25\textonehalf & 4\\           
        & Chad. Heath   & 11:27 & 11:27\textonehalf & 4\\           
        & Romford   & 11:31 & 11:31\textonehalf & 5\\           
        & Gidea Park    & 11:34\textonehalf & 11:35 & EL/4\\            
        & Harold Wood   & 11:37\textonehalf & 11:38 & 4\\           
        & Brentwood & 11:42 & 11:42\textonehalf & 4\\           
        & Shenfield & 11:47 &       & 5\\           
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{5W28}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
G:58166 & Shenfield &       & 11:49 & S2/5\\            
        & Shenf MSdg    & 11:52 &       & \\            
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{5W43}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
G:73315 & Shenf MSdg    &       & 12:05 & \\            
        & Shenfield & 12:08 &       & 4\\           
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{2W43}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
S:1021  & Shenfield &       & 12:14 & EL/4\\            
G:81854 & Brentwood & 12:17 & 12:17\textonehalf & 3\\           
        & Harold Wood   & 12:21\textonehalf & 12:22 & 3\\           
        & Gidea Park    & 12:25\textonehalf & 12:26 & EL/3\\            
        & Romford   & 12:28 & 12:28\textonehalf & 4\\           
        & Chad. Heath   & 12:32 & 12:32\textonehalf & 3\\           
        & Goodmayes & 12:34 & 12:34\textonehalf & 3\\           
        & Seven Kings   & 12:36 & 12:36\textonehalf & 3\\           
        & Ilford    & 12:38\textonehalf & 12:39 & EL/3\\            
        & Manor Park    & 12:41 & 12:41\textonehalf & EL\\          
        & Forest Gate   & 12:43 & 12:44 & EL/1\\            
        & Maryland  & 12:45\textonehalf & 12:46 & 1\\           
        & Stratford & 12:47\textonehalf & 12:48\textonehalf & EL/5\\            
        & Liverpool St  & 12:57 &       & 17\\          
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{2C46}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
S:0112  & Liverpool St  &       & 13:17 & EL/17\\           
G:86770 & Stratford & 13:23\textonehalf & 13:24\textonehalf & EL/8\\            
        & Forest Gate   & 13:26\textonehalf & 13:27 & EL/2\\            
        & Manor Park    & 13:28\textonehalf & 13:29 & EL\\          
        & Ilford    & 13:31\textonehalf & 13:32 & EL/4\\            
        & Seven Kings   & 13:34 & 13:34\textonehalf & 4\\           
        & Goodmayes & 13:36 & 13:36\textonehalf & 4\\           
        & Chad. Heath   & 13:38 & 13:38\textonehalf & 4\\           
        & Romford   & 13:42 & 13:42\textonehalf & 5\\           
        & Gidea Park    & 13:46 &       & 4\\           
\end{SCTable}                                           

\begin{SCTable}                                         
RELD    & by GP 205  at     & 13.46 &       &      \\           
\end{SCTable}                                           

\begin{SCTable}                                         
\textbf{PASS}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\         
    & Gidea Park    &       & 13:55 &      \\           
        & Seven Kings   & 14:05 &       &      \\           
    &   &   &   & \\            
\textbf{End of} & \textbf{Diagram}  &   &   & \\            
\end{SCTable}                                           
\end{multicols}                                         



\end{document}
  • Welcome. Normally, this gets done by default so there must be something in your code preventing it from happening. Can you post a small, compilable document here which reproduces the issue? – cfr Jun 26 '15 at 13:27
  • use \raggedbottom in the preamble or use package longtable with the environment of the same name. – user2478 Jun 26 '15 at 13:28
  • I'll have a try with raggedbottom @Herbert. I thought longtable was for spanning multiple pages with the same table? – James Jun 26 '15 at 13:35
  • Out of interest: Are you aware that every line contains multiple spaces and tabs? – Johannes_B Jun 26 '15 at 13:40
  • I see no strange behaviour compiling your code. – Johannes_B Jun 26 '15 at 13:43
1

This is a not-nice hack and upgrading would be a better option. However, if you really need it to work and just cannot upgrade, the following may help. However, you will need to examine the output carefully in case of unwanted side-effects.

\documentclass{article}

\usepackage[margin=12mm]{geometry}
\usepackage{ucs}
\usepackage{multicol}
\usepackage{array}

\usepackage{helvet}
\renewcommand{\familydefault}{\sfdefault}

\newenvironment{SCTable}
{\centering\bigskip\begin{tabular}{m{1.4cm} m{2.2cm} m{1.2cm} m{1.2cm} m{1cm}}\hline\\[-1.5ex]}
  {\end{tabular}\vspace*{\fill}\par\mbox{}\\[-\baselineskip]\bigskip}

\begin{document}

  \newpage
  \begin{table}
    \begin{tabular}{rlrlrlrl}
      \textbf{Role:}  & DVR   & \textbf{Diagram:} & STP: IF 233: Su   & \textbf{Schedule Applies:}    &  Sun, 28/06/15    & \textbf{Name:}    & \\
    \end{tabular}
  \end{table}

  \begin{multicols}{2}
    \vspace{1em}
    \begin{SCTable}
      \textbf{TAXI}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      & Ilford Depot  &       & 06:00 &      \\
      & Shenfield & 06:30 &       &      \\
    \end{SCTable}

    \begin{SCTable}
      PU  & 5W07  &       &       &      \\
    \end{SCTable}

    \begin{SCTable}
      \textbf{5W07}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      G:72953 & Shenf MSdg    &       & 07:00 & \\
      & Shenfield & 07:02 &       & 4\\
    \end{SCTable}

    \begin{SCTable}
      \textbf{2W07}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      S:1021  & Shenfield &       & 07:14 & EL/4\\
      G:81492 & Brentwood & 07:17 & 07:17\textonehalf & 3\\
      & Harold Wood   & 07:21\textonehalf & 07:22 & 3\\
      & Gidea Park    & 07:25\textonehalf & 07:26 & EL/3\\
      & Romford   & 07:28 & 07:28\textonehalf & 4\\
      & Chad. Heath   & 07:32 & 07:32\textonehalf & 3\\
      & Goodmayes & 07:34 & 07:34\textonehalf & 3\\
      & Seven Kings   & 07:36 & 07:36\textonehalf & 3\\
      & Ilford    & 07:38\textonehalf & 07:39 & EL/3\\
      & Manor Park    & 07:41 & 07:41\textonehalf & EL\\
      & Forest Gate   & 07:43 & 07:44 & EL/1\\
      & Maryland  & 07:45\textonehalf & 07:46 & 1\\
      & Stratford & 07:47\textonehalf & 07:48\textonehalf & EL/5\\
      & Liverpool St  & 07:56 &       & 16\\
    \end{SCTable}

    \begin{SCTable}
      \textbf{2C10}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      S:0112  & Liverpool St  &       & 08:17 & EL/16\\
      G:86408 & Stratford & 08:23\textonehalf & 08:24\textonehalf & EL/8\\
      & Forest Gate   & 08:26\textonehalf & 08:27 & EL/2\\
      & Manor Park    & 08:28\textonehalf & 08:29 & EL\\
      & Ilford    & 08:31\textonehalf & 08:32 & EL/4\\
      & Seven Kings   & 08:34 & 08:34\textonehalf & 4\\
      & Goodmayes & 08:36 & 08:36\textonehalf & 4\\
      & Chad. Heath   & 08:38 & 08:38\textonehalf & 4\\
      & Romford   & 08:42 & 08:42\textonehalf & 5\\
      & Gidea Park    & 08:46 &       & 4\\
    \end{SCTable}

    \begin{SCTable}
      RELD    & by GP 205  at     & 08.46 &       &      \\
    \end{SCTable}

    \begin{SCTable}
      PNB &       &       &       &      \\
    \end{SCTable}

    \begin{SCTable}
      REL & GP 202  at    & 09.46 &       &      \\
    \end{SCTable}

    \begin{SCTable}
      \textbf{5C14}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      G:87908 & Gidea Park    &       & 09:47 & 4\\
      & Gid Pk MSdg   & 09:49 &       & \\
    \end{SCTable}

    \begin{SCTable}
      \textbf{5C25}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      G:03029 & Gid Pk MSdg   &       & 10:08 & \\
      & Gidea Park    & 10:10 &       & 3\\
    \end{SCTable}

    \begin{SCTable}
      \textbf{2C25}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      S:1012  & Gidea Park    &       & 10:11 & EL/3\\
      G:11568 & Romford   & 10:13 & 10:13\textonehalf & 4\\
      & Chad. Heath   & 10:17 & 10:17\textonehalf & 3\\
      & Goodmayes & 10:19 & 10:19\textonehalf & 3\\
      & Seven Kings   & 10:21 & 10:21\textonehalf & 3\\
      & Ilford    & 10:23\textonehalf & 10:24 & EL/3\\
      & Manor Park    & 10:26 & 10:26\textonehalf & EL\\
      & Forest Gate   & 10:28 & 10:29 & EL/1\\
      & Stratford & 10:31\textonehalf & 10:32\textonehalf & EL/5\\
      & Liverpool St  & 10:41 &       & 16\\
    \end{SCTable}

    \begin{SCTable}
      \textbf{2W28}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      S:0122  & Liverpool St  &       & 11:05 & EL/16\\
      G:66705 & Stratford & 11:11\textonehalf & 11:12\textonehalf & EL/8\\
      & Maryland  & 11:13\textonehalf & 11:14 & 2\\
      & Forest Gate   & 11:15\textonehalf & 11:16 & EL/2\\
      & Manor Park    & 11:17\textonehalf & 11:18 & EL\\
      & Ilford    & 11:20\textonehalf & 11:21 & EL/4\\
      & Seven Kings   & 11:23 & 11:23\textonehalf & 4\\
      & Goodmayes & 11:25 & 11:25\textonehalf & 4\\
      & Chad. Heath   & 11:27 & 11:27\textonehalf & 4\\
      & Romford   & 11:31 & 11:31\textonehalf & 5\\
      & Gidea Park    & 11:34\textonehalf & 11:35 & EL/4\\
      & Harold Wood   & 11:37\textonehalf & 11:38 & 4\\
      & Brentwood & 11:42 & 11:42\textonehalf & 4\\
      & Shenfield & 11:47 &       & 5\\
    \end{SCTable}

    \begin{SCTable}
      \textbf{5W28}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      G:58166 & Shenfield &       & 11:49 & S2/5\\
      & Shenf MSdg    & 11:52 &       & \\
    \end{SCTable}

    \begin{SCTable}
      \textbf{5W43}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      G:73315 & Shenf MSdg    &       & 12:05 & \\
      & Shenfield & 12:08 &       & 4\\
    \end{SCTable}

    \begin{SCTable}
      \textbf{2W43}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      S:1021  & Shenfield &       & 12:14 & EL/4\\
      G:81854 & Brentwood & 12:17 & 12:17\textonehalf & 3\\
      & Harold Wood   & 12:21\textonehalf & 12:22 & 3\\
      & Gidea Park    & 12:25\textonehalf & 12:26 & EL/3\\
      & Romford   & 12:28 & 12:28\textonehalf & 4\\
      & Chad. Heath   & 12:32 & 12:32\textonehalf & 3\\
      & Goodmayes & 12:34 & 12:34\textonehalf & 3\\
      & Seven Kings   & 12:36 & 12:36\textonehalf & 3\\
      & Ilford    & 12:38\textonehalf & 12:39 & EL/3\\
      & Manor Park    & 12:41 & 12:41\textonehalf & EL\\
      & Forest Gate   & 12:43 & 12:44 & EL/1\\
      & Maryland  & 12:45\textonehalf & 12:46 & 1\\
      & Stratford & 12:47\textonehalf & 12:48\textonehalf & EL/5\\
      & Liverpool St  & 12:57 &       & 17\\
    \end{SCTable}

    \begin{SCTable}
      \textbf{2C46}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      S:0112  & Liverpool St  &       & 13:17 & EL/17\\
      G:86770 & Stratford & 13:23\textonehalf & 13:24\textonehalf & EL/8\\
      & Forest Gate   & 13:26\textonehalf & 13:27 & EL/2\\
      & Manor Park    & 13:28\textonehalf & 13:29 & EL\\
      & Ilford    & 13:31\textonehalf & 13:32 & EL/4\\
      & Seven Kings   & 13:34 & 13:34\textonehalf & 4\\
      & Goodmayes & 13:36 & 13:36\textonehalf & 4\\
      & Chad. Heath   & 13:38 & 13:38\textonehalf & 4\\
      & Romford   & 13:42 & 13:42\textonehalf & 5\\
      & Gidea Park    & 13:46 &       & 4\\
    \end{SCTable}

    \begin{SCTable}
      RELD    & by GP 205  at     & 13.46 &       &      \\
    \end{SCTable}

    \begin{SCTable}
      \textbf{PASS}   & \textbf{Location} & \textbf{Arr}  & \textbf{Dep}  & \textbf{Lne/Pf}\\
      & Gidea Park    &       & 13:55 &      \\
      & Seven Kings   & 14:05 &       &      \\
      &   &   &   & \\
      \textbf{End of} & \textbf{Diagram}  &   &   & \\
    \end{SCTable}

  \end{multicols}

\end{document}

This is the output with TeX Live 2014:

hack

An updated TeX Live 2015 does not need this hack. The original code works perfectly in this case (apart from the numerous overfull \hbox warnings).

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.