\setlength{\tabcolsep}{1pt}
\begin{tabular}{l*{12}{c}}
\hline\hline
\multicolumn{12}{l}{\hspace{8cm}\textbf{Panel B: Return and Profitability Descriptive Statistics}}\\
\hline
&\multicolumn{1}{c}{Non\_Dur}&\multicolumn{1}{c}{ Durable}&\multicolumn{1}{c}{Manufacturing}&\multicolumn{1}{c}{Oil \& Gas }&\multicolumn{1}{c}{Chemicals}&\multicolumn{1}{c}{Bus Eqp}&\multicolumn{1}{c}{Phone \& TV}&\multicolumn{1}{c}{Utilities}&\multicolumn{1}{c}{Whole\_Ret}&\multicolumn{1}{c}{Healthcare}&\multicolumn{1}{c}{Finance}&\multicolumn{1}{c}{Other}\\
\hline
ROE & 0.077& 0.057& 0.034& 0.031& 0.026& -0.069& -0.927& 1.096& 0.094& -0.281& 0.450& 0.001 \\
& 0.119& -0.111& 0.126& -0.755& 0.117& -0.050& 0.102& 0.116& 0.059& 0.067& 0.100& -0.000 \\
& -1.067& 6.948& -2.569& 7.551& -1.519& -0.240& -0.930& 3.766& 0.998& -8.318& 4.282& 0.053 \\
[0.5em]
\hline
CF & 0.061& 0.051& 0.060& 0.059& 0.044& 0.009& 0.029& 0.029& 0.062& -0.140& 0.003& 0.038 \\
& 0.062& 0.069& 0.058& 0.076& 0.058& 0.042& 0.054& 0.037& 0.052& -0.035& 0.021& 0.002 \\
& -1.044& -7.180& 2.385& -6.253& -6.694& -23.859& -8.631& -6.328& 11.392& -37.083& -6.982& 7.542 \\
[0.5em]
\hline
EBIT\_MAR & 0.043& -0.016& -0.066& -0.639& -0.443& -1.742& -1.598& 0.017& -0.012& -17.730& 0.018& -1.102 \\
& 0.075& 0.050& -0.050& -5.519& 0.034& -0.254& -0.163& 0.185& 0.020& -8.070& 0.095& -0.137 \\
& -2.244& -6.142& -0.519& 10.781& -4.773& -5.256& -1.514& -11.954& -2.024& -5.218& -0.509& -8.969 \\
[0.5em]
\hline
GM & 0.340& 0.262& 0.217& 0.152& 0.146& -0.847& -0.696& 0.221& 0.277& -14.841& 0.350& -0.587 \\
& 0.323& 0.285& 0.176& 0.042& 0.361& 0.285& 0.234& 0.279& 0.237& -7.230& 0.276& 0.165 \\
& 2.168& -2.748& 1.644& 0.820& -5.184& -4.208& -1.029& -9.724& 5.978& -4.262& 0.583& -7.792 \\
[0.5em]
\hline
TAX & 0.339& 0.309& 0.221& 0.264& 0.278& 0.141& 0.263& 0.392& 0.564& 0.249& 0.246& 0.138 \\
& 0.300& 0.131& 0.369& 0.276& 0.344& 0.162& 0.018& 0.329& 0.306& 0.207& 0.204& 0.216 \\
& 1.820& 5.471& -3.440& -0.289& -3.618& -1.018& 3.346& 2.985& 1.382& 0.862& 0.986& -1.205 \\
[0.5em]
\hline
RET12\_L & 1.211& 1.223& 1.212& 1.240& 1.215& 1.320& 1.261& 1.166& 1.239& 1.322& 1.144& 1.232 \\
& 1.217& 1.241& 1.208& 1.257& 1.176& 1.312& 1.293& 1.151& 1.229& 1.318& 1.212& 1.208 \\
& -1.006& -2.006& 1.176& -2.261& 5.777& 1.258& -2.815& 6.934& 1.854& 0.631& -23.983& 6.033 \\
\hline\hline
\end{tabular}
答案1
您有多种选择:
- 重新设计你的桌子。如果可以的话,将列拆分为多个表。
如果这不可能的话,您可以更改表格的外观:
减小字体大小(例如使用
\small
内部\begin{tabular}
)。总的来说,这是一个坏主意因为这会使阅读文本变得更加困难。不仅因为阅读较小尺寸的文本更加困难,还因为你的眼睛可能会迷失在所有的列和行之间。(虽然你的标题可能会说“放大以查看更多细节”:) - 但这种风格真的很差,不适合打印)。旋转标题文本。如果您的标题比实际的单元格上下文长,这尤其有用。
传达更少的信息,例如减少有效数字的数量。
结合这些,你应该能够制作出一个好看的表格。特别是,记住第一个提示:重新设计你的桌子如果可能的话。
答案2
另一种方法是,如果允许表格突出到外页边距:
上图所示的表格设计是基于对页面布局的猜测。因此,如果与假设不同,结果将与显示不同。
在 MWE 中我使用了一些新包:
booktabs
对于表规则makecell
用于表格列标题tabularx
用于适合表格的确定表格宽度changepage
为了给桌子留出更多空间,延伸到外边框calc
计算表格允许的宽度- ˛siunitx
for column
S` 将数字按小数点对齐。
在列标题中,我缩短了一些文本。完整的 MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\sffamily\bfseries\small}
\usepackage{siunitx}
\usepackage{calc}
\usepackage[strict]{changepage}
\usepackage[showframe
]{geometry}
\usepackage{lipsum}
\begin{document}
\lipsum[2]
\setlength{\tabcolsep}{1.5pt}
\noindent
\begin{adjustwidth}{}{-\marginparwidth-\marginparsep}
\begin{tabularx}{\linewidth}{X*{12}{S[table-format=-2.3]}
}
\toprule
\multicolumn{12}{c}{%
\thead{Panel B: Return and Profitability Descriptive Statistics}}\\
\midrule
& {\thead[br]{Non\_\\ Dur.}} & {\thead[br]{Du-\\rable}}
& {\thead[br]{Manu-\\factur.}}
& {\thead[br]{Oil \&\\ Gas}} & {\thead[br]{Chem.}}
& {\thead[br]{Bus\\ Eqp}}
& {\thead[br]{Phone\\\& TV}} & {\thead[br]{Util.}}
& {\thead[br]{Whole\\ Ret.}}
& {\thead[br]{Health\\care}} & {\thead[br]{Fin.}} & {\thead[br]{Other}} \\
\midrule
ROE & 0.077 & 0.057 & 0.034 & 0.031 & 0.026 & -0.069 & -0.927 & 1.096
& 0.094 & -0.281 & 0.450 & 0.001 \\
& 0.119 & -0.111 & 0.126 & -0.755 & 0.117 & -0.050 & 0.102 & 0.116
& 0.059 & 0.067 & 0.100 & -0.000 \\
& -1.067 & 6.948 & -2.569 & 7.551 & -1.519 & -0.240 & -0.930 & 3.766
& 0.998 & -8.318 & 4.282 & 0.053 \\
\midrule
CF & 0.061 & 0.051 & 0.060 & 0.059 & 0.044 & 0.009 & 0.029 & 0.029
& 0.062 & -0.140 & 0.003 & 0.038 \\
& 0.062 & 0.069 & 0.058 & 0.076 & 0.058 & 0.042 & 0.054 & 0.037
& 0.052 & -0.035 & 0.021 & 0.002 \\
& -1.044 & -7.180 & 2.385 & -6.253 & -6.694 &-23.859 & -8.631 &-6.328
& 11.392 &-37.083 & -6.982 & 7.542 \\
\midrule
EBIT\_
& 0.043 & -0.016 & -0.066 & -0.639 & -0.443 & -1.742 & -1.598 & 0.017
& -0.012 &-17.730 & 0.018 & -1.102 \\
MAR & 0.075 & 0.050 & -0.050 & -5.519 & 0.034 & -0.254 & -0.163 & 0.185
& 0.020 & -8.070 & 0.095 & -0.137 \\
& -2.244 & -6.142 & -0.519 & 10.781 & -4.773 & -5.256 & -1.514&-11.954
& -2.024 & -5.218 & -0.509 & -8.969 \\
\midrule
GM & 0.340 & 0.262 & 0.217 & 0.152 & 0.146 & -0.847 & -0.696 & 0.221
& 0.277 &-14.841 & 0.350 & -0.587 \\
& 0.323 & 0.285 & 0.176 & 0.042 & 0.361 & 0.285 & 0.234 & 0.279
& 0.237 & -7.230 & 0.276 & 0.165 \\
& 2.168 & -2.748 & 1.644 & 0.820 & -5.184 & -4.208 & -1.029 &-9.724
& 5.978 & -4.262 & 0.583 & -7.792 \\
\midrule
TAX & 0.339 & 0.309 & 0.221 & 0.264 & 0.278 & 0.141 & 0.263 & 0.392
& 0.564 & 0.249 & 0.246 & 0.138 \\
& 0.300 & 0.131 & 0.369 & 0.276 & 0.344 & 0.162 & 0.018 & 0.329
& 0.306 & 0.207 & 0.204 & 0.216 \\
& 1.820 & 5.471 & -3.440 & -0.289 & -3.618 & -1.018 & 3.346 & 2.985
& 1.382 & 0.862 & 0.986 & -1.205 \\
\midrule
RET12\_L
& 1.211 & 1.223 & 1.212 & 1.240 & 1.215 & 1.320 & 1.261 & 1.166
& 1.239 & 1.322 & 1.144 & 1.232 \\
& 1.217 & 1.241 & 1.208 & 1.257 & 1.176 & 1.312 & 1.293 & 1.151
& 1.229 & 1.318 & 1.212 & 1.208 \\
& -1.006 & -2.006 & 1.176 & -2.261 & 5.777 & 1.258 & -2.815 & 6.934
& 1.854 & 0.631 &-23.983 & 6.033 \\
\bottomrule
\end{tabularx}
\end{adjustwidth}
\lipsum[3]
\end{document}
答案3
这个答案采纳了 Martin Nyolt 答案中的许多建议,并进行了一些小小的补充。
- 不用不断地
\multicolumn…
为每个标题文本编写代码,而是创建一个宏。这样以后更改格式就容易多了。这里\tableheader{text}
创建了一个名为的宏,用来代替。它设置为将内容旋转 45 度,并且不占用任何空间,除非手动移动。 suinitx
非常适合在表格中排版大量数字,在这里用于将数字在小数点处对齐。\textsc{text}
用大写字母书写缩写看起来有点喧闹。考虑使用或将其改为小写字母\scshape
。文本中的数字通常也更漂亮旧式人物。您可以根据以下建议在整个文档中启用此功能:使用旧式数字而不使用 \oldstylenums或仅使用 来获取一些数字\oldstylenums{123}
。
您可能还想研究一下booktabs
-package,并使用\toprule
、\midrule
和 `\bottomrule,让您的表格看起来更专业。
第一列
此外,在某些情况下,像这样的高级表格可能更适合绘制。
输出
代码
\documentclass{article}
\usepackage{rotating}
\usepackage{caption}
\usepackage{siunitx}
\newcommand{\tableHeader}[1]{%
\multicolumn{1}{l}{\hspace*{2em}\makebox[0.0cm][l]{\rotatebox{45}{#1}}}
}
\begin{document}
\setlength{\tabcolsep}{3pt}
\begin{sidewaystable}
\centering
\caption{Panel B: Return and Profitability Descriptive Statistics}
\begin{tabular}{l*{12}{S}}
\hline\hline
\hline
&
\tableHeader{Non\_Dur}&
\tableHeader{Durable}&
\tableHeader{Manufacturing}&
\tableHeader{Oil \& Gas }&
\tableHeader{Chemicals}&
\tableHeader{Bus Eqp}&
\tableHeader{Phone \& TV}&
\tableHeader{Utilities}&
\tableHeader{Whole\_Ret}&
\tableHeader{Healthcare}&
\tableHeader{Finance}&
\tableHeader{Other}\\
\hline
\textsc{roe} & 0.077& 0.057& 0.034& 0.031& 0.026& -0.069& -0.927& 1.096& 0.094& -0.281& 0.450& 0.001 \\
& 0.119& -0.111& 0.126& -0.755& 0.117& -0.050& 0.102& 0.116& 0.059& 0.067& 0.100& -0.000 \\
& -1.067& 6.948& -2.569& 7.551& -1.519& -0.240& -0.930& 3.766& 0.998& -8.318& 4.282& 0.053 \\
[0.5em]
\hline
\textsc{cf} & 0.061& 0.051& 0.060& 0.059& 0.044& 0.009& 0.029& 0.029& 0.062& -0.140& 0.003& 0.038 \\
& 0.062& 0.069& 0.058& 0.076& 0.058& 0.042& 0.054& 0.037& 0.052& -0.035& 0.021& 0.002 \\
& -1.044& -7.180& 2.385& -6.253& -6.694& -23.859& -8.631& -6.328& 11.392& -37.083& -6.982& 7.542 \\
[0.5em]
\hline
\textsc{ebit\_} & 0.043& -0.016& -0.066& -0.639& -0.443& -1.742& -1.598& 0.017& -0.012& -17.730& 0.018& -1.102 \\
\textsc{mar} & 0.075& 0.050& -0.050& -5.519& 0.034& -0.254& -0.163& 0.185& 0.020& -8.070& 0.095& -0.137 \\
& -2.244& -6.142& -0.519& 10.781& -4.773& -5.256& -1.514& -11.954& -2.024& -5.218& -0.509& -8.969 \\
[0.5em]
\hline
\textsc{gm} & 0.340& 0.262& 0.217& 0.152& 0.146& -0.847& -0.696& 0.221& 0.277& -14.841& 0.350& -0.587 \\
& 0.323& 0.285& 0.176& 0.042& 0.361& 0.285& 0.234& 0.279& 0.237& -7.230& 0.276& 0.165 \\
& 2.168& -2.748& 1.644& 0.820& -5.184& -4.208& -1.029& -9.724& 5.978& -4.262& 0.583& -7.792 \\
[0.5em]
\hline
\textsc{tax} & 0.339& 0.309& 0.221& 0.264& 0.278& 0.141& 0.263& 0.392& 0.564& 0.249& 0.246& 0.138 \\
& 0.300& 0.131& 0.369& 0.276& 0.344& 0.162& 0.018& 0.329& 0.306& 0.207& 0.204& 0.216 \\
& 1.820& 5.471& -3.440& -0.289& -3.618& -1.018& 3.346& 2.985& 1.382& 0.862& 0.986& -1.205 \\
[0.5em]
\hline
\textsc{ret\oldstylenums{12}\_l} & 1.211& 1.223& 1.212& 1.240& 1.215& 1.320& 1.261& 1.166& 1.239& 1.322& 1.144& 1.232 \\
& 1.217& 1.241& 1.208& 1.257& 1.176& 1.312& 1.293& 1.151& 1.229& 1.318& 1.212& 1.208 \\
& -1.006& -2.006& 1.176& -2.261& 5.777& 1.258& -2.815& 6.934& 1.854& 0.631& -23.983& 6.033 \\
\hline\hline
\end{tabular}
\end{sidewaystable}
\end{document}
答案4
我不知道这是好是坏。感谢 Martin Nyolt 的回复。Runar Trollet 的代码也很好。
\setlength {\tabcolsep}{2pt}
\begin{tabular}{l*{12}{c}}
\hline\hline
\multicolumn{12}{l}{\hspace*{8em}\textbf{Panel B: Return and Profitability Descriptive Statistics}}\\
\hline
&\multicolumn{1}{c}{
\begin{sideways}
Non\_Dur\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Durable\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Manufacturing\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Oil \& Gas\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Chemicals\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Bus Eqp\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Phone \& TV\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Utilities\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Whole\_Ret\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Health care\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Finance\,
\end{sideways}}
&\multicolumn{1}{c}{
\begin{sideways}
Other\,
\end{sideways}}\\
\hline
ROE &0.077&0.057&0.034&0.031&0.026&-0.069&-0.927&1.096&0.094&-0.281&0.450&0.001 \\
&0.119&-0.111& 0.126& -0.755& 0.117& -0.050& 0.102& 0.116& 0.059& 0.067& 0.100& -0.000 \\
& -1.067& 6.948& -2.569& 7.551& -1.519& -0.240& -0.930& 3.766& 0.998& -8.318& 4.282& 0.053 \\
[0.5em]
\hline
CF & 0.061& 0.051& 0.060& 0.059& 0.044& 0.009& 0.029& 0.029& 0.062& -0.140& 0.003& 0.038 \\
& 0.062& 0.069& 0.058& 0.076& 0.058& 0.042& 0.054& 0.037& 0.052& -0.035& 0.021& 0.002 \\
& -1.044& -7.180& 2.385& -6.253& -6.694& -23.859& -8.631& -6.328& 11.392& -37.083& -6.982& 7.542 \\
[0.5em]
\hline
EBIT\_MAR & 0.043& -0.016& -0.066& -0.639& -0.443& -1.742& -1.598& 0.017& -0.012& -17.730& 0.018& -1.102 \\
& 0.075& 0.050& -0.050& -5.519& 0.034& -0.254& -0.163& 0.185& 0.020& -8.070& 0.095& -0.137 \\
& -2.244& -6.142& -0.519& 10.781& -4.773& -5.256& -1.514& -11.954& -2.024& -5.218& -0.509& -8.969 \\
[0.5em]
\hline
GM & 0.340& 0.262& 0.217& 0.152& 0.146& -0.847& -0.696& 0.221& 0.277& -14.841& 0.350& -0.587 \\
& 0.323& 0.285& 0.176& 0.042& 0.361& 0.285& 0.234& 0.279& 0.237& -7.230& 0.276& 0.165 \\
& 2.168& -2.748& 1.644& 0.820& -5.184& -4.208& -1.029& -9.724& 5.978& -4.262& 0.583& -7.792 \\
[0.5em]
\hline
TAX & 0.339& 0.309& 0.221& 0.264& 0.278& 0.141& 0.263& 0.392& 0.564& 0.249& 0.246& 0.138 \\
& 0.300& 0.131& 0.369& 0.276& 0.344& 0.162& 0.018& 0.329& 0.306& 0.207& 0.204& 0.216 \\
& 1.820& 5.471& -3.440& -0.289& -3.618& -1.018& 3.346& 2.985& 1.382& 0.862& 0.986& -1.205 \\
[0.5em]
\hline
RET12\_L & 1.211& 1.223& 1.212& 1.240& 1.215& 1.320& 1.261& 1.166& 1.239& 1.322& 1.144& 1.232 \\
& 1.217& 1.241& 1.208& 1.257& 1.176& 1.312& 1.293& 1.151& 1.229& 1.318& 1.212& 1.208 \\
& -1.006& -2.006& 1.176& -2.261& 5.777& 1.258& -2.815& 6.934& 1.854& 0.631& -23.983& 6.033 \\
\hline\hline
\end{tabular}