在下面的线我请求帮助解决长桌问题。MWE 报告称:
\documentclass[11pt]{article}
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage[labelfont=bf, textfont=it,
labelsep=newline,
justification=centering]{caption}
\captionsetup[table]{ skip=1.4pt, labelfont=sc}
\usepackage{adjustbox} % it load graphicx
%\usepackage{graphicx}
\usepackage{rotating}
\usepackage{booktabs, longtable, ltablex, makecell, multirow} % <---
\usepackage[referable,para]{threeparttablex}
\usepackage{pdflscape}
\usepackage{stackengine}
\usepackage{interval}
\usepackage{amsmath,ragged2e} % <-- new
\usepackage{interval,pbox}
\usepackage{pgffor}
\newcommand\Quad[1][1]{\foreach \Quaddy in {1,...,#1}{\quad}\ignorespaces}
\usepackage{siunitx}
\sisetup{group-separator={,},
table-format=1.3,
table-space-text-post=***,
table-number-alignment =center}
\newcommand*{\MyIndent}
{\hspace*{1.5cm}}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\newcommand\mytab[1]{%
\smash[b]{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\hyphenation{bur-kina}
\begin{document}
\setlength{\tabcolsep}{4pt}
\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{ThreePartTable}
\begin{TableNotes}[flushleft]\footnotesize
\note:TBW \\
\item[*] $p<0.5$
\item[**] $p<0.1$
\item[***] $p<0.01$
\end{TableNotes}
%
\begin{tabularx}{\linewidth}{X *{5}{d{3.5}}}
\caption{OLS estimation - Dependent variable std\_gpa \label{OLSstd}} \\
\toprule
& \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} \\
\midrule
\endfirsthead
\caption[]{OLS estimation - Dependent variable std\_gpa \label{OLSstd} (continue)} \\
\toprule
& \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} \\
\midrule
\endhead
\bottomrule
\insertTableNotes \\
\multicolumn{6}{r}{\textit{Continue on next page}}
\endfoot
\bottomrule
\insertTableNotes
\endlastfoot
%%%% table body
autonuni & 0.020 & 0.019 & 0.013 & 0.011 & 0.011 \\
& (0.013) & (0.013) & (0.013) & (0.013) & (0.013) \\
\addlinespace
female & & 0.168\sym{***}
& 0.129\sym{***}
& 0.127\sym{***}
& 0.138\sym{***} \\
& & (0.046) & (0.042) & (0.044) & (0.041) \\
\addlinespace
z\_age & & -1.142\sym{**}
& -1.070\sym{**}
& -1.122\sym{**}
& -0.977\sym{*} \\
& & (0.564) & (0.518) & (0.519) & (0.521) \\
\addlinespace
z\_age2 & & 1.113\sym{*}
& 1.044\sym{*}
& 1.098\sym{**}
& 0.957\sym{*} \\
& & (0.570) & (0.523) & (0.523) & (0.525) \\
\addlinespace
school\_scientlic
& & -0.083 & -0.081 & -0.089 & -0.091\sym{*} \\
& & (0.057) & (0.056) & (0.056) & (0.053) \\
\addlinespace
school\_otherlic & & -0.179\sym{***}
& -0.173\sym{***}
& -0.178\sym{***}
& -0.169\sym{***} \\
& & (0.039) & (0.039) & (0.037) & (0.040) \\
\addlinespace
school\_techvoc
& & -0.332\sym{***}
& -0.338\sym{***}
& -0.338\sym{***}
& -0.345\sym{***} \\
& & (0.066) & (0.065) & (0.060) & (0.059) \\
\addlinespace
z\_e & & & -0.026 & -0.024 & -0.023 \\
& & & (0.019) & (0.019) & (0.019) \\
\addlinespace
z\_a & & & -0.040\sym{*}
& -0.042\sym{*}
& -0.038 \\
& & & (0.023) & (0.023) & (0.023) \\
\addlinespace
z\_c & & & 0.094\sym{***}
& 0.093\sym{***}
& 0.091\sym{***} \\
& & & (0.017) & (0.017) & (0.017) \\
\addlinespace
z\_n & & & -0.034 & -0.029 & -0.028 \\
& & & (0.024) & (0.023) & (0.022) \\
\addlinespace
z\_o & & & 0.037\sym{**}
& 0.036\sym{**}
& 0.037\sym{**} \\
& & & (0.018) & (0.017) & (0.017) \\
\addlinespace
edufat\_high & & & & 0.037 & 0.026 \\
& & & & (0.040) & (0.039) \\
\addlinespace
edufat\_l & & & & -0.042 & -0.048 \\
& & & & (0.053) & (0.055) \\
\addlinespace
edumot\_high & & & & -0.039 & -0.048 \\
& & & & (0.050) & (0.050) \\
edumot\_l & & & & 0.099 & 0.085 \\
& & & & (0.062) & (0.059) \\
\addlinespace
occupfat\_d2 & & & & -0.059 & -0.055 \\
& & & & (0.054) & (0.055) \\
\addlinespace
occupfat\_d3 & & & & -0.164\sym{***}
& -0.159\sym{**} \\
& & & & (0.059) & (0.059) \\
\addlinespace
occupfat\_d4 & & & & 0.084 & 0.087 \\
& & & & (0.157) & (0.155) \\
\addlinespace
occupfat\_d5 & & & & -0.282\sym{***}
& -0.288\sym{***} \\
& & & & (0.070) & (0.073) \\
\addlinespace
occupmot\_d2 & & & & -0.062 & -0.051 \\
& & & & (0.038) & (0.038) \\
\addlinespace
occupmot\_d3 & & & & -0.150\sym{**}
& -0.135\sym{*} \\
& & & & (0.068) & (0.069) \\
\addlinespace
occupmot\_d4 & & & & 0.063 & 0.061 \\
& & & & (0.054) & (0.054) \\
\addlinespace
occupmot\_d5 & & & & 0.024 & 0.027 \\
& & & & (0.181) & (0.178) \\
\addlinespace
jobsectfat\_d2 & & & & -0.011 & -0.015 \\
& & & & (0.060) & (0.061) \\
\addlinespace
jobsectfat\_d3 & & & & -0.035 & -0.041 \\
& & & & (0.077) & (0.076) \\
\addlinespace
jobsectfat\_d4 & & & & -0.037 & -0.034 \\
& & & & (0.044) & (0.045) \\
\addlinespace
jobsectmot\_d2 & & & & 0.063 & 0.072 \\
& & & & (0.119) & (0.117) \\
\addlinespace
jobsectmot\_d3 & & & & 0.211 & 0.184 \\
& & & & (0.155) & (0.155) \\
\addlinespace
jobsectmot\_d4 & & & & -0.029 & -0.018 \\
& & & & (0.043) & (0.044) \\
\addlinespace
resid\_provme & & & & & 0.002 \\
& & & & & (0.033) \\
\addlinespace
resid\_othersicily & & & & & -0.084 \\
& & & & & (0.062) \\
\addlinespace
resid\_rc & & & & & 0.004 \\
& & & & & (0.079) \\
\addlinespace
resid\_provrc & & & & & -0.175\sym{***} \\
& & & & & (0.062) \\
\addlinespace
resid\_othercalabria
& & & & & -0.374\sym{***} \\
& & & & & (0.093) \\
\addlinespace
resid\_otheritaly & & & & & 0.035 \\
& & & & & (0.227) \\
\midrule
\(N\) & \mc{3242} & \mc{3242} & \mc{3242} & \mc{3242} & \mc{3242} \\
\end{tabularx}
\end{ThreePartTable}
\end{document}
由于我需要添加额外的列,因此我想使用横向。我尝试在 sidewaystable 环境中封装从 ThreePartTable 开始的部分,但没有成功。有什么帮助吗?
答案1
您的问题已经通过我上面的评论解决了,但是请允许我添加一些题外的建议:
- 如果你愿意
threeparttable
用包longtblr
中定义的表环境替换tabularray
,表代码会变得更短更清晰: - 您可以使用
longtblr
相应更改的选项向表中添加更多列colspec
。 - 现有的使用MWE编写的方法
longblr
是:
\documentclass[11pt]{article}
\usepackage[a4paper,margin=1.5cm]{geometry}
\usepackage[labelfont=bf, textfont=it,
labelsep=newline,
justification=centering]{caption}
\captionsetup[table]{ skip=1.4pt, labelfont=sc}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx} % <---
\ExplSyntaxOn
\NewChildSelector{eachtwo}
{
\int_step_inline:nnnn {3}{2}{\l_tblr_childs_total_tl}
{ \clist_put_right:Nn \l_tblr_childs_clist {##1} }
}
\ExplSyntaxOff
\usepackage{pdflscape}
\sisetup{group-separator={,},
table-format={(}1.3{***},
input-open-uncertainty =,
input-close-uncertainty=,
}
\begin{document}
\begin{landscape}
%
\begin{longtblr}[
caption = {OLS estimation - Dependent variable std\_gpa},
label = {OLSstd},
remark{Note} = {TBW\\
$^*p<0.1;~^{**}p<0.05;~^{***}p<0.01$.},
]{%colsep = 4pt,
colspec = {@{} X *{5}{S} @{}},
row{2-Z} = {rowsep=0pt},
row{eachtwo} = {abovesep=1ex},
rowhead = 1,
}
\toprule
% column headers
& {{{(1)}}} & {{{(2)}}} & {{{(3)}}} & {{{(4)}}} & {{{(5)}}} \\
\midrule
% table body
autonuni & 0.020 & 0.019 & 0.013 & 0.011 & 0.011 \\
& (0.013) & (0.013) & (0.013) & (0.013) & (0.013) \\
female & & 0.168\TblrNote{***}
& 0.129\TblrNote{***}
& 0.127\TblrNote{***}
& 0.138\TblrNote{***} \\
& & (0.046) & (0.042) & (0.044) & (0.041) \\
z\_age & & -1.142\TblrNote{**}
& -1.070\TblrNote{**}
& -1.122\TblrNote{**}
& -0.977\TblrNote{*} \\
& & (0.564) & (0.518) & (0.519) & (0.521) \\
z\_age2 & & 1.113\TblrNote{*}
& 1.044\TblrNote{*}
& 1.098\TblrNote{**}
& 0.957\TblrNote{*} \\
& & (0.570) & (0.523) & (0.523) & (0.525) \\
school\_scientlic
& & -0.083 & -0.081 & -0.089 & -0.091\TblrNote{*} \\
& & (0.057) & (0.056) & (0.056) & (0.053) \\
school\_otherlic & & -0.179\TblrNote{***}
& -0.173\TblrNote{***}
& -0.178\TblrNote{***}
& -0.169\TblrNote{***} \\
& & (0.039) & (0.039) & (0.037) & (0.040) \\
school\_techvoc
& & -0.332\TblrNote{***}
& -0.338\TblrNote{***}
& -0.338\TblrNote{***}
& -0.345\TblrNote{***} \\
& & (0.066) & (0.065) & (0.060) & (0.059) \\
z\_e & & & -0.026 & -0.024 & -0.023 \\
& & & (0.019) & (0.019) & (0.019) \\
z\_a & & & -0.040\TblrNote{*}
& -0.042\TblrNote{*}
& -0.038 \\
& & & (0.023) & (0.023) & (0.023) \\
z\_c & & & 0.094\TblrNote{***}
& 0.093\TblrNote{***}
& 0.091\TblrNote{***} \\
& & & (0.017) & (0.017) & (0.017) \\
z\_n & & & -0.034 & -0.029 & -0.028 \\
& & & (0.024) & (0.023) & (0.022) \\
z\_o & & & 0.037\TblrNote{**}
& 0.036\TblrNote{**}
& 0.037\TblrNote{**} \\
& & & (0.018) & (0.017) & (0.017) \\
edufat\_high & & & & 0.037 & 0.026 \\
& & & & (0.040) & (0.039) \\
edufat\_l & & & & -0.042 & -0.048 \\
& & & & (0.053) & (0.055) \\
edumot\_high & & & & -0.039 & -0.048 \\
& & & & (0.050) & (0.050) \\
edumot\_l & & & & 0.099 & 0.085 \\
& & & & (0.062) & (0.059) \\
occupfat\_d2 & & & & -0.059 & -0.055 \\
& & & & (0.054) & (0.055) \\
occupfat\_d3 & & & & -0.164\TblrNote{***}
& -0.159\TblrNote{**} \\
& & & & (0.059) & (0.059) \\
occupfat\_d4 & & & & 0.084 & 0.087 \\
& & & & (0.157) & (0.155) \\
occupfat\_d5 & & & & -0.282\TblrNote{***}
& -0.288\TblrNote{***} \\
& & & & (0.070) & (0.073) \\
occupmot\_d2 & & & & -0.062 & -0.051 \\
& & & & (0.038) & (0.038) \\
occupmot\_d3 & & & & -0.150\TblrNote{**}
& -0.135\TblrNote{*} \\
& & & & (0.068) & (0.069) \\
occupmot\_d4 & & & & 0.063 & 0.061 \\
& & & & (0.054) & (0.054) \\
occupmot\_d5 & & & & 0.024 & 0.027 \\
& & & & (0.181) & (0.178) \\
jobsectfat\_d2 & & & & -0.011 & -0.015 \\
& & & & (0.060) & (0.061) \\
jobsectfat\_d3 & & & & -0.035 & -0.041 \\
& & & & (0.077) & (0.076) \\
jobsectfat\_d4 & & & & -0.037 & -0.034 \\
& & & & (0.044) & (0.045) \\
jobsectmot\_d2 & & & & 0.063 & 0.072 \\
& & & & (0.119) & (0.117) \\
jobsectmot\_d3 & & & & 0.211 & 0.184 \\
& & & & (0.155) & (0.155) \\
jobsectmot\_d4 & & & & -0.029 & -0.018 \\
& & & & (0.043) & (0.044) \\
resid\_provme & & & & & 0.002 \\
& & & & & (0.033) \\
resid\_othersicily & & & & & -0.084 \\
& & & & & (0.062) \\
resid\_rc & & & & & 0.004 \\
& & & & & (0.079) \\
resid\_provrc & & & & & -0.175\TblrNote{***} \\
& & & & & (0.062) \\
resid\_othercalabria
& & & & & -0.374\TblrNote{***} \\
& & & & & (0.093) \\
resid\_otheritaly & & & & & 0.035 \\
& & & & & (0.227) \\
\midrule
\(N\) &{{{3242}}} &{{{3242}}} &{{{3242}}} &{{{3242}}} &{{{3242}}} \\
\bottomrule
\end{longtblr}
\end{landscape}
\end{document}