# Modifying the latex code from tabular() in r so that output is not cut off and is displayed properly?

I am using the r function tabular() to produce tables that I can turn into pdfs. The output looks fine, except for some of the tables I am producing. When I compile the pdfs, the table is cutoff on the page, in the sense that it should continue onto another page but there is no other page of output but the latex code is there for the rest of the table. The tables are sometimes not quite centered either. Is there a simple option I am missing in tabular that will remedy this? Below is the stuff I have added to the latex() output from r. Thanks.

\documentclass{article}
\usepackage{rotating}
\begin{document}
\pagenumbering{gobble}
\begin{sidewaysfigure}
\begin{tabular}

.....

\end{tabular}
\end{sidewaysfigure}
\end{document}

-

## migrated from stackoverflow.comMar 7 '13 at 13:52

This question came from our site for professional and enthusiast programmers.

Latex is not going to add pages that should be on the right. It's gonna add pages in the bottom, but not on the right. You can try to center your tabulars using begin{center}. For the tabular not to disappear on the right of your page, you have to format your lines so that they are written on multiple lines. – double_squeeze Mar 6 '13 at 1:40

\documentclass{article}
\usepackage{longtable,pdflscape}
\begin{document}
\begin{landscape}% starts a new page
\begin{longtable}{...}

.....

\end{longtable}
\end{landscape}

foo
\end{document}

-
Can you please add some explanation why your code solves the problem? So it could be hard for someone to understand what is going on ... – Kurt May 6 '13 at 14:34

You should really go to the LaTeX site for pure latex questions, but you could try

...
\scalebox{0.8}{
\begin{tabular}
...
\end{tabular}
}
...


Also to break the table over multiple pages, you can use

tab <- tabular(...)
latex(tab, options = list(tabular = longtable)


as mentioned in the comment to your former question

Other than that, as suggested, I would ask the good folks at the LateX site...

-
This is not a good solution at all. You should never scale a table. You might, sensibly and consistenly, use a smaller font, but even that is frowned upon in many situations. – yo' May 6 '13 at 15:42