[Tex/LaTex] How to avoid page break after table

page-breakingrtablesxtable

I have a small LaTeX table (tabular) created in R with the xtable package and I would like to place a figure underneath the table on the SAME page. I have tried various things (using packages float, needspace, etoolbox, etc etc), but I don't seem to get it completely right… It also doesn't work if I just put random text after the table.

How can I force to not have a page break after the table?

My code looks like this (omitting the packages) :

\documentclass[a4paper, 11pt]{article}

\begin{document}

\include{small_table}

\begin{figure}
   \includegraphics{piechart.eps}
\end{figure}

\end{document}

Because I make the small table file from R, I want to avoid altering that file. However it looks something like this:

\begin{table}[ht]
\centering
  \begin{tabular}{lc}
     bla & bla 
  \end{tabular}
\end{table}

Thank you!

Best Answer

\include _always forces a page break, use \input, and then allow the figure to be on the same page by including h in its option.

\documentclass[a4paper, 11pt]{article}

\begin{document}

\input{small_table}

\begin{figure}[htp]
   \includegraphics{piechart.eps}
\end{figure}

\end{document}
Related Question