我目前有一个 Stargazer(r 包)的回归输出,我将其编辑成横向表格,并使其适合文本宽度。但是我想尝试将表格拆分成 2 页,采用当前格式(因此也适合文本宽度和横向),但我无法弄清楚。我尝试过 lscape 和 longtable,但每次尝试时我总是会丢失三个组件中的一个。
有人有可行的解决方案吗?我的代码和当前表输出显示如下。
我当前的代码不能采用长表格式:
\documentclass[12pt]{article}
\usepackage[figuresleft]{rotating}
\begin{sidewaystable}[h!] \centering
\caption{Results of regression analysis}
\label{}
\resizebox{\textwidth}{!}{\begin{tabular}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
*lot of table data *
*lot of table data *
\end{tabular}}
\end{sidewaystable}
我尝试使用的另一段代码lscape
,longtable
但最终以错误日志结束:
documentclass[12pt]{article}
\usepackage{longtable}
\usepackage{pdflscape}
\usepackage{lscape}
\begin{landscape}
\resizebox{\textwidth}{!}{\begin{longtable}{@{\extracolsep{5pt}}lD{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} D{.}{.}{-3} }
\caption{Results of regression analysis}
\label{}
*lot of data*
*lot of data*
\end{longtable}}
\end{landscape}
在这两种情况下我都使用geometry
页面布局
\newgeometry{left=30mm,right=30mm,top=20mm}
答案1
我做出以下假设:
- 您正在研究普通类(例如文章)
- 您正在使用 a4 纸张尺寸
我必须修复代码中的某些内容并添加一些可以工作的包等等。
我的诀窍是将最后两行分开(残差和F) 分成 4 行,希望这对您来说不是问题。使用此解决方案,无需更改文档边距。因为除此之外,无论方向如何,表格都无法容纳 A4 纸。
我也无法将表格拆分为某一列,longtable
而其他的只能拆分为行......
软件包:
threeparttablex
允许进行适当的长表注释,并带有可能的标签和交叉引用等。请阅读手册以了解更多信息:这里。
booktabs
使标签看起来更专业,并避免浪费空间。
pdflscape
旋转页面但仍允许正常打印。
longtable
而且multirow
很明显。
\documentclass[a4paper]{article}
\usepackage{threeparttablex}
\usepackage{booktabs}
\usepackage{pdflscape}
\usepackage{longtable}
\usepackage{multirow}
\begin{document}
\begin{landscape}
\begin{ThreePartTable}
%
\begin{TableNotes}
\item[a] A note
\item[**] Another note
\end{TableNotes}
%
\begin{longtable}{ccccccccc}
\caption{Results of regression analysis} \\
\toprule
& \multicolumn{8}{c}{\textit{Dependent variable:}}\label{tab:exper_24} \\
\cmidrule{2-9}
\\[-1.8ex] & \multicolumn{8}{c}{Fill.Rate} \\
\\[-1.8ex] & \multicolumn{1}{c}{(1)} & \multicolumn{1}{c}{(2)} & \multicolumn{1}{c}{(3)} & \multicolumn{1}{c}{(4)} & \multicolumn{1}{c}{(5)} & \multicolumn{1}{c}{(6)} & \multicolumn{1}{c}{(7)} & \multicolumn{1}{c}{(8)}\\
%
ASC.TypeCRC & 0.193 & 0.135 & 0.151 & 0.153 & & & & 0.044 \\
& (0.087) & (0.089) & (0.063) & (0.078) & & & & (0.044) \\
ASC.TypeCSP & 0.159 & 0.142 & 0.076 & 0.301 & & & & \\
& (0.096) & (0.096) & (0.064) & (0.150) & & & & \\
ASC.TypeFSC & 0.468\tnote{a} & 0.470 & & & & & & \\
& (0.093) & (0.093) & & & & & & \\
ASC.TypeMSC & 0.292\tnote{**} & 0.287 & 0.127 & 0.134 & & & & \\
& (0.035) & (0.035) & (0.028) & (0.055) & & & & \\
ASC.TypeOthers & -0.103 & -0.111 & -0.232 & 0.208 & & & & \\
& (0.096) & (0.096) & (0.120) & (0.235) & & & & \\
Mdemand & & 0.00003 & & & & & & \\
& & (0.00001) & & & & & & \\
Target.CustomerGSPN & 0.087 & 0.090 & 0.094 & & & 0.144 & & \\
& (0.040) & (0.040) & (0.033) & & & (0.044) & & \\
Target.CustomerNormal order & -0.104 & -0.096 & 0.086 & & & 0.098 & & \\
& (0.028) & (0.028) & (0.026) & & & (0.033) & & \\
OFS.Order.Ratio & & & & 0.150 & 0.065 & & 0.214 & 0.049 \\
& & & & (0.060) & (0.043) & & (0.097) & (0.038) \\
Confirm.Ratio & & & & -0.006 & -0.034 & & -0.036 & 0.035 \\
& & & & (0.063) & (0.049) & & (0.095) & (0.040) \\
ROP & & & & -0.008 & -0.002 & & -0.010 & -0.003 \\
& & & & (0.005) & (0.003) & & (0.009) & (0.002) \\
OUL & & & & 0.009 & 0.002 & & 0.013 & 0.004 \\
& & & & (0.005) & (0.003) & & (0.008) & (0.002) \\
MDQ & & & & 0.025 & -0.011 & & 0.046 & -0.003 \\
& & & & (0.029) & (0.029) & & (0.041) & (0.027) \\
Stock.accuracy.Target1 & 0.168 & 0.069 & 0.100 & 0.026 & 0.010 & 0.251 & 0.005 & \\
& (0.102) & (0.107) & (0.071) & (0.083) & (0.048) & (0.159) & (0.165) & \\
Stock.Accuracy & & & & & & & & 0.198 \\
& & & & & & & & (0.073) \\
Constant & 0.580 & 0.570 & 0.685 & 0.576 & 0.888 & 0.669 & 0.526 & 0.670 \\
& (0.026) & (0.026) & (0.021) & (0.047) & (0.058) & (0.026) & (0.073) & (0.080) \\
\midrule
Observations & \multicolumn{1}{c}{1,737} & \multicolumn{1}{c}{1,737} & \multicolumn{1}{c}{508} & \multicolumn{1}{c}{170} & \multicolumn{1}{c}{40} & \multicolumn{1}{c}{344} & \multicolumn{1}{c}{109} & \multicolumn{1}{c}{38} \\
R$^{2}$ & \multicolumn{1}{c}{0.105} & \multicolumn{1}{c}{0.110} & \multicolumn{1}{c}{0.109} & \multicolumn{1}{c}{0.282} & \multicolumn{1}{c}{0.109} & \multicolumn{1}{c}{0.041} & \multicolumn{1}{c}{0.118} & \multicolumn{1}{c}{0.312} \\
Adjusted R$^{2}$ & \multicolumn{1}{c}{0.101} & \multicolumn{1}{c}{0.105} & \multicolumn{1}{c}{0.096} & \multicolumn{1}{c}{0.237} & \multicolumn{1}{c}{-0.052} & \multicolumn{1}{c}{0.032} & \multicolumn{1}{c}{0.066} & \multicolumn{1}{c}{0.152} \\
\addlinespace[0.5em]
\multirow{2}{*}{Residual Std. Error} & \multicolumn{1}{c}{0.382} & \multicolumn{1}{c}{0.382} & \multicolumn{1}{c}{0.238)} & \multicolumn{1}{c}{0.210} & \multicolumn{1}{c}{0.086} & \multicolumn{1}{c}{0.271)} & \multicolumn{1}{c}{0.248)} & \multicolumn{1}{c}{0.068} \\
& \multicolumn{1}{c}{df = 1728} & \multicolumn{1}{c}{df = 1727} & \multicolumn{1}{c}{df = 500} & \multicolumn{1}{c}{df = 159} & \multicolumn{1}{c}{df = 33} & \multicolumn{1}{c}{df = 340} & \multicolumn{1}{c}{df = 102} & \multicolumn{1}{c}{df = 30} \\
\addlinespace[0.5em]
\multirow{2}{*}{F Statistic} & \multicolumn{1}{c}{25.366} & \multicolumn{1}{c}{23.665} & \multicolumn{1}{c}{8.716} & \multicolumn{1}{c}{6.260} & \multicolumn{1}{c}{0.676} & \multicolumn{1}{c}{4.827} & \multicolumn{1}{c}{2.273} & \multicolumn{1}{c}{1.948} \\
& \multicolumn{1}{c}{df = 8; 1728} & \multicolumn{1}{c}{df = 9; 1727} & \multicolumn{1}{c}{df = 7; 500} & \multicolumn{1}{c}{df = 10; 159} & \multicolumn{1}{c}{df = 6; 33} & \multicolumn{1}{c}{df = 3; 340} & \multicolumn{1}{c}{df = 6; 102} & \multicolumn{1}{c}{df = 7; 30} \\
\bottomrule
\insertTableNotes\\
\end{longtable}
\end{ThreePartTable}
\end{landscape}
\end{document}