我已经为下面的表格奋斗了 6 个小时,它慢慢地折磨着我。
几个问题:1)我不知道如何让线条垂直连续。2)我无法让它适合一页并且仍然可读(横向 A4)
任何帮助都太棒了!希望你们都很好!
\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}
答案1
你的桌子很大……所以你的项目是“如何把大象放进女士手提箱”:-(
举个例子,为了将表格放在一页上,我们用了很多排版技巧,下面显示了 MWE(内容只是表格的一部分)。因为需要投入大量的时间和精力来清理代码(可能是由一些表格转换器生成的):
\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}
我们可以看到,结果非常糟糕。您应该考虑将表分成两部分...
答案2
如果我正确理解了您的代码,您正在寻找排版一个 26 变量相关矩阵,或者至少是它的下对角线部分。对于每个非对角线元素,您愿意显示 3 位小数。这是直截了当的消息(您可能认为这很糟糕):即使您设置了\tiny
相对字体大小和非常小的列间空白(2*2pt 而不是默认的 2*6pt),您也需要(至少)纸张尺寸为“US Legal”(8.5"x14")或 A3,以便在一张纸上排版整个矩阵。
不过,我们假设切换到 US-Legal 或 A3 纸张尺寸是不可行的。还能做什么呢?我建议只显示 2 位小数,而不是 3 位。(在下面的代码中S
,siunitx
以自动四舍五入到 2 位小数。)其次,列和行标题需要简化急剧地,只显示从 1 到 26 的数字。(当然,数字和变量名之间的对应关系应该在表格底部的图例中说明。)
通过这两项调整,可以通过设置来在单页上排版整个矩阵\scriptsize
,字体大小线性减少30%。
\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}