[Tex/LaTex] long table in landscape environment

landscapelongtablepage-numbering

I am trying to insert a longtable in the landscape environment. Following some Google queries I found this stack overflow question "How do I make multi page landscape tables in LaTeX".

I followed their code however now in the output PDF only the last page of the longtable is rotated in the PDF (so you have to tilt your head to see the first 2 pages of the longtable. I would like all the pages to be rotated like page three in the pdf output. Here is the code (sorry its pretty long!)

\documentclass[pdftex, a4paper, 12pt]{article}
\usepackage{lscape}
\usepackage{longtable}
\begin{document}

\begin{landscape}
\label{tab_rf_ff}
\centering     % optional, probably makes it look better to have it centered on the page
\begin{longtable}{p{1.5cm} |  rrrr | p{2cm} p{2cm} r | p{2cm} p{2cm}r | rr}
\hline
Model number & mtry & node.size & ntree & replace & Mean test RMSE & Median test RMSE & SE & Mean OOB RMSE & median OOB RMSE & SE & Median leaf \\ 
  \hline
 43 &   2 &  20 & 500 &   0 & 50.13 & 34.25 & 2.88 & 65.24 & 71.54 & 1.06 &  16 \\ 
   52 &   2 &  20 & 750 &   0 & 50.15 & 34.73 & 2.88 & 65.23 & 71.51 & 1.06 &  16 \\ 
   34 &   2 &  20 & 250 &   0 & 50.19 & 34.64 & 2.88 & 65.28 & 71.51 & 1.06 &  16 \\ 
    7 &   2 &  20 & 250 &   1 & 50.64 & 35.02 & 2.85 & 65.55 & 71.81 & 1.06 &  25 \\ 
   25 &   2 &  20 & 750 &   1 & 50.67 & 35.11 & 2.85 & 65.49 & 71.91 & 1.06 &  25 \\ 
   16 &   2 &  20 & 500 &   1 & 50.69 & 34.97 & 2.85 & 65.51 & 71.69 & 1.06 &  25 \\ 
   53 &   4 &  20 & 750 &   0 & 51.16 & 35.92 & 2.83 & 65.82 & 72.16 & 1.07 &  16 \\ 
   35 &   4 &  20 & 250 &   0 & 51.18 & 36.14 & 2.83 & 65.88 & 72.14 & 1.07 &  16 \\ 
   44 &   4 &  20 & 500 &   0 & 51.20 & 35.70 & 2.83 & 65.84 & 72.09 & 1.07 &  16 \\ 
   40 &   2 &   5 & 500 &   0 & 51.62 & 36.80 & 2.80 & 66.02 & 72.32 & 1.07 &  77 \\ 
   31 &   2 &   5 & 250 &   0 & 51.69 & 37.28 & 2.80 & 66.14 & 72.53 & 1.08 &  77 \\ 
   49 &   2 &   5 & 750 &   0 & 51.72 & 36.51 & 2.79 & 66.01 & 72.25 & 1.07 &  77 \\ 
   17 &   4 &  20 & 500 &   1 & 51.95 & 37.35 & 2.79 & 66.28 & 72.63 & 1.07 &  25 \\ 
   26 &   4 &  20 & 750 &   1 & 52.03 & 37.08 & 2.78 & 66.26 & 72.64 & 1.07 &  25 \\ 
   13 &   2 &   5 & 500 &   1 & 52.09 & 37.20 & 2.77 & 66.31 & 72.51 & 1.07 & 107 \\ 
   22 &   2 &   5 & 750 &   1 & 52.09 & 36.71 & 2.77 & 66.23 & 72.45 & 1.07 & 107 \\ 
    4 &   2 &   5 & 250 &   1 & 52.09 & 37.12 & 2.78 & 66.38 & 72.56 & 1.07 & 107 \\ 
    8 &   4 &  20 & 250 &   1 & 52.18 & 36.92 & 2.77 & 66.43 & 72.71 & 1.08 &  25 \\ 
   10 &   2 &   1 & 500 &   1 & 52.45 & 38.30 & 2.76 & 66.57 & 72.96 & 1.07 & 171 \\ 
   46 &   2 &   1 & 750 &   0 & 52.47 & 38.41 & 2.77 & 66.56 & 72.85 & 1.08 & 171 \\ 
   19 &   2 &   1 & 750 &   1 & 52.49 & 38.20 & 2.76 & 66.53 & 72.79 & 1.07 & 171 \\ 
   37 &   2 &   1 & 500 &   0 & 52.57 & 38.38 & 2.76 & 66.59 & 72.90 & 1.07 & 171 \\ 
    1 &   2 &   1 & 250 &   1 & 52.64 & 37.79 & 2.75 & 66.77 & 73.19 & 1.08 & 171 \\ 
   28 &   2 &   1 & 250 &   0 & 52.74 & 38.40 & 2.74 & 66.79 & 73.17 & 1.08 & 171 \\ 
   45 &   9 &  20 & 500 &   0 & 52.91 & 38.77 & 2.74 & 66.98 & 73.49 & 1.11 &  16 \\ 
   36 &   9 &  20 & 250 &   0 & 53.05 & 39.53 & 2.74 & 67.05 & 73.44 & 1.11 &  16 \\ 
   54 &   9 &  20 & 750 &   0 & 53.05 & 39.04 & 2.74 & 66.98 & 73.34 & 1.11 &  16 \\ 
   50 &   4 &   5 & 750 &   0 & 53.38 & 39.36 & 2.73 & 67.12 & 73.53 & 1.09 &  77 \\ 
   32 &   4 &   5 & 250 &   0 & 53.42 & 39.22 & 2.72 & 67.21 & 73.50 & 1.10 &  77 \\ 
   41 &   4 &   5 & 500 &   0 & 53.49 & 39.62 & 2.72 & 67.13 & 73.31 & 1.09 &  77 \\ 
   27 &   9 &  20 & 750 &   1 & 53.91 & 40.12 & 2.72 & 67.59 & 73.89 & 1.09 &  25 \\ 
   18 &   9 &  20 & 500 &   1 & 53.93 & 39.87 & 2.72 & 67.62 & 74.03 & 1.09 &  25 \\ 
    9 &   9 &  20 & 250 &   1 & 53.97 & 40.51 & 2.72 & 67.73 & 74.08 & 1.09 &  25 \\ 
    5 &   4 &   5 & 250 &   1 & 54.01 & 40.31 & 2.69 & 67.59 & 74.20 & 1.10 & 104 \\ 
   23 &   4 &   5 & 750 &   1 & 54.03 & 39.52 & 2.68 & 67.38 & 73.79 & 1.10 & 104 \\ 
   14 &   4 &   5 & 500 &   1 & 54.14 & 40.62 & 2.68 & 67.47 & 73.87 & 1.10 & 104 \\ 
    2 &   4 &   1 & 250 &   1 & 54.46 & 40.57 & 2.68 & 68.08 & 74.31 & 1.10 & 169 \\ 
   20 &   4 &   1 & 750 &   1 & 54.48 & 40.76 & 2.67 & 67.78 & 74.08 & 1.10 & 170 \\ 
   47 &   4 &   1 & 750 &   0 & 54.48 & 41.27 & 2.69 & 67.92 & 74.29 & 1.10 & 169 \\ 
   38 &   4 &   1 & 500 &   0 & 54.54 & 40.62 & 2.68 & 68.02 & 74.46 & 1.10 & 169 \\ 
   11 &   4 &   1 & 500 &   1 & 54.54 & 39.86 & 2.67 & 67.83 & 74.07 & 1.10 & 169 \\ 
   29 &   4 &   1 & 250 &   0 & 54.72 & 41.83 & 2.66 & 68.15 & 74.04 & 1.10 & 169 \\ 
   33 &   9 &   5 & 250 &   0 & 55.13 & 42.88 & 2.69 & 68.69 & 74.69 & 1.09 &  76 \\ 
   51 &   9 &   5 & 750 &   0 & 55.15 & 43.81 & 2.68 & 68.45 & 74.63 & 1.10 &  76 \\ 
   42 &   9 &   5 & 500 &   0 & 55.40 & 43.78 & 2.67 & 68.65 & 74.95 & 1.10 &  76 \\ 
   24 &   9 &   5 & 750 &   1 & 55.77 & 44.96 & 2.65 & 68.85 & 75.22 & 1.11 & 101 \\ 
   15 &   9 &   5 & 500 &   1 & 55.89 & 44.75 & 2.64 & 68.89 & 75.11 & 1.11 & 101 \\ 
    6 &   9 &   5 & 250 &   1 & 55.98 & 44.66 & 2.64 & 69.07 & 75.36 & 1.12 & 101 \\ 
   21 &   9 &   1 & 750 &   1 & 56.33 & 46.81 & 2.63 & 69.46 & 75.48 & 1.12 & 162 \\ 
   48 &   9 &   1 & 750 &   0 & 56.33 & 46.41 & 2.65 & 69.63 & 75.49 & 1.11 & 161 \\ 
   12 &   9 &   1 & 500 &   1 & 56.37 & 45.51 & 2.64 & 69.48 & 75.57 & 1.13 & 162 \\ 
   30 &   9 &   1 & 250 &   0 & 56.49 & 46.09 & 2.64 & 69.91 & 75.55 & 1.12 & 161 \\ 
    3 &   9 &   1 & 250 &   1 & 56.49 & 46.31 & 2.62 & 69.70 & 75.46 & 1.13 & 162 \\ 
   39 &   9 &   1 & 500 &   0 & 56.65 & 47.81 & 2.64 & 69.78 & 75.96 & 1.13 & 161 \\ 
   \hline
\caption{Accuracy results for forest fires random forest}
\end{longtable}
\end{landscape}

\end{document}

Also how can I get the page numbers to appear in the correct place on landscape pages?

Best Answer

If using pdflatex you may prefer pdflscape to the lscape package, which inserts some extra instructions to the pdf viewer. (note that pdf viewers often auto-rotate pages to get what they think is the correct reading orientation and they don't always get this right) You ask how to get the page numbers in the right place, but you don't say where that place is. lscape puts them where it (I) thought was right.