I currently have a regression output from Stargazer (r package), which I edited into a sideways table, and made it fit to textwidth. However I wanted to try and split the table into 2 pages, in the current format (so also fit to textwidth and sideways), but I haven't been able to figure this out. I've tried lscape and longtable, but I always lose one of the three components when I attempt this.
Does anyone have a working solution? My code and the current table output is shown below.
My current code which cannot be in longtable format:
\documentclass[12pt]{article}
\usepackage[figuresleft]{rotating}
\begin{sidewaystable}[h!] \centering
\caption{Results of regression analysis}
\label{}
\resizebox{\textwidth}{!}{\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
*lot of table data *
*lot of table data *
\end{tabular}}
\end{sidewaystable}
Another code which I tried using lscape
and longtable
but ends in an error log:
documentclass[12pt]{article}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{lscape}
\begin{landscape}
\resizebox{\textwidth}{!}{\begin{longtable}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
\caption{Results of regression analysis}
\label{}
*lot of data*
*lot of data*
\end{longtable}}
\end{landscape}
In both cases I use geometry
for page layout with
\newgeometry{left=30mm,right=30mm,top=20mm}
Best Answer
I am making the following assumptions:
I had to fix some things in your code and add packages to work etc.
My trick was to divide the two last rows (Residual error and F) into 4 rows, hope that is not a problem for you. With this solution it was not necessary to change the document margins. Because other then that, the table would never fit a a4paper, regardless of the orientation.
I was also unable to break the table at a column,
longtable
and others work only for rows...Packages:
threeparttablex
allows for a proper longtable notes with possible labeling and cross-references etc. Read more in the manual: here.booktabs
for more professional looking tabs and to avoid wasting space.pdflscape
to rotate the pages but still allow normal printing.longtable
andmultirow
are kind of obvious.