0

I am trying to make a table, but when I make the PDF, the top and bottom of the table are cut off. I am also getting a blank page of output in the beginning, but I can deal with that. I have tried running just portions of the table, and I get all the output up until a certain point, after which only the middle of the table is displayed in the PDF I generate. I have tried doing the longtable option and I can't even get it to make a PDF when I do that. I am new to LaTeX, and not really sure what I am doing wrong. I am trying to create something similar to below. Any advice is greatly appreciated.

\documentclass{article}
\usepackage{rotating}
\usepackage[margin=.25in]{geometry} % 1 inch margins all around

%\usepackage{longtable}

\begin{document}
\pagenumbering{gobble}

\begin{center}

\begin{sidewaysfigure}



\begin{tabular}{lllccccccc}
\hline
& & & \multicolumn{7}{c}{C2} \\ 
 & C1 &  & r & s & t & u & v & w & \multicolumn{1}{c}{y} \\ 
\hline
a1 & \nopagebreak a & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak b & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $0$ & $\phantom{0}0$ & $0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak c & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \rule{0pt}{1.7\normalbaselineskip}d & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak e & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak f & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \rule{0pt}{1.7\normalbaselineskip}g & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X3  & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X4  & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X5  & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X6  & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 & \nopagebreak h & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X3  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X4  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X5  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X6  & $0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 & \nopagebreak j & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \rule{0pt}{1.7\normalbaselineskip}k & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak l & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak m & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \rule{0pt}{1.7\normalbaselineskip}n & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak o & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X3  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X4  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X5  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 &  & X6  & $\phantom{00}0$ & $\phantom{00}0$ & $0$ & $0$ & $0$ & $\phantom{00}0$ & $\phantom{00}0$ \\
 & \nopagebreak p & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X3  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X4  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X5  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X6  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 & \rule{0pt}{1.7\normalbaselineskip}q & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ \\
 &  & X2  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X3  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X4  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X5  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
 &  & X6  & $\phantom{00}0$ & $0$ & $0$ & $0$ & $0$ & $0$ & $0$ \\
\hline 
\end{tabular}

\end{sidewaysfigure}

\end{center}

\end{document}
2
  • Welcome to TeX.sx! Why do you want to rotate the table? Mar 7, 2013 at 15:22
  • I think (I may be completely wrong, just more of a precautionary measure) it will be necessary to rotate the table because some of the data values may be wide and could cause a portrait-oriented table to be too wide for a page. I am not concerned if all rows don't fit on a particular page. I would just like all columns fit on the same page.
    – user27008
    Mar 7, 2013 at 15:41

1 Answer 1

2

I think it's impossible to make such tables fit in landscape mode. You do mention that you tried the longtable package, so I assume you prefer a solution with longtable.

Below I edited your example for a solution with longtable. To keep the example short, I only put in one row in the body of the table and omitted all other rows.

Let me know if there's something wrong with this solution and I'll see if I can come up with a better solution.

\documentclass{article}
\usepackage[margin=.25in]{geometry} % 1 inch margins all around

\usepackage{longtable}
\usepackage{booktabs}

\newcommand*\PHZ{$\phantom{00}0$}
\newcommand*\ZO{$0$}

\begin{document}

\begin{longtable}{lllccccccc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \toprule
  \multicolumn{10}{r}{\textbf{Start of Table}}
\\\midrule
    & & & \multicolumn{7}{c}{C2}
\\  & C1 &  & r & s & t & u & v & w & \multicolumn{1}{c}{y}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \endfirsthead
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \toprule
  \multicolumn{10}{r}{\textbf{Table Continued}}
\\\midrule
    & & & \multicolumn{7}{c}{C2}
\\  & C1 &  & r & s & t & u & v & w & \multicolumn{1}{c}{y}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \endhead
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\\\bottomrule
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \endfoot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\\\bottomrule
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \endlastfoot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\\\midrule
  a1 &a & X1  & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$ & $\phantom{0}0$
\\   &  & X2  & \ZO & \PHZ & \ZO & \ZO & \ZO & \PHZ & \PHZ
% snip
\end{longtable}

\end{document}
2
  • Thanks for advice. I made the changes to my code, and got your way to run for the entire example I posted. When I put in other data to run it on, I got the following error numerous times Overfull \hbox {...pt too wide} in alignment. I tried using %\begin{adjustbox}{width={1mm},totalheight={1mm},keepaspectratio} from \usepackage{adjustbox}, but that gave me a whole host of other errors.
    – user27008
    Mar 7, 2013 at 18:52
  • I think I got it now. I just had to change the number of columns in the \multicolumn{}. Thanks.
    – user27008
    Mar 8, 2013 at 20:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .