1

I've been struggling with the below table for 6 hours now and its slowly killing me.

A couple issues: 1) I can't figure out how to get the lines to be continuous vertically 2) I can't get it to fit on a page and still be readable (landscape A4)

Any help would be amazing! Hope you are all well!

\usepackage{pdflscape}

\documentclass{article}

\begin{document}
\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{cccccccccccccccccccccccccccc}
\cmidrule{3-28}    \multicolumn{2}{c|}{\multirow{2}[4]{*}{}} & \multicolumn{6}{c|}{\textbf{Diet}}            & \multicolumn{5}{c|}{\textbf{Housing \& utilites}} & \multicolumn{7}{c|}{\textbf{Consumption}}             & \multicolumn{8}{c|}{\textbf{Mobility}} \\
\cmidrule{3-28}    \multicolumn{2}{c|}{} & \multicolumn{1}{p{3.75em}}{\textbf{Beef}} & \multicolumn{1}{p{3.75em}}{\textbf{Pork}} & \multicolumn{1}{p{3.75em}}{\textbf{Poultry}} & \multicolumn{1}{p{3.75em}}{\textbf{Fish}} & \multicolumn{1}{p{3.75em}}{\textbf{Eggs/diary }} & \multicolumn{1}{p{3.75em}|}{\textbf{\% upackaged}} & \multicolumn{1}{p{3.75em}}{\textbf{House Type}} & \multicolumn{1}{p{3.75em}}{\textbf{No. of House Mates}} & \multicolumn{1}{p{3.75em}}{\textbf{House Size}} & \multicolumn{1}{p{3.75em}}{\textbf{House efficiency}} & \multicolumn{1}{p{3.75em}|}{\textbf{\% Renewable Energy}} & \multicolumn{1}{p{3.75em}}{\textbf{Clothing}} & \multicolumn{1}{p{3.75em}}{\textbf{Furniture}} & \multicolumn{1}{p{3.75em}}{\textbf{Appliances}} & \multicolumn{1}{p{3.75em}}{\textbf{Electronics}} & \multicolumn{1}{p{3.75em}}{\textbf{Books}} & \multicolumn{1}{p{3.75em}}{\textbf{Paper Recycling}} & \multicolumn{1}{p{3.415em}|}{\textbf{Plastic Recycling}} & \multicolumn{1}{p{3.75em}}{\textbf{Car miles}} & \multicolumn{1}{p{3.75em}}{\textbf{Motorbike miles}} & \multicolumn{1}{p{3.75em}}{\textbf{Car fuel economy}} & \multicolumn{1}{p{3.75em}}{\textbf{Motorbike fuel economy}} & \multicolumn{1}{p{3.75em}}{\textbf{\% car miles lift-shared}} & \multicolumn{1}{p{3.75em}}{\textbf{Train miles}} & \multicolumn{1}{p{3.75em}}{\textbf{Bus miles}} & \multicolumn{1}{p{3.75em}|}{\textbf{Hours flying}} \\
    \midrule
    \multicolumn{1}{|c|}{\multirow{6}[2]{*}{\begin{sideways}\textbf{Diet}\end{sideways}}} & \multicolumn{1}{l|}{\textbf{Beef}} & 1     &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       &       & \multicolumn{1}{c|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Pork}} & \textbf{0.427} & 1     &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       &       & \multicolumn{1}{c|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Poultry}} & \textbf{0.523} & \textbf{0.393} & 1     &       &       & \multicolumn{1}{c|}{} &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       &       & \multicolumn{1}{c|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Fish}} & \textbf{0.333} & \textbf{0.211} & \textbf{0.333} & 1     &       & \multicolumn{1}{c|}{} &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       &       & \multicolumn{1}{c|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Eggs/diary }} & \textbf{0.266} & \textbf{0.155} & \textbf{0.266} & \textbf{0.271} & 1     & \multicolumn{1}{c|}{} &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       &       & \multicolumn{1}{c|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{ \% ofunpackaged}} & 0.067 & -0.069 & -0.074 & 0.036 & -0.038 & \multicolumn{1}{c|}{1} &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       & \multicolumn{1}{c|}{} &       &       &       &       &       &       &       & \multicolumn{1}{c|}{} \\
\cmidrule{1-8}    \multicolumn{1}{|c|}{\multirow{5}[2]{*}{\begin{sideways}\textbf{Housing \& utilites}\end{sideways}}} & \multicolumn{1}{l|}{\textbf{House Type}} & -0.064 & -0.054 & -0.03 & -0.066 & -0.088 & \textbf{-0.147} & 1     &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{No. of House Mates}} & \textbf{0.129} & 0.051 & 0.043 & \textbf{0.16} & 0.066 & 0.073 & \textbf{-0.261} & 1     &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{House Size}} & \textbf{0.12} & 0.038 & 0.005 & \textbf{0.103} & 0.096 & \textbf{0.118} & \textbf{-0.624} & \textbf{0.289} & 1     &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{House efficiency}} & \textbf{-0.098} & -0.011 & -0.045 & -0.042 & -0.072 & -0.082 & -0.015 & -0.063 & 0.011 & 1     & \multicolumn{1}{r|}{} &       &       &       &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{\% Renewable Energy}} & 0.038 & 0.034 & 0.031 & -0.001 & 0.024 & 0.015 & -0.014 & -0.044 & -0.003 & 0.008 & \multicolumn{1}{c|}{1} &       &       &       &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
\cmidrule{1-13}    \multicolumn{1}{|c|}{\multirow{7}[2]{*}{\begin{sideways}\textbf{Consumption}\end{sideways}}} & \multicolumn{1}{l|}{\textbf{Clothing}} & \textbf{0.164} & 0.021 & 0.059 & \textbf{0.113} & 0.004 & \textbf{0.141} & -0.096 & \textbf{0.222} & \textbf{0.133} & -0.052 & -0.017 & 1     &       &       &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Furniture}} & \textbf{0.176} & 0.079 & \textbf{0.11} & \textbf{0.176} & \textbf{0.114} & 0.084 & \textbf{-0.142} & \textbf{0.262} & \textbf{0.166} & -0.049 & -0.06 & \textbf{0.477} & 1     &       &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Appliances}} & \textbf{0.282} & \textbf{0.151} & \textbf{0.171} & \textbf{0.278} & \textbf{0.141} & \textbf{0.166} & \textbf{-0.189} & \textbf{0.245} & \textbf{0.214} & \textbf{-0.102} & 0.005 & \textbf{0.448} & \textbf{0.582} & 1     &       &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Electronics}} & \textbf{0.28} & \textbf{0.102} & \textbf{0.172} & \textbf{0.272} & \textbf{0.155} & \textbf{0.118} & \textbf{-0.216} & \textbf{0.207} & \textbf{0.197} & -0.04 & 0.037 & \textbf{0.484} & \textbf{0.511} & \textbf{0.616} & 1     &       &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Books}} & \textbf{0.205} & \textbf{0.151} & 0.065 & \textbf{0.229} & \textbf{0.145} & 0.088 & -0.067 & \textbf{0.104} & \textbf{0.13} & -0.071 & 0.023 & \textbf{0.306} & \textbf{0.301} & \textbf{0.361} & \textbf{0.338} & 1     &       & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Paper Recycling}} & -0.006 & \textbf{0.107} & -0.029 & -0.038 & -0.014 & 0.08  & -0.027 & -0.005 & -0.086 & -0.056 & -0.055 & 0.006 & -0.043 & -0.091 & 0     & -0.064 & 1     & \multicolumn{1}{r|}{} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Plastic Recycling}} & -0.052 & 0.083 & -0.069 & -0.049 & -0.02 & 0.043 & 0.004 & -0.08 & \textbf{-0.1} & 0.016 & -0.074 & -0.058 & -0.043 & -0.06 & -0.03 & 0.006 & \textbf{0.717} & \multicolumn{1}{c|}{1} &       &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
\cmidrule{1-20}    \multicolumn{1}{|c|}{\multirow{8}[2]{*}{\begin{sideways}\textbf{Mobility}\end{sideways}}} & \multicolumn{1}{l|}{\textbf{Car miles}} & \textbf{0.234} & 0.085 & 0.086 & \textbf{0.177} & \textbf{0.113} & \textbf{0.177} & \textbf{-0.203} & \textbf{0.224} & \textbf{0.177} & \textbf{-0.101} & -0.073 & \textbf{0.289} & \textbf{0.304} & \textbf{0.356} & \textbf{0.357} & \textbf{0.162} & 0.033 & -0.041 & 1     &       &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Motorbike miles}} & \textbf{0.178} & 0.091 & 0.04  & \textbf{0.113} & -0.019 & \textbf{0.209} & \textbf{-0.133} & 0.067 & 0.095 & \textbf{-0.14} & -0.013 & \textbf{0.184} & \textbf{0.179} & \textbf{0.259} & \textbf{0.169} & \textbf{0.138} & 0.032 & -0.006 & \textbf{0.409} & 1     &       &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Car fuel economy}} & \textbf{-0.152} & -0.011 & \textbf{-0.102} & \textbf{-0.214} & \textbf{-0.147} & -0.079 & \textbf{0.206} & \textbf{-0.187} & \textbf{-0.224} & \textbf{-0.101} & -0.019 & \textbf{-0.215} & \textbf{-0.235} & \textbf{-0.306} & \textbf{-0.308} & \textbf{-0.174} & \textbf{0.184} & \textbf{0.147} & \textbf{-0.445} & -0.09 & 1     &       &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Motorbike fuel econ}} & \textbf{-0.159} & -0.01 & -0.051 & \textbf{-0.165} & \textbf{-0.112} & -0.081 & \textbf{0.185} & \textbf{-0.205} & \textbf{-0.17} & -0.074 & -0.018 & \textbf{-0.178} & \textbf{-0.215} & \textbf{-0.273} & \textbf{-0.263} & \textbf{-0.149} & 0.096 & 0.031 & \textbf{-0.364} & \textbf{-0.167} & \textbf{0.707} & 1     &       &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Lift sharing}} & \textbf{-0.146} & -0.023 & -0.06 & \textbf{-0.174} & \textbf{-0.141} & -0.046 & \textbf{0.145} & \textbf{-0.118} & \textbf{-0.203} & \textbf{-0.101} & -0.048 & \textbf{-0.199} & \textbf{-0.182} & \textbf{-0.256} & \textbf{-0.26} & \textbf{-0.22} & \textbf{0.193} & \textbf{0.148} & \textbf{-0.384} & -0.092 & \textbf{0.855} & \textbf{0.616} & 1     &       &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Train miles / week}} & \textbf{0.159} & 0.079 & \textbf{0.103} & \textbf{0.144} & 0.025 & 0.068 & \textbf{-0.144} & 0.077 & \textbf{0.102} & -0.033 & 0.07  & \textbf{0.274} & \textbf{0.211} & \textbf{0.188} & \textbf{0.241} & \textbf{0.127} & -0.008 & -0.012 & \textbf{0.304} & \textbf{0.184} & -0.06 & \textbf{-0.097} & -0.056 & 1     &       & \multicolumn{1}{r|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Bus miles / week}} & \textbf{0.12} & 0.093 & 0.04  & \textbf{0.111} & 0.02  & \textbf{0.194} & -0.07 & \textbf{0.14} & 0.089 & \textbf{-0.142} & 0.029 & \textbf{0.184} & \textbf{0.222} & \textbf{0.245} & \textbf{0.193} & 0.049 & \textbf{0.186} & \textbf{0.133} & \textbf{0.411} & \textbf{0.375} & -0.022 & \textbf{-0.098} & 0.021 & \textbf{0.397} & 1     & \multicolumn{1}{c|}{} \\
    \multicolumn{1}{|c|}{} & \multicolumn{1}{l|}{\textbf{Hours flying / year}} & \textbf{0.166} & 0.053 & 0.042 & \textbf{0.144} & -0.026 & \textbf{0.121} & \textbf{-0.107} & \textbf{0.149} & \textbf{0.171} & -0.051 & -0.02 & \textbf{0.261} & \textbf{0.231} & \textbf{0.302} & \textbf{0.269} & \textbf{0.179} & \textbf{-0.115} & \textbf{-0.149} & \textbf{0.37} & \textbf{0.403} & \textbf{-0.158} & \textbf{-0.129} & \textbf{-0.133} & \textbf{0.245} & \textbf{0.273} & \multicolumn{1}{c|}{1} \\
    \midrule
          & \multicolumn{27}{c}{\textit{bold terms representthey are signficant at the 5\% level}} \\
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%

\end{document}
  • your example generates the error ! LaTeX Error: \usepackage before \documentclass. and ! Undefined control sequence. l.10 \cmidrule – David Carlisle Apr 23 at 20:05
  • Horizontal lines from the booktabs package are incompatible with vertical lines, hence the small gaps around the insersections. If you want to stick to \toprule, \midruleand \bottomrule, mit the vertical lines. If you want the vertical lines, use \hline instead. – leandriis Apr 23 at 20:16
  • To save some space, you might want to consider using abbreviations for the contents in the second column and in the second row. Apart from that, I doubt that a table with a total of 28 columns will fit ontt a single page. Maybe you should split it into two parts. – leandriis Apr 23 at 20:18
  • 1
    you could make it fit on the page but no one will be able to read it. Far better to split it as two tables, over two pages (or more than two) – David Carlisle Apr 23 at 20:21
0

Your table is very huge ... so your project is "how to put elephant in lady suitcase" :-(

An example, which use many typographical tricks in this effort to put your table on one page, show MWE (which content only fragment of your table) below. For it is invested lot of time and effort to cleanup your code (probably generated by some table converter):

\documentclass{article}
\usepackage{geometry}
\usepackage{rotating}
\usepackage{booktabs, longtable, makecell, multirow}
\renewcommand\theadfont{\tiny\bfseries}
\usepackage{siunitx}    % new
\usepackage{xparse}     % new
\NewExpandableDocumentCommand\mcc{O{1}m}
    {\multicolumn{#1}{c}{#2}}
\usepackage{etoolbox}   % new
\newrobustcmd\B{\DeclareFontSeriesDefault[rm]{bf}{b}\bfseries}                          %

\usepackage{pdflscape}

\begin{document}

\newgeometry{margin=5mm}
\thispagestyle{empty}
\begin{landscape}

\begin{table}[htbp]
  \caption{Add caption}
  \label{tab:addlabel}%
%
  \centering
  \setlength\tabcolsep{1pt}
  \scriptsize
  \setlength\rotheadsize{6em}
  \sisetup{detect-weight, % <--
           mode=text,     % <--
           table-format=-1.3}
\begin{tabular}{@{} l >{\bfseries}l *{26}{S} @{}}
    \toprule    
\mcc[2]{} 
    &   \mcc[6]{\thead[b]{Diet}}
        &   \mcc[5]{\thead[b]{Housing \& utilites}}
            &  \mcc[7]{\thead[b]{Consumption}}
                &   \mcc[8]{\thead[b]{Mobility}}          \\
    \cmidrule(lr){3-8}
    \cmidrule(lr){9-14}    
    \cmidrule(lr){15-21}
    \cmidrule(l){22-28}
\mcc[2]{}
    & {\rothead{Beef}}     & {\rothead{Pork}}        & {\rothead{Poultry}}
    & {\rothead{Fish}}     & {\rothead{Eggs/\\diary}}& {\rothead{\% upackaged}}
    & {\rothead{House Type}}
                            & {\rothead{No. of\\ House Mates}}
                                                        & {\rothead{House Size}}
    & {\rothead{House\\ efficiency}} & {\rothead{\% Renewable\\ Energy}}
                                                    & {\rothead{Clothing}}
    & {\rothead{Furniture}}   & {\rothead{Appliances}}  & {\rothead{Electronics}}
    & {\rothead{Books}}       & {\rothead{Paper\\ Recycling}}
                                                    & {\rothead{Plastic\\ Recycling}}
    & {\rothead{Car\\ miles}} & {\rothead{Motorbike\\ miles}}
                                                    & {\rothead{Car\\ fuel\\ economy}}
    & {\rothead{Motorbike\\ fuel\\ economy}}
                            & {\rothead{\% car\\ miles\\ lift-shared}}
                                                    & {\rothead{Train\\ miles}}
    & {\rothead{Bus miles}}   & {\rothead{Hours flying}}    \\
    \midrule

\multirow[t]{6}{*}[-2ex]{\rothead{Diet}} 
    & Beef      & 1 &   &   &   &   &   &   &   &   &   &   &   &   &
                    &   &   &   &   &   &   &   &   &   &   &   &   \\
    & Pork      &\B 0.427   & 1 &   &   &   &   &   &   &   &   &   &   &   &       &   &   &   &   &   &   &   &   &   &   &   &   \\
    & Poultry   &\B 0.523   &\B 0.393  
                                & 1 &   &   &   &   &   &   &   &   &   &   &   
                            &   &   &   &   &   &   &   &   &   &   &   &   \\
    & Fish      &\B 0.333   & 0.211 &\B 0.333   & 1 & 
            &   &   &   &   &   &   &   &   &   &   &   &   &   &   &   &   &       &   &   &   &   \\
    & Eggs/diary    &\B 0.266   &\B 0.155   &\B 0.266   &\B 0.271   & 1 &   &   &   &   &   &   &   &   &   &   &   &   &   &
            &   &   &   &   &   &   &   \\
    & \% ofunpackaged   & 0.067 & -0.069 & -0.074 & 0.036 & -0.038  &   &
    &       &   &   &   &   &   &   &   &   &   &   &   &   &   &   &   &   &   &   \\
    \cmidrule{1-8}    
\multirow[t]{5}{*}[-2ex]{\rothead{Housing\\ \& utilites}}
        & House Type    & -0.064 & -0.054 & -0.03 & -0.066 & -0.088 
            &\B -0.147  & 1 &   &   &   &   &   &   &   &   &   &   &   &   &
                        &   &   &   &   &   &   \\
    & No. of House Mates   &\B 0.129   & 0.051 & 0.043 &\B 0.16    & 0.066 & 0.073 &\B -0.261  & 1 &   &   &   &   &   &   &   &   &
    &   &   &   &   &   &   &   &   &   \\
    & House Size    &\B 0.12    & 0.038 & 0.005 &\B 0.103 & 0.096
        &\B 0.118   &\B -0.624  &\B 0.289   & 1 &   &   &   &
        &   &   &   &   &   &   &   &   &   &   &   &   &   \\
    & House efficiency &\B -0.098  & -0.011  & -0.045 & -0.042 & -0.072 & -0.082 & -0.015 & -0.063 & 0.011 & 1   &   &   &   &   &   &   &
           &    &   &   &   &   &   &   &   &   \\
    & \% Renewable Energy & 0.038 & 0.034 & 0.031 & -0.001 & 0.024 & 0.015 & -0.014 & -0.044 & -0.003 & 0.008 &    &   &   &   &   &   &   &   &   &       &       &       &       &       &       &   \\
    \cmidrule{1-13}    
% last group
    \cmidrule{1-20}    
\multirow{8}{*}[2ex]{\rothead{Mobility}} 
    & Car miles     &\B 0.234 & 0.085   & 0.086    &\B 0.177 &\B 0.113 &\B 0.177
        &\B -0.203  &\B 0.224 &\B 0.177 &\B -0.101 & -0.073  &\B 0.289 
        &\B 0.304   &\B 0.356 &\B 0.357 &\B 0.162  & 0.033   & -0.041 
        & 1 &   &   &   &   &   &   &   \\
    & Motorbike miles   &\B 0.178   & 0.091 & 0.04  &\B 0.113 & -0.019 
        &\B 0.209   &\B -0.133  & 0.067   & 0.095   &\B -0.14 & -0.013 &\B 0.184
        &\B 0.179   &\B 0.259   &\B 0.169 &\B 0.138 & 0.032 & -0.006 
        &\B 0.409   & 1 &   &   &   &   &    &   \\
    & Car fuel economy  &\B -0.152  & -0.011 &\B -0.102 &\B -0.214
        &\B -0.147  & -0.079 &\B 0.206  &\B -0.187 &\B -0.224 &\B -0.101
        & -0.019    &\B -0.215  &\B -0.235  &\B -0.306  &\B -0.308
        &\B -0.174  &\B 0.184   &\B 0.147   &\B -0.445  & -0.09 & 1 &   &   &
            &   &       \\
    & Motorbike fuel econ   &\B -0.159  & -0.01 & -0.051 &\B -0.165 &\B -0.112
    & -0.081 &\B 0.185 &\B -0.205 &\B -0.17 & -0.074 & -0.018 &\B -0.178
    &\B -0.215  &\B -0.273 &\B -0.263  &\B -0.149 & 0.096 & 0.031 &\B -0.364
    &\B -0.167  &\B 0.707  & 1  &   &   &   &       \\
    & Lift sharing &\B -0.146  & -0.023 & -0.06 &\B -0.174  &\B -0.141 & -0.046 
    &\B  0.145 &\B -0.118  &\B -0.203 &\B -0.101 & -0.048  &\B -0.199 &\B -0.182
    &\B -0.256 &\B -0.26   &\B -0.22  &\B  0.193 &\B 0.148 &\B -0.384 & -0.092
    &\B 0.855  &\B 0.616   & 1  &   &   &   \\
    & Train miles/week    &\B 0.159   & 0.079 &\B 0.103 &\B 0.144 & 0.025
    & 0.068 &\B -0.144 & 0.077 &\B 0.102 & -0.033 & 0.07  &\B 0.274 &\B 0.211
    &\B 0.188 &\B 0.241 &\B 0.127 & -0.008 & -0.012 &\B 0.304 &\B 0.184
    & -0.06 &\B -0.097 & -0.056 & 1 &   &   \\
    & Bus miles/week  &\B 0.12 & 0.093 & 0.04  &\B 0.111 & 0.02  &\B 0.194 & -0.07
    &\B 0.14 & 0.089 &\B -0.142 & 0.029 &\B 0.184 &\B 0.222  &\B 0.245 &\B 0.193
    &  0.049 &\B 0.186  &\B 0.133 &\B 0.411 &\B 0.375 & -0.022 &\B -0.098 & 0.021
    &\B 0.397 & 1   &   \\
    & Hours flying/year &\B 0.166 & 0.053 & 0.042 &\B 0.144 & -0.026 &\B 0.121
    &\B -0.107 &\B  0.149 &\B  0.171 & -0.051 & -0.02 &\B  0.261 &\B  0.231
    &\B  0.302 &\B  0.269 &\B  0.179 &\B  -0.115 &\B  -0.149 &\B  0.37 &\B  0.403
    &\B -0.158 &\B  -0.129 &\B -0.133 &\B  0.245 &\B  0.273 & 1    \\
    \midrule
\end{tabular}
  \label{tab:addlabel}%
\end{table}
\end{landscape}
\restoregeometry

\end{document}

enter image description here

As as we can see, the result is very poor. You should consider to split your table into two parts ...

| improve this answer | |
0

If I understand your code correctly, you are looking to typeset a 26-variable correlation matrix or, at least, it's lower-diagonal part. For each off-diagonal element, you're willing to show 3 decimal digits. Here's the straight news (you may well think it's bad): Even if you set a \tiny relative font size and very little inter-column whitespace (2*2pt instead of the default 2*6pt), you will need (at least) a paper size of "US Legal" (8.5"x14") or A3 in order to typeset the full matrix on one sheet of paper.

Let's assume, though, that switching to a paper size of US-Legal or A3 is not feasible. What else can one do? I suggest showing only 2 decimal digits, not 3. (In the code below, the S column type of the siunitx package is loaded to perform automatic rounding to 2 decimal digits.) Second, the column and row headers need to be simplified drastically, by just showing a number running from 1 to 26. (The correspondence between numbers and variable names should, of course, be stated in the legend at the bottom of the table.)

With these two adjustments in place, it is possible to typeset the full matrix on a single page by setting \scriptsize, for a 30% linear reduction in font size.

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[margin=1in,letterpaper]{geometry}
\usepackage{booktabs,rotating,etoolbox,siunitx}
\begin{document}

\begin{sidewaystable}
\scriptsize
\setlength\tabcolsep{0pt}

\robustify\bfseries
\renewrobustcmd{\bfseries}{\fontseries{b}\selectfont}
\let\bfs\bfseries

\caption{Big honking correlation matrix}
\label{tab:correlations}

\medskip
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} 
              r @{\hspace{2mm}}
              *{25}{S[table-format=-1.2,
                      round-mode=places,
                      round-precision=2,
                      detect-weight
                      ]} 
              @{\hspace{2mm}} c }

&  {1} &  {2} &  {3} &  {4} &  {5} &  {6} &  {7} &  {8} &  {9} & {10}
& {11} & {12} & {13} & {14} & {15} & {16} & {17} & {18} & {19} & {20}
& {21} & {22} & {23} & {24} & {25} & {26} \\
\cmidrule[\lightrulewidth]{2-27}
1 & 1 & \\
2 & \bfs 0.427 & 1 \\
3 & \bfs 0.523 & \bfs 0.393 & 1 \\
4 & \bfs 0.333 & \bfs 0.211 & \bfs 0.333 & 1 \\
5 & \bfs 0.266 & \bfs 0.155 & \bfs 0.266 & \bfs 0.271 & 1 \\
6 & 0.067 & -0.069 & -0.074 & 0.036 & -0.038 & 1 \\
\addlinespace 
7 & -0.064 & -0.054 & -0.03 & -0.066 & -0.088 & \bfs -0.147 & 1 \\
8 & \bfs 0.129 & 0.051 & 0.043 & \bfs 0.16 & 0.066 & 0.073 & \bfs -0.261 & 1 \\
9 & \bfs 0.12 & 0.038 & 0.005 & \bfs 0.103 & 0.096 & \bfs 0.118 & \bfs -0.624 & \bfs 0.289 & 1 \\
10 & \bfs -0.098 & -0.011 & -0.045 & -0.042 & -0.072 & -0.082 & -0.015 & -0.063 & 0.011 & 1 & \\
11 & 0.038 & 0.034 & 0.031 & -0.001 & 0.024 & 0.015 & -0.014 & -0.044 & -0.003 & 0.008 & 1 \\
\addlinespace 
12 & \bfs 0.164 & 0.021 & 0.059 & \bfs 0.113 & 0.004 & \bfs 0.141 & -0.096 & \bfs 0.222 & \bfs 0.133 & -0.052 & -0.017 & 1 \\
13 & \bfs 0.176 & 0.079 & \bfs 0.11 & \bfs 0.176 & \bfs 0.114 & 0.084 & \bfs -0.142 & \bfs 0.262 & \bfs 0.166 & -0.049 & -0.06 & \bfs 0.477 & 1 \\
14 & \bfs 0.282 & \bfs 0.151 & \bfs 0.171 & \bfs 0.278 & \bfs 0.141 & \bfs 0.166 & \bfs -0.189 & \bfs 0.245 & \bfs 0.214 & \bfs -0.102 & 0.005 & \bfs 0.448 & \bfs 0.582 & 1 \\
15 & \bfs 0.28 & \bfs 0.102 & \bfs 0.172 & \bfs 0.272 & \bfs 0.155 & \bfs 0.118 & \bfs -0.216 & \bfs 0.207 & \bfs 0.197 & -0.04 & 0.037 & \bfs 0.484 & \bfs 0.511 & \bfs 0.616 & 1 \\
16 & \bfs 0.205 & \bfs 0.151 & 0.065 & \bfs 0.229 & \bfs 0.145 & 0.088 & -0.067 & \bfs 0.104 & \bfs 0.13 & -0.071 & 0.023 & \bfs 0.306 & \bfs 0.301 & \bfs 0.361 & \bfs 0.338 & 1 \\
17 & -0.006 & \bfs 0.107 & -0.029 & -0.038 & -0.014 & 0.08 & -0.027 & -0.005 & -0.086 & -0.056 & -0.055 & 0.006 & -0.043 & -0.091 & 0  & -0.064 & 1 \\
18 & -0.052 & 0.083 & -0.069 & -0.049 & -0.02 & 0.043 & 0.004 & -0.08 & \bfs -0.1 & 0.016 & -0.074 & -0.058 & -0.043 & -0.06 & -0.03 & 0.006 & \bfs 0.717 & 1 \\
\addlinespace 
19 & \bfs 0.234 & 0.085 & 0.086 & \bfs 0.177 & \bfs 0.113 & \bfs 0.177 & \bfs -0.203 & \bfs 0.224 & \bfs 0.177 & \bfs -0.101 & -0.073 & \bfs 0.289 & \bfs 0.304 & \bfs 0.356 & \bfs 0.357 & \bfs 0.162 & 0.033 & -0.041 & 1 \\
20 & \bfs 0.178 & 0.091 & 0.04 & \bfs 0.113 & -0.019 & \bfs 0.209 & \bfs -0.133 & 0.067 & 0.095 & \bfs -0.14 & -0.013 & \bfs 0.184 & \bfs 0.179 & \bfs 0.259 & \bfs 0.169 & \bfs 0.138 & 0.032 & -0.006 & \bfs 0.409 & 1 \\
21 & \bfs -0.152 & -0.011 & \bfs -0.102 & \bfs -0.214 & \bfs -0.147 & -0.079 & \bfs 0.206 & \bfs -0.187 & \bfs -0.224 & \bfs -0.101 & -0.019 & \bfs -0.215 & \bfs -0.235 & \bfs -0.306 & \bfs -0.308 & \bfs -0.174 & \bfs 0.184 & \bfs 0.147 & \bfs -0.445 & -0.09 & 1 \\
22 & \bfs -0.159 & -0.01 & -0.051 & \bfs -0.165 & \bfs -0.112 & -0.081 & \bfs 0.185 & \bfs -0.205 & \bfs -0.17 & -0.074 & -0.018 & \bfs -0.178 & \bfs -0.215 & \bfs -0.273 & \bfs -0.263 & \bfs -0.149 & 0.096 & 0.031 & \bfs -0.364 & \bfs -0.167 & \bfs 0.707 & 1 \\
23 & \bfs -0.146 & -0.023 & -0.06 & \bfs -0.174 & \bfs -0.141 & -0.046 & \bfs 0.145 & \bfs -0.118 & \bfs -0.203 & \bfs -0.101 & -0.048 & \bfs -0.199 & \bfs -0.182 & \bfs -0.256 & \bfs -0.26 & \bfs -0.22 & \bfs 0.193 & \bfs 0.148 & \bfs -0.384 & -0.092 & \bfs 0.855 & \bfs 0.616 & 1 \\
24 & \bfs 0.159 & 0.079 & \bfs 0.103 & \bfs 0.144 & 0.025 & 0.068 & \bfs -0.144 & 0.077 & \bfs 0.102 & -0.033 & 0.07 & \bfs 0.274 & \bfs 0.211 & \bfs 0.188 & \bfs 0.241 & \bfs 0.127 & -0.008 & -0.012 & \bfs 0.304 & \bfs 0.184 & -0.06 & \bfs -0.097 & -0.056 & 1 \\
25 & \bfs 0.12 & 0.093 & 0.04 & \bfs 0.111 & 0.02 & \bfs 0.194 & -0.07 & \bfs 0.14 & 0.089 & \bfs -0.142 & 0.029 & \bfs 0.184 & \bfs 0.222 & \bfs 0.245 & \bfs 0.193 & 0.049 & \bfs 0.186 & \bfs 0.133 & \bfs 0.411 & \bfs 0.375 & -0.022 & \bfs -0.098 & 0.021 & \bfs 0.397 & 1 \\
26 & \bfs 0.166 & 0.053 & 0.042 & \bfs 0.144 & -0.026 & \bfs 0.121 & \bfs -0.107 & \bfs 0.149 & \bfs 0.171 & -0.051 & -0.02 & \bfs 0.261 & \bfs 0.231 & \bfs 0.302 & \bfs 0.269 & \bfs 0.179 & \bfs -0.115 & \bfs -0.149 & \bfs 0.37 & \bfs 0.403 & \bfs -0.158 & \bfs -0.129 & \bfs -0.133 & \bfs 0.245 & \bfs 0.273 & 1 \\
\bottomrule
\end{tabular*}

\smallskip
Bold numbers indicate that they are statistically signficant at the 5\% level.

\bigskip
Diet variables: 1 Beef; 2 Pork; 3 Poultry; 4 Fish; 5 Eggs\slash dairy; 6 \% unpackaged.

Housing \& utilites variables: 
7 House Type; 8 No. of House Mates; 9 House Size; 10 House efficiency; 11 \% Renewable Energy.

Consumption variables:
12 Clothing; 13 Furniture; 14 Appliances; 15 Electronics; 16 Books; 17 Paper Recycling; 18 Plastic Recycling.

Mobility variables:
19 Car miles; 20 Motorbike miles; 21 Car fuel economy; 22 Motorbike fuel economy; 23 \% car miles lift-shared; 24 Train miles; 25 Bus miles; 26 Hours flying.
\end{sidewaystable}
\end{document}
| improve this answer | |
  • Yes. I would split this table onto 5 (maybe 4) pages, portrait, text normal size, numbers 3 decimal places. The 5 pages would reflect 5 sets of columns of variables: Diet, Housing & Utilities, Consumption, Mobility variables 19-22, Mobility variables 23-26. All 8 Mobility variables might fit on one page but my guess is it would be cramped. – Una Sep 21 at 0:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.