如何降低多列单元格的高度?

如何降低多列单元格的高度?
\documentclass[12pt,a4paper]{report}
\usepackage[a4paper]{geometry}
\usepackage{rotating}
\usepackage{multirow}
\usepackage{multicol}

\begin{document}

\begin{table}[ht]
    \centering
    \begin{tabular}{  |p{4em}| p{5mm} | p{5mm} | p{6mm}| p{6mm} | p{6mm} | p{1cm}| p{1cm} | p{1cm}| p{1cm} |p{1cm}| p{1cm} | p{1.1cm}| }
    \hline
    \begin{sideways}Countries\end{sideways}& \begin{sideways}USA\end{sideways}&\begin{sideways}UK\end{sideways} &\begin{sideways}GERMANY\end{sideways}& \begin{sideways}RUSSIA\end{sideways}&\begin{sideways}FRANCE \end{sideways} & \begin{sideways}ROMANIA\end{sideways} & \begin{sideways}Czech REPUBLIC\end{sideways} & \begin{sideways}NETHERLANDS\end{sideways} & \multicolumn{3}{p{6mm}|}{\textbf{ASIA}}\\[-12ex]
    \cline{10-12}
    & & & & & & & & & \begin{sideways}INDIA\end{sideways} & \begin{sideways}CHINA\end{sideways} & \begin{sideways}PAKISTAN\end{sideways}\\
    \hline
    Scenario-1 & \Large\cmark & \cmark & \cmark & \cmark & \cmark & \cmark & \cmark & \cmark & \cmark & \cmark & \cmark  \\
    \hline
    Scenario-2 &  &  &  &  &  &  &  &  &  &  &   \\
    \hline
    \end{tabular}
    \caption{Countries }
    \label{tab:my_label}
\end{table}

\end{document}

表格输出

我正在努力保持亚洲在印度、中国和巴基斯坦列上方。但是,它不起作用。有人能帮帮我吗?

答案1

旋转框的基线位于底部,因此 ASIA 也在此对齐。最简单的解决方案是(虽然有点儿像 hack)将文本抬高。并将其居中。

\multicolumn{3}{c|}{\raisebox{14ex}{\textbf{ASIA}}}

答案2

也许你会喜欢它...

使用tabularray包装:

\documentclass[12pt,a4paper]{report}
\usepackage[a4paper]{geometry}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}
%
\usepackage{makecell}       % new
\usepackage{rotating}
\usepackage{tabularray}     % new
\UseTblrLibrary{booktabs}

\usepackage[skip=1ex,
            font=small, labelfont=bf]{caption}

\begin{document}
    \begin{table}[ht]
    \centering
\settowidth\rotheadsize{Czech Republic}    % from makecell
%
    \begin{tblr}{colspec = {Q[l] *{11}{X[c]}},
                  row{1} = {font = \bfseries},
                  row{2} = {cmd=\rotcell, c},
                row{3-Z} = {rowsep=0.5pt}
                } 
    \toprule
\SetCell[r=2]{f}    Scenario
    &   & \SetCell[c=7]{c}  EUROPE  
            &   &   &   &   &   &   &   \SetCell[c=3]{c}  ASIA    
                                        &   &           \\
    \cmidrule[lr]{3-9}   \cmidrule[lr]{10-12}
    & USA
        & UK
            & Germany
                & Russia
                    & France
                        & Romania
                            & Czech Republic
                                & Netherlands
                                    & India
                                        & China
                                            & Pakistan  \\
   \midrule
Scenario-1
    & \cmark & \cmark & \cmark & \cmark
    & \cmark & \cmark & \cmark & \cmark
    &        &        &      \\
Scenario-2 
    & \cmark &        &        &  
    &        &        &        &  
    & \cmark & \cmark & \cmark  \\
    \addlinespace
Scenario-3
    & \cmark & \cmark & \cmark & \cmark
    & \cmark & \cmark & \cmark & \cmark
    &        &        &      \\
Scenario-4
    & \cmark &        &        &
    &        &        &        &
    & \cmark & \cmark & \cmark  \\
    \hline
    \end{tblr}
\caption{Countries }
\label{tab:my_label}
    \end{table}
\end{document}

在此处输入图片描述

答案3

我建议您通过删除所有垂直线和大多数水平线并在标题中提供更正式的结构来改善表格的“外观”。

在此处输入图片描述

\documentclass[12pt,a4paper]{report}
\usepackage{geometry}
\usepackage{array,amssymb,graphicx,booktabs}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\let\cmark\checkmark

\begin{document}

\begin{table}[ht]
    \centering
    \begin{tabular}{@{} l @{\qquad} *{11}{C{6mm}} @{}}
    \toprule
     & \multicolumn{10}{c@{}}{Countries} \\
    \cmidrule(l){2-12}
    & & & & & & & & & \multicolumn{3}{c@{}}{Asia} \\
    \cmidrule(l){10-12}
    Scenario & \rotatebox{90}{USA} & \rotatebox{90}{UK} & \rotatebox{90}{Germany} 
             & \rotatebox{90}{Russia} & \rotatebox{90}{France} 
             & \rotatebox{90}{Romania} & \rotatebox{90}{Czech Rep.} 
             & \rotatebox{90}{Netherl's} & \rotatebox{90}{India} 
             & \rotatebox{90}{China} & \rotatebox{90}{Pakistan} \\
    \midrule
    1 & \Large\cmark & \cmark & \cmark & \cmark & \cmark & \cmark 
      & \cmark & \cmark & \cmark & \cmark & \cmark  \\
    \addlinespace
    2  \\
    \bottomrule
    \end{tabular}
    \caption{Countries }
    \label{tab:my_label}
\end{table}

\end{document}

相关内容