TransWikia.com

Turn table including appendix title

TeX - LaTeX Asked by Luuk van Gasteren on February 28, 2021

The following code is my table. I want to turn this table including the appendix section title 90 degrees clockwise. I know begin{landscape} can do this but it only turns it 90 degrees counter clockwise. Also, I want to be able to shift the table manually (by for example hskip, like I did in the code below) on the rotated page. How can I do this?

documentclass[11pt,a4paper]{article}
begin{document}

newpage
section{VIF Tests Postcode Level Data Set}label{appendix D}
begin{table}[H]
small
centering
hskip-2cmbegin{tabular}{l|llllllllllllll}hline
       textit{Table} & textbf{Houses}     & textbf{Single}     & textbf{Food/}   & textbf{Own/}   & textbf{Married/}    & textbf{Two-}   & textbf{Three-}    & textbf{Five-}   & textbf{Four-}    & textbf{Dutch/}   & textbf{Men/}  & textbf{Age}  & textbf{Houses} & textbf{Houses}    
      textit{4:} & textbf{before} & textbf{Adult} & textbf{Non-Food} & textbf{Rent} & textbf{Non-} & textbf{Person} & textbf{Person} & textbf{or-more} & textbf{Person} & textbf{Foreign} & textbf{Women} & textbf{$<$ 65/} & textbf{’60-’69} & textbf{’70-’79}
      
      textit{VIF} & textbf{'59}  & textbf{$<$ 65} & textbf{Ratio} & textbf{Ratio} & textbf{Married} & textbf{House-} & textbf{House-} & textbf{-Person} & textbf{House-} & textbf{Ratio} &  textbf{Ratio} & textbf{Age} 
      
      textit{Tests} & &textbf{House-} &&& textbf{Ratio}  & textbf{holds} & textbf{holds} & textbf{House-} & textbf{holds} &&& textbf{$geq$ 65}
      
      && textbf{holds}&&&&&&textbf{holds}&&&& textbf{Ratio}
      
      hline hline
textbf{VIF1}  & 12.75  & 28.55  & 1.56 & 2.23 & 12.14 & 4.40 & 7.03  & 3.16 & 16.19 & 3.02  & 1.80 & 4.61 & 7.96   & 3.46   
textbf{VIF2}  & 144.80 & 179.48 & 2.83 & 4.13 & 29.01 & 9.46 & 13.47 & 6.02 & 32.65 & 13.55 & 3.45 & 8.05 & textcolor{red}{234.14} & 48.04  
textbf{VIF3}  & 15.91  & 36.21  & 2.82 & 4.09 & 28.71 & 9.41 & 12.22 & 5.76 & 26.98 & 13.44 & 3.28 & 7.87 &        & 7.75   
textbf{VIF4}  & 15.76  & textcolor{red}{36.19}  & 2.69 & 3.74 & 28.70 & 9.41 & 12.20 & 5.75 & 26.96 & 13.44 & 3.28 & 7.74 &        & 7.75   
textbf{VIF5}  & 9.13   &        & 2.69 & 3.72 & textcolor{red}{27.89} & 9.12 & 11.62 & 5.75 & 24.43 & 12.24 & 3.24 & 6.94 &        & 6.58   
textbf{VIF6}  & 8.93   &        & 2.69 & 3.28 &       & 6.14 & 11.62 & 5.71 & 18.81 & 12.20 & 3.23 & 6.49 &        & 6.06   
textbf{VIF7}  & 8.84   &        & 2.68 & 3.28 &       & 6.08 & 11.61 & 5.65 & textcolor{red}{18.25} & 12.15 & 3.23 & 6.26 &        & 5.87   
textbf{VIF8}  & 8.84   &        & 2.68 & 3.25 &       & 5.32 & 8.15  & 5.41 &       & 10.47 & 3.22 & 6.26 &        & 5.86   
textbf{VIF9}  & 6.19   &        & 2.33 & 2.91 &       & 3.66 & 6.93  & 4.50 &       & 8.79  & 2.48 & 5.89 &        & 5.62   
textbf{VIF10} & 6.15   &        & 2.33 & 2.88 &       & 3.48 & 6.36  & 4.50 &       & 8.67  & 2.26 & 5.89 &        & 3.69   
textbf{VIF11} & 4.84   &        & 1.99 & 2.73 &       & 3.35 & 6.22  & 4.49 &       & 7.57  & 2.06 & 5.72 &        & 3.53  
hline
end{tabular}
end{table}

2 Answers

Please try with this:

documentclass{book}
usepackage{float,xcolor}
usepackage{rotating}
begin{document}

begin{sidewaystable}
section{VIF Tests Postcode Level Data Setlabel{appendix D}}
small
centering
hskip-12cmbegin{tabular}{l|llllllllllllll}hline
       textit{Table} & textbf{Houses}     & textbf{Single}     & textbf{Food/}   & textbf{Own/}   & textbf{Married/}    & textbf{Two-}   & textbf{Three-}    & textbf{Five-}   & textbf{Four-}    & textbf{Dutch/}   & textbf{Men/}  & textbf{Age}  & textbf{Houses} & textbf{Houses}    
      textit{4:} & textbf{before} & textbf{Adult} & textbf{Non-Food} & textbf{Rent} & textbf{Non-} & textbf{Person} & textbf{Person} & textbf{or-more} & textbf{Person} & textbf{Foreign} & textbf{Women} & textbf{$<$ 65/} & textbf{’60-’69} & textbf{’70-’79}
      
      textit{VIF} & textbf{'59}  & textbf{$<$ 65} & textbf{Ratio} & textbf{Ratio} & textbf{Married} & textbf{House-} & textbf{House-} & textbf{-Person} & textbf{House-} & textbf{Ratio} &  textbf{Ratio} & textbf{Age} 
      
      textit{Tests} & &textbf{House-} &&& textbf{Ratio}  & textbf{holds} & textbf{holds} & textbf{House-} & textbf{holds} &&& textbf{$geq$ 65}
      
      && textbf{holds}&&&&&&textbf{holds}&&&& textbf{Ratio}
      
      hline hline
textbf{VIF1}  & 12.75  & 28.55  & 1.56 & 2.23 & 12.14 & 4.40 & 7.03  & 3.16 & 16.19 & 3.02  & 1.80 & 4.61 & 7.96   & 3.46   
textbf{VIF2}  & 144.80 & 179.48 & 2.83 & 4.13 & 29.01 & 9.46 & 13.47 & 6.02 & 32.65 & 13.55 & 3.45 & 8.05 & textcolor{red}{234.14} & 48.04  
textbf{VIF3}  & 15.91  & 36.21  & 2.82 & 4.09 & 28.71 & 9.41 & 12.22 & 5.76 & 26.98 & 13.44 & 3.28 & 7.87 &        & 7.75   
textbf{VIF4}  & 15.76  & textcolor{red}{36.19}  & 2.69 & 3.74 & 28.70 & 9.41 & 12.20 & 5.75 & 26.96 & 13.44 & 3.28 & 7.74 &        & 7.75   
textbf{VIF5}  & 9.13   &        & 2.69 & 3.72 & textcolor{red}{27.89} & 9.12 & 11.62 & 5.75 & 24.43 & 12.24 & 3.24 & 6.94 &        & 6.58   
textbf{VIF6}  & 8.93   &        & 2.69 & 3.28 &       & 6.14 & 11.62 & 5.71 & 18.81 & 12.20 & 3.23 & 6.49 &        & 6.06   
textbf{VIF7}  & 8.84   &        & 2.68 & 3.28 &       & 6.08 & 11.61 & 5.65 & textcolor{red}{18.25} & 12.15 & 3.23 & 6.26 &        & 5.87   
textbf{VIF8}  & 8.84   &        & 2.68 & 3.25 &       & 5.32 & 8.15  & 5.41 &       & 10.47 & 3.22 & 6.26 &        & 5.86   
textbf{VIF9}  & 6.19   &        & 2.33 & 2.91 &       & 3.66 & 6.93  & 4.50 &       & 8.79  & 2.48 & 5.89 &        & 5.62   
textbf{VIF10} & 6.15   &        & 2.33 & 2.88 &       & 3.48 & 6.36  & 4.50 &       & 8.67  & 2.26 & 5.89 &        & 3.69   
textbf{VIF11} & 4.84   &        & 1.99 & 2.73 &       & 3.35 & 6.22  & 4.49 &       & 7.57  & 2.06 & 5.72 &        & 3.53  
hline
end{tabular}
end{sidewaystable}

clearpage

begin{sidewaystable}
section{VIF Tests Postcode Level Data Setlabel{appendix D}}
small
centering
hskip-12cmbegin{tabular}{l|llllllllllllll}hline
       textit{Table} & textbf{Houses}     & textbf{Single}     & textbf{Food/}   & textbf{Own/}   & textbf{Married/}    & textbf{Two-}   & textbf{Three-}    & textbf{Five-}   & textbf{Four-}    & textbf{Dutch/}   & textbf{Men/}  & textbf{Age}  & textbf{Houses} & textbf{Houses}    
      textit{4:} & textbf{before} & textbf{Adult} & textbf{Non-Food} & textbf{Rent} & textbf{Non-} & textbf{Person} & textbf{Person} & textbf{or-more} & textbf{Person} & textbf{Foreign} & textbf{Women} & textbf{$<$ 65/} & textbf{’60-’69} & textbf{’70-’79}
      
      textit{VIF} & textbf{'59}  & textbf{$<$ 65} & textbf{Ratio} & textbf{Ratio} & textbf{Married} & textbf{House-} & textbf{House-} & textbf{-Person} & textbf{House-} & textbf{Ratio} &  textbf{Ratio} & textbf{Age} 
      
      textit{Tests} & &textbf{House-} &&& textbf{Ratio}  & textbf{holds} & textbf{holds} & textbf{House-} & textbf{holds} &&& textbf{$geq$ 65}
      
      && textbf{holds}&&&&&&textbf{holds}&&&& textbf{Ratio}
      
      hline hline
textbf{VIF1}  & 12.75  & 28.55  & 1.56 & 2.23 & 12.14 & 4.40 & 7.03  & 3.16 & 16.19 & 3.02  & 1.80 & 4.61 & 7.96   & 3.46   
textbf{VIF2}  & 144.80 & 179.48 & 2.83 & 4.13 & 29.01 & 9.46 & 13.47 & 6.02 & 32.65 & 13.55 & 3.45 & 8.05 & textcolor{red}{234.14} & 48.04  
textbf{VIF3}  & 15.91  & 36.21  & 2.82 & 4.09 & 28.71 & 9.41 & 12.22 & 5.76 & 26.98 & 13.44 & 3.28 & 7.87 &        & 7.75   
textbf{VIF4}  & 15.76  & textcolor{red}{36.19}  & 2.69 & 3.74 & 28.70 & 9.41 & 12.20 & 5.75 & 26.96 & 13.44 & 3.28 & 7.74 &        & 7.75   
textbf{VIF5}  & 9.13   &        & 2.69 & 3.72 & textcolor{red}{27.89} & 9.12 & 11.62 & 5.75 & 24.43 & 12.24 & 3.24 & 6.94 &        & 6.58   
textbf{VIF6}  & 8.93   &        & 2.69 & 3.28 &       & 6.14 & 11.62 & 5.71 & 18.81 & 12.20 & 3.23 & 6.49 &        & 6.06   
textbf{VIF7}  & 8.84   &        & 2.68 & 3.28 &       & 6.08 & 11.61 & 5.65 & textcolor{red}{18.25} & 12.15 & 3.23 & 6.26 &        & 5.87   
textbf{VIF8}  & 8.84   &        & 2.68 & 3.25 &       & 5.32 & 8.15  & 5.41 &       & 10.47 & 3.22 & 6.26 &        & 5.86   
textbf{VIF9}  & 6.19   &        & 2.33 & 2.91 &       & 3.66 & 6.93  & 4.50 &       & 8.79  & 2.48 & 5.89 &        & 5.62   
textbf{VIF10} & 6.15   &        & 2.33 & 2.88 &       & 3.48 & 6.36  & 4.50 &       & 8.67  & 2.26 & 5.89 &        & 3.69   
textbf{VIF11} & 4.84   &        & 1.99 & 2.73 &       & 3.35 & 6.22  & 4.49 &       & 7.57  & 2.06 & 5.72 &        & 3.53  
hline
end{tabular}
end{sidewaystable}

end{document}

Answered by MadyYuvi on February 28, 2021

It is not entirely clear, what you after. The following solution rotate table on the way as you show in image in comment (if I understood it correct, you like to have section titles and top of table at left page border, what is by the way is at odds with the intuitive layout).

Use hskip-2cm to shift table is not good idea. Better is to change geometry of this page (by use of newgeometry from geometry package or by use changetext defined in the changetext package. However, with proposed redesign (see MWE below) this shift or increasing text area size is not needed anymore.

Off-topics remarks:

  • Due to wide column headers your table is wider (using even footnotesize font size) that can be fit on page (this you try compensate with hskip=-2cm, isn't it?).
  • Column headers can become narrower if you rotate them, for example by rothed command defined in the makecell package
  • numbers in table is easier compare if they are aligned at decimal points. For this is handy S column type defined in the siunitx package.
  • Use of S columns enables simple annotate some numbers in the table by help of etoolbox package.

MWE

documentclass{article}
usepackage[table]{xcolor}
usepackage[figuresleft]
            {rotating}
usepackage{booktabs, makecell}
renewcommandtheadfont{smallbfseries}
usepackage{siunitx}
usepackage{etoolbox}
newrobustcmdB{DeclareFontSeriesDefault[rm]{bf}{b}% for annotate numbers
                bfseriescolor{red}}                          %

begin{document}
    setcounter{page}{77}
    begin{sidewaystable*}
setlengthtabcolsep{0pt}
settowidthrotheadsize{theadfont Own/Rent Ratio}
    sisetup{detect-weight,
             mode=text}
section{VIF Tests Postcode Level Data Set}
label{appendix D}
%
begin{tabular*}{linewidth}{@{extracolsep{fill}} >{bfseries}l 
                                *{2}{S[table-format=3.2] }
                                *{2}{S[table-format=1.2] }
                                *{2}{S[table-format=2.2]S[table-format=1.2]}
                                *{3}{S[table-format=2.2]}     
                                      S[table-format=1.2]
                                      S[table-format=3.2]
                                      S[table-format=2.2]}
   toprule
normalfontitshape
makecell{Table 4:
          VIF Tests}
        & {rothead{Houses before 1959}}
            & {rothead{Single Adult $<65$ Households}}
                & {rothead{Food/Non-Food Ratio}}
                    & {rothead{Own/Rent Ratio}}
                        & {rothead{Married/Non Married Ratio}}
                            & {rothead{Two-Person Households}}
                                & {rothead{Three-Person Households}}
        & {rothead{Five-Person Households}}
            & {rothead{Four-Person Households}}
                & {rothead{Dutch/Foreign Ratio}}
                    & {rothead{Men/Women Ratio}}
                        & {rothead{Age $<65$ Age $geq 65$}}
                            & {rothead{Houses 1960-1969}}
                                & {rothead{Houses 1970-1999}}                  
      midrule
VIF1    & 12.75     & 28.55     & 1.56  & 2.23  & 12.14     & 4.40      & 7.03  
        & 3.16      & 16.19     & 3.02  & 1.80  & 4.61      & 7.96      & 3.46   
VIF2    & 144.80    & 179.48    & 2.83  & 4.13  & 29.01     & 9.46      & 13.47 
        & 6.02      & 32.65     & 13.55 & 3.45  & 8.05      &B 234.14  & 48.04 
VIF3    & 15.91     & 36.21     & 2.82  & 4.09  & 28.71     & 9.41      & 12.22 
        & 5.76      & 26.98     & 13.44 & 3.28  & 7.87      &           & 7.75  
VIF4    & 15.76     &B 36.19   & 2.69  & 3.74  & 28.70     & 9.41      & 12.20 
        & 5.75      & 26.96     & 13.44 & 3.28  & 7.74      &           & 7.75  
VIF5    & 9.13      &           & 2.69  & 3.72  &B 27.89   & 9.12      & 11.62 
        & 5.75      & 24.43     & 12.24 & 3.24  & 6.94      &           & 6.58  
VIF6    & 8.93      &           & 2.69  & 3.28  &           & 6.14      & 11.62
        & 5.71      & 18.81     & 12.20 & 3.23  & 6.49      &           & 6.06  
VIF7    & 8.84      &           & 2.68  & 3.28  &           & 6.08      & 11.61 
        & 5.65      &B 18.25   & 12.15 & 3.23  & 6.26      &           & 5.87  
VIF8    & 8.84      &           & 2.68  & 3.25  &           & 5.32      & 8.15  
        & 5.41      &           & 10.47 & 3.22  & 6.26      &           & 5.86   
VIF9    & 6.19      &           & 2.33  & 2.91  &           & 3.66      & 6.93  
        & 4.50      &           & 8.79  & 2.48  & 5.89      &           & 5.62  
VIF10   & 6.15      &           & 2.33  & 2.88  &           & 3.48      & 6.36  
        & 4.50      &           & 8.67  & 2.26  & 5.89      &           & 3.69  
VIF11   & 4.84      &           & 1.99  & 2.73  &           & 3.35      & 6.22  
        & 4.49      &           & 7.57  & 2.06  & 5.72      &           & 3.53  
    bottomrule
end{tabular*}
    end{sidewaystable*}
end{document}

enter image description here

Note: I rather would counterclock rotate table as it is default settings for rotating as well for lscape or pdflscape packages.

Answered by Zarko on February 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP