열 헤더 아래 줄

열 헤더 아래 줄

아래에 표시된 예와 같이 열 헤더 아래에 해당 줄을 얻고 싶습니다.

여기에 이미지 설명을 입력하세요

사용해 보았지만 \multicolumn{3}{c}{-}작동하지 않습니다. 사용 \midrule이나 다른 것 모두 작동하지 않았습니다. 힌트가 있나요?

완전성을 위해 아래의 전체 코드

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{booktabs,tabularx,dcolumn,adjustbox}
\usepackage[flushleft]{threeparttable}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{d}[1]{D..{#1}}
\usepackage[font=large,skip=.333\baselineskip]{caption}
\usepackage[margin=0.5in]{geometry}

\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\mC[1]{\multicolumn{1}{c}{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\newcommand\ic[1]{\multicolumn{1}{D..{6.2}}{#1}}
\newcommand\pc[1]{\multicolumn{1}{D..{0.1}}{#1}}

\begin{document}

\begin{center}
\begin{threeparttable}

\captionof{table}{Labour and money control}
        \begin{tabular}{@{} l *{7}{d{2.5}} @{}} 
            \toprule\toprule
            &\multicolumn{3}{c}{\textbf{Poor sample}}&\multicolumn{3}{c}{\textbf{Rich sample}}\\
            &\cline{1-3}&\cline{4-6}
            & \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} & \mc{(6)}  \\\midrule
            \addlinespace
            Outcome & \mC{OLS} 
            & \mC{RF} 
            & \mC{IV}
            & \mC{OLS} 
            & \mC{RF} 
            & \mC{IV}\\ 
            \midrule
            Employed & 0.002 & 0.0107 & 0.0276 & 0.0144^{***}&0.0618^{*}& 0.316 \\
            & (0.003) &  (0.0286) &(0.0755)& (0.003)  & (0.0332) & (0.444)\\ 
            \addlinespace
            Agricultural job & -0.003  & -0.004&  -0.0056&-0.0213^{***}&0.0558 & 0.212\\
            & (0.004) &  (0.0315) & (0.0466)& (0.0313)& (0.0218) & (0.235) \\ 
            \addlinespace
            Paid job & 0.001 & -0.079^{*}  &-0.167& 0.0317^{***}&-0.125^{*}& 0.559\\
            & (0.004)  & (0.0437) & (0.123) & (0.003) & (0.0528) & (0.785) \\ 
            \addlinespace
            Self employed & 0.005 & 0.007  &0.008& -0.0253^{***}&-0.0458& 0.485\\
            & (0.004)  & (0.0424) & (0.0501) & (0.004) & (0.0419) & (1.793) \\ 
            \addlinespace
            Family worker & -0.003 & 0.0296  &-0.0370&-0.004&0.0451^{*}& -0.722\\
            & (0.003)  & (0.0362) & (0.0424) & (0.003) & (0.0268) & (3.551) \\ 
            \addlinespace
            Own earings decision & 0.0141^{*} & -0.0107^{*}  &-0.009& 0.0123^{***}&0.0688& 0.458\\
            & (0.008)  & (0.0840) & (0.0726) & (0.004) & (0.0572) & (1.504) \\ 
            \addlinespace
            Husband's earings decision & 0.0140^{***} & 0.0739^{*}  &0.0221^{***}& 0.0123^{***}&-0.0303& -0.106\\
            & (0.004)  & (0.0507) & (0.0737) & (0.003) & (0.0512) & (0.175) \\ 
            \addlinespace
            \textit{Mean} & \pc{0.71}& \pc{0.39}& \pc{0.44} & \pc{0.70} & \pc{0.14}& \pc{3.16}\\
            Bandwidth & \ic{34} & \ic{35} & \ic{32} & \ic{29}& \ic{23}& \ic{34}\\ 
            Obs & \ic{4,322} & \ic{4,454} & \ic{2,822}& \ic{2,630}& \ic{2,109}& \ic{4,454}\\
            \bottomrule
            \addlinespace
            \multicolumn{7}{c}{ $^{***}\ p<0.01$; $^{**}\ p<0.05$; $^{*}\  p<0.1$} \\
        \end{tabular}
\begin {tablenotes}
\small
\item Notes: 
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{document}

편집하다: 내 결과는 여기에 이미지 설명을 입력하세요

두 줄을 같은 수준에 두는 방법은 무엇입니까?

답변1

booktabs여기에 사용하면 \cmidrule. (lr)바가 조금 짧아집니다 .

cmidrule

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{rotating}
\usepackage{booktabs,tabularx,dcolumn,adjustbox}
\usepackage[flushleft]{threeparttable}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{d}[1]{D..{#1}}
\usepackage[font=large,skip=.333\baselineskip]{caption}
\usepackage[margin=0.5in]{geometry}

\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\newcommand\mC[1]{\multicolumn{1}{c}{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\newcommand\ic[1]{\multicolumn{1}{D..{6.2}}{#1}}
\newcommand\pc[1]{\multicolumn{1}{D..{0.1}}{#1}}

\begin{document}

\begin{center}
\begin{threeparttable}

\captionof{table}{Labour and money control}
        \begin{tabular}{@{} l *{7}{d{2.5}} @{}} 
            \toprule
            &\multicolumn{3}{c}{\textbf{Poor sample}}&\multicolumn{3}{c}{\textbf{Rich sample}}\\\cmidrule(lr){2-4}\cmidrule(lr){5-7}
            & \mc{(1)} & \mc{(2)} & \mc{(3)} & \mc{(4)} & \mc{(5)} & \mc{(6)}  \\\midrule
            \addlinespace
            Outcome & \mC{OLS} 
            & \mC{RF} 
            & \mC{IV}
            & \mC{OLS} 
            & \mC{RF} 
            & \mC{IV}\\ 
            \midrule
            Employed & 0.002 & 0.0107 & 0.0276 & 0.0144^{***}&0.0618^{*}& 0.316 \\
            & (0.003) &  (0.0286) &(0.0755)& (0.003)  & (0.0332) & (0.444)\\ 
            \addlinespace
            Agricultural job & -0.003  & -0.004&  -0.0056&-0.0213^{***}&0.0558 & 0.212\\
            & (0.004) &  (0.0315) & (0.0466)& (0.0313)& (0.0218) & (0.235) \\ 
            \addlinespace
            Paid job & 0.001 & -0.079^{*}  &-0.167& 0.0317^{***}&-0.125^{*}& 0.559\\
            & (0.004)  & (0.0437) & (0.123) & (0.003) & (0.0528) & (0.785) \\ 
            \addlinespace
            Self employed & 0.005 & 0.007  &0.008& -0.0253^{***}&-0.0458& 0.485\\
            & (0.004)  & (0.0424) & (0.0501) & (0.004) & (0.0419) & (1.793) \\ 
            \addlinespace
            Family worker & -0.003 & 0.0296  &-0.0370&-0.004&0.0451^{*}& -0.722\\
            & (0.003)  & (0.0362) & (0.0424) & (0.003) & (0.0268) & (3.551) \\ 
            \addlinespace
            Own earings decision & 0.0141^{*} & -0.0107^{*}  &-0.009& 0.0123^{***}&0.0688& 0.458\\
            & (0.008)  & (0.0840) & (0.0726) & (0.004) & (0.0572) & (1.504) \\ 
            \addlinespace
            Husband's earings decision & 0.0140^{***} & 0.0739^{*}  &0.0221^{***}& 0.0123^{***}&-0.0303& -0.106\\
            & (0.004)  & (0.0507) & (0.0737) & (0.003) & (0.0512) & (0.175) \\ 
            \addlinespace
            \textit{Mean} & \pc{0.71}& \pc{0.39}& \pc{0.44} & \pc{0.70} & \pc{0.14}& \pc{3.16}\\
            Bandwidth & \ic{34} & \ic{35} & \ic{32} & \ic{29}& \ic{23}& \ic{34}\\ 
            Obs & \ic{4,322} & \ic{4,454} & \ic{2,822}& \ic{2,630}& \ic{2,109}& \ic{4,454}\\
            \bottomrule
            \addlinespace
            \multicolumn{7}{c}{ $^{***}\ p<0.01$; $^{**}\ p<0.05$; $^{*}\  p<0.1$} \\
        \end{tabular}
\begin {tablenotes}
\small
\item Notes: 
\end{tablenotes}
\end{threeparttable}
\end{center}
\end{document}

관련 정보