合并列标题并添加垂直分隔符

合并列标题并添加垂直分隔符

我想实现下表中的两件事但不知道如何实现:

  1. 我想合并第一行的标题以跨越第二行的列,以显示第 2 行是第 1 行的子维度。

  2. 我希望第 1 行和第 2 行之间的 cmidrule 在第 4 列和第 6 列之后有中断,以显示它们是不同的尺寸。

下图显示了我想要应用的另一个环境中的原始设计:

在此处输入图片描述

目前它看起来像这样:

在此处输入图片描述

非常感谢!

\documentclass[authoryear,11pt]{elsarticle}

%Packages
\usepackage[T1]{fontenc}
\usepackage{lmodern} 
\usepackage{natbib}
\usepackage{color}
\usepackage{setspace}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{array}
\usepackage{rotating}
\usepackage[table]{xcolor}
\usepackage{threeparttable}
\usepackage{longtable, lscape}
\usepackage{tabularx}
\usepackage{ragged2e}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{soul}
\usepackage{endnotes}
\usepackage{eurosym}
\usepackage{siunitx}
\usepackage{mathabx}
\usepackage[font=small]{caption}
%\usepackage{endfloat,threeparttable,longtable} %package puts tables and figures to the end
\usepackage[breaklinks=true,hidelinks,colorlinks=true,linkcolor=blauelsevier,urlcolor=blauelsevier, citecolor=blauelsevier]{hyperref}
\usepackage{etoolbox}

\robustify{\bfseries}


\begin{document}

\pagenumbering{roman}


%\vspace*{\fill}

\begin{sidewaystable}

\renewcommand{\arraystretch}{1.1}

%\setlength\tabcolsep{3pt} % default: 6pt
\small
\singlespacing
%\centering
\sisetup{detect-weight}

\begin{threeparttable}

\caption{\label{tab:tab_opening} Opening of formal insolvency proceedings}

\begin{tabularx}{\textwidth}{@{}
                       lCCCCCCC@{}}
    \toprule

    \bfseries 
        & \multicolumn{3}{C}{\bfseries Proceedings opened because of}
    & \multicolumn{2}{C}{\bfseries Debtors allowed to file for}
    & \multicolumn{1}{C}{\bfseries Creditors allowed to file for}\\
        \cmidrule{2-8}
        \bfseries Country
    & \multicolumn{1}{C}{\bfseries illiquidity}
    & \multicolumn{1}{C}{\bfseries imminent illiquidity}
    & \multicolumn{1}{C}{\bfseries over-indebtedness}
        & \multicolumn{1}{C}{\bfseries restructuring}
    & \multicolumn{1}{C}{\bfseries liquidation}
        & \multicolumn{1}{C}{\bfseries restructuring}
    & \multicolumn{1}{C}{\bfseries liquidation}\\


        \midrule
Austria & Yes   & No    & Yes   & Yes   & Yes   & No    & Yes \cr
Belgium & Yes   & Yes   & No    & Yes   & Yes   & No    & Yes \cr
Denmark & Yes   & No    & No    & Yes   & Yes   & Yes   & Yes \cr
Finland & Yes   & No    & Yes   & Yes   & Yes   & Yes   & Yes \cr
France & Yes   & No    & No    & Yes   & Yes   & Yes   & Yes \cr
Germany & Yes   & Yes   & Yes   & Yes   & Yes   & Yes   & Yes \cr
Greece & Yes   & No    & No    & Yes   & Yes   & No    & Yes \cr
Ireland & Yes   & No    & Yes   & Yes   & Yes   & Yes   & Yes \cr
Italy & Yes   & No    & No    & Yes   & Yes   & Yes   & Yes \cr
Luxembourg & Yes   & No    & No    & Yes   & Yes   & No    & Yes \cr
Netherlands & Yes   & Yes   & No    & Yes   & Yes   & No    & Yes \cr
Portugal & Yes   & No    & Yes   & Yes   & Yes   & Yes   & Yes \cr
Spain & Yes   & Yes   & No    & Yes   & Yes   & Yes   & Yes \cr
Sweden & Yes   & No    & No    & Yes   & Yes   & Yes   & Yes \cr
United Kingdom & Yes   & No    & Yes   & Yes   & Yes   & Yes   & Yes \cr
      &       &       &       &       &       &       &  \cr
Brazil & Yes   & No    & Yes   & Yes   & Yes   & No    & Yes \cr
China & Yes   & Yes   & No    & Yes   & Yes   & Yes   & Yes \cr
India & Yes   & No    & No    & No    & Yes   & No    & Yes \cr
Russia & Yes   & No    & No    & Yes   & Yes   & No    & Yes \cr
      &       &       &       &       &       &       &  \cr
United States of America & Yes   & No    & No    & Yes   & Yes   & Yes   & Yes \cr

        \bottomrule


\end{tabularx}%

\begin{tablenotes}[flushleft]\labelsep0.0em
\item Notes: This table provides an overview of the provisions for the opening of insolvency proceedings in each country of the sample. Columns (1) to (3) provide the available grounds to file for insolvency. Firms that are not able to make any due payments are considered illiquid. Firms that are able to foresee illiquidity in the near future are considered imminently illiquid. Firms with more liabilities than assets and a lack of positive business prospects are considered over-indebted. Columns (4) to (7) inform whether debtors and/or creditors are allowed to file for liquidation and/or restructuring proceedings.
\end{tablenotes}

\end{threeparttable}
\par

\end{sidewaystable}

%\vspace*{\fill}

\end{document}

答案1

这是一个基于makecell及其\rothead命令的解决方案。您不必使用环境sidewaystable。我还加载了geometry包以获得更合理的边距。我删除了 mathabx有问题的lmodern(重复命令),并且color由于您加载了xcolor。最后,我按类别对包进行了分组,以获得更短的序言:

\documentclass[authoryear,11pt]{elsarticle}
%Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern, eurosym}%, mathabx
\usepackage{lscape}
\usepackage[showframe]{geometry}
\usepackage{ragged2e}
\usepackage{setspace}
\usepackage{graphicx, rotating}
\usepackage{amsmath}
\usepackage{natbib}
\usepackage[table]{xcolor}
\usepackage{booktabs, makecell, longtable, tabularx, threeparttable}
\usepackage[font=small]{caption}
\usepackage{soul}
\usepackage{endnotes}
\usepackage{siunitx}
%\usepackage{endfloat} %package puts tables and figures to the end
\usepackage[breaklinks=true,hidelinks,colorlinks=true,linkcolor=blauelsevier,urlcolor=blauelsevier, citecolor=blauelsevier]{hyperref}
\usepackage{etoolbox}

\robustify{\bfseries}

\begin{document}

\pagenumbering{roman}

\newcolumntype{C}{>{\Centering\arraybackslash}X}
\renewcommand{\arraystretch}{1.15}
\setlength{\tabcolsep}{3pt}
\small
\singlespacing
\centering
\sisetup{detect-weight}
\renewcommand\theadfont{\small\bfseries}
\settowidth{\rotheadsize}{\small\bfseries restructuring?}
\renewcommand{\theadalign}{bc}
\begin{threeparttable}
\caption{\label{tab:tab_opening} tbd}
\begin{tabularx}{\linewidth}{@{} l*{8}{C}@{}}
\toprule
\bfseries
& \multicolumn{3}{c}{\thead[b]{Can proceedings be\\ opened because of ...}}
 & \multicolumn{2}{c}{\thead[b]{Are debtors\\ allowed to \\ file for ...}}
 & \multicolumn{2}{c}{\thead[b]{Are creditors\\ allowed to\\ file for ...}}\\[-1ex]
 \cmidrule(lr){2-4} \cmidrule(r){5-6} \cmidrule(r){7-8}\addlinespace[-1ex]
    \thead[lb]{Country}
    & \rothead{illiquidity?}
    & \rothead{imminent illiquidity?}
    & \rothead{over-indebtedness?}
    & \rothead{liquidation?}
    & \rothead{restructuring?}
    & \rothead{liquidation?}
     & \rothead{restructuring?}\\[-1ex]
    \midrule
    Austria & Yes & No & Yes & Yes & Yes & Yes & No\\
    Belgium & Yes & Yes & No & Yes & Yes & Yes & No \\
    Denmark & Yes & No & No & Yes & Yes & Yes & Yes \\
    Finland & Yes & No & Yes & Yes & Yes & Yes & Yes \\
    France & Yes & No & No & Yes & Yes & Yes & Yes \\
    Germany & Yes & Yes & Yes & Yes & Yes & Yes & Yes \\
    Greece & Yes & No & No & Yes & Yes & Yes & No \\
    Ireland & Yes & No & Yes & Yes & Yes & Yes & Yes \\
    Italy & Yes & No & No & Yes & Yes & Yes & Yes \\
    Luxembourg & Yes & No & No & Yes & Yes & Yes & No \\
    Netherlands & Yes & Yes & No & Yes & Yes & Yes & No \\
    Portugal & Yes & No & Yes & Yes & Yes & Yes & Yes \\
    Spain & Yes & Yes & No & Yes & Yes & Yes & Yes \\
    Sweden & Yes & No & No & Yes & Yes & Yes & Yes \\
    United Kingdom & Yes & No & Yes & Yes & Yes & Yes & Yes \\%
    \addlinespace[2ex]
    Brazil & Yes & No & Yes & Yes & Yes & Yes & No \\
    China & Yes & Yes & No & Yes & Yes & Yes & Yes \\
    India & Yes & No & No & Yes & No & Yes & No \\
    Russia & Yes & No & No & Yes & Yes & Yes & No \\
    \addlinespace[2ex]
    \makecell[lc]{United States\\ of America} & Yes & No & No & Yes & Yes & Yes & Yes \\
    \bottomrule
\end{tabularx}%
\smallskip
\begin{tablenotes}[flushleft]\labelsep0.0em
\item Notes: tbd
\end{tablenotes}
\end{threeparttable}
%\end{sidewaystable}

\end{document} 

在此处输入图片描述

相关内容