仅对部分标题进行分组

仅对部分标题进行分组

我想做这样的事:

在此处输入图片描述

它有两个标题:上面的标题我已经完成了,但现在我想为某些列添加下面的标题。有没有办法在 latex 中添加这样的标题?

我的尝试:

\begin{tabular}{lcccccccc}\hline \hline
 & Whole world & Base sample & Whole world & Base sample & Whole world & Base sample & Whole world & Base sample \\
 & (1) & (2) & (3) & (4) & (5) & (6) & (7) & (8) \\ \hline \\
 &  &  &  &  &  &  &  &  & \\
\multicolumn{6}{c}{Dependent variable is log GDP per capita in 1995 } \\
 &  &  &  &  &  &  &  &  \\

答案1

使用booktabsmakecell

在此处输入图片描述

\documentclass{article}
\usepackage{makecell}
\renewcommand{\theadfont}{\normalsize}
\usepackage{booktabs}
\begin{document}

\begin{tabular}{cccccccc}
\toprule
 \thead{Whole\\ world\\ (1)}
   & \thead{Base\\ sample\\ (2)} 
     & \thead{Whole\\ world\\ (3)}
       & \thead{Base\\ sample\\ (4)} 
         & \thead{Whole\\ world\\ (5)}
           & \thead{Base\\ sample\\ (6)} 
             & \thead{Whole\\ world\\ (7)}
               & \thead{Base\\ sample\\ (8)} \\
\midrule
\multicolumn{6}{c}{\thead[b]{Dependent variable is log GDP \\per capita in 1995} } & \multicolumn{2}{c}{\thead[b]{Dependent\\ variable is log\\ output per\\ worker in 1988 }}  \\
\cmidrule(r){1-6} \cmidrule(l){7-8}
0.54 & 0.54 & 0.54 & 0.54 & 0.54 & 0.54 & 0.54 & 0.54  \\
\bottomrule
 \end{tabular}
 \end{document}

答案2

您可以添加第二行,如下所示:

\documentclass{article}
\usepackage{geometry}
\geometry{a4paper, left=1cm, right=1cm, top=1cm, bottom=1cm,}
\usepackage{multicol}
\begin{document}
\begin{tabular}{cccccc}
Whole world & Base sample & Whole world & Base sample & Whole world & Base sample \\
(1) & (2) & (3) & (4) & (5) & (6) \\\hline
\multicolumn{4}{c}{Dependent variable is log GDP per capita in 1995}  & \multicolumn{2}{c}{Dependent variable is log GDP per capita in 1998}\\\cline{5-6}
A & B & C & D & E & F\\
A & B & C & D & E & F\\
A & B & C & D & E & F\\
A & B & C & D & E & F\\
\end{tabular}
\end{document}

然后你会得到结果: 示例表

相关内容