在表格环境中增加合并单元格的行高

在表格环境中增加合并单元格的行高

以下代码:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{float}
\graphicspath{ {./images/} }
\usepackage[top=2.5cm, bottom=2.5cm, left=2.75cm, right=2.75cm, a4paper]{geometry}
\usepackage{indentfirst}
\usepackage{hyperref}
\usepackage{multirow}
\usepackage{longtable}
\usepackage{pbox}

\usepackage[table]{xcolor} 
\definecolor{UniBlue}{RGB}{0,102,204}
\definecolor{UniOrange}{RGB}{255,128,0}
\usepackage{makecell}
\usepackage{subcaption}
\setlength{\parindent}{0pt}
\usepackage[]{xcolor}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{geometry}
\usepackage{booktabs}
\newcommand{\todo}[1]{\textcolor{red}{(#1)}}
\usepackage{notoccite}
\usepackage{textcomp}
\usepackage{nomencl}
\usepackage{xpatch}
\usepackage{etoolbox}
\usepackage{chemfig, upgreek, siunitx, chemformula, enumitem} % PACKAGES GERARDO
\usepackage{lscape}

\begin{document}

% Table generated by Excel2LaTeX from sheet 'Hoja7'
\begin{table}[htbp]
  \centering
  \caption{Research schedule for the project.}
  \rotatebox{90}{
  \scalebox{0.8}{
    \begin{tabular}{|l|c|c|c|c|c|c|c|c|c|c|c|c|}
    \hline
    \multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Activity / Term }}} & \multicolumn{3}{c|}{\textbf{2022}} & \multicolumn{3}{c|}{\textbf{2023}} & \multicolumn{3}{c|}{\textbf{2024}} & \multicolumn{3}{c|}{\textbf{2025}} \\
\cline{2-13}          & \textbf{Summer} & \textbf{Fall } & \textbf{Winter} & \textbf{Summer} & \textbf{Fall } & \textbf{Winter} & \textbf{Summer} & \textbf{Fall } & \textbf{Winter} & \textbf{Summer} & \textbf{Fall } & \textbf{Winter} \\
    \hline
    1. Literature review & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} \\
    \hline
    2. Courses and workshops & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &       &       &       &       &       &  \\
    \hline
    3. Comprehensive exam  &       &       & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &       &       &       &       &       &  \\
    \hline
    4. Acquisition of chemical reagents and equipment &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &       &       &       &       &       &  \\
    \hline
    5. Design of the photocatalytic floating device &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &       &  \\
    \hline
    6. Synthesis of \ch{TiO_2/Ag} composites &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &       &       &       &       &       &  \\
    \hline
    7. Characterization of \ch{TiO_2/Ag} composites &       &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &       &       &       &       &  \\
    \hline
    8. Synthesis of \ch{PU/TiO_2/Ag} fibers &       &       &       &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &  \\
    \hline
    9. Characterization of \ch{PU/TiO_2/Ag} fibers &       &       &       &       &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &       &  \\
    \hline
    10. Construction of the photocatalytic floating device &       &       &       &       &       &       &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &       &  \\
    \hline
    11. Photocatalytic floating device tests  &       &       &       &       &       &       &       &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &  \\
    \hline
    12. Article writting and submission &       &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &       &  \\
    \hline
    13. Thesis writing &       &       &       &       &       &       &       &       &       & \cellcolor[rgb]{ .647,  .647,  .647} & \cellcolor[rgb]{ .647,  .647,  .647} &  \\
    \hline
    14. Doctoral dissertation defense  &       &       &       &       &       &       &       &       &       &       &       & \cellcolor[rgb]{ .647,  .647,  .647} \\
    \hline
    \end{tabular}%
    }
    }
  \label{tab:research_schedule}%
\end{table}%

%\end{landscape}

\end{document}

生成如图所示的表格:

在此处输入图片描述

我想增加行高。有什么包或命令可以实现吗?此外,是否可以为夏季、秋季、冬季的列设置相同的宽度?

答案1

像这样?

在此处输入图片描述

使用(相对较新的)包tabularrayMWE 产生上述结果如下:

\documentclass{article}
\usepackage[a4paper, vmargin=2.5cm, hmargin=2.75cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage{chemfig, chemformula}
\usepackage[skip=1ex, font=small, labelfont=bf]{caption} 
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\usepackage{pdflscape}
\usepackage{hyperref}

\begin{document}

% Table generated by Excel2LaTeX from sheet 'Hoja7'
\begin{landscape}
    \begin{table}[htbp]
    \centering
    %\small
\caption{Research schedule for the project.}
\begin{tblr}{hline{2,4-Y}, vline{1,3-Z},
             colspec  = {r @{\ } X[l] *{12}{c}},
               colsep = 3.5pt,
               rowsep=4pt,
             cell{3}{3-14} = {bg=gray8},
             cell{4}{3-5}  = {bg=gray8},
             cell{5}{5}    = {bg=gray8},
             cell{6}{4-5}  = {bg=gray8},
             cell{7}{4-9}  = {bg=gray8},
             cell{8}{4-5}  = {bg=gray8},
             cell{9}{5-6}  = {bg=gray8},
             cell{10}{7-10}  = {bg=gray8},
             cell{11}{8-10}  = {bg=gray8},
             cell{12}{9-11}  = {bg=gray8},
             cell{13}{11-12}  = {bg=gray8},
             cell{14}{5-6, 8-9,11-12}  = {bg=gray8},
             cell{15}{12-13}  = {bg=gray8},
             cell{16}{14}  = {bg=gray8},
             row{1,2} = {font=\small\bfseries}
             }
    \toprule
\SetCell[r=2]{c} 
    & \SetCell[r=2]{c}  Activity / Term
        & \SetCell[c=3]{c}  2022    &   &
            & \SetCell[c=3]{c}  2023    &   &
                & \SetCell[c=3]{c}  2024    &   &
                    & \SetCell[c=3]{c}  2025    &   &                               \\
    &   & Summer & Fall & Winter 
        & Summer & Fall & Winter 
        & Summer & Fall & Winter 
        & Summer & Fall & Winter \\
    \midrule
1. &    Literature review 
        &   &   &   &   &   &   &   &   &   &   &   &   \\
2. &    Courses and workshops
        &   &   &   &   &   &   &   &   &   &   &   &   \\
3. &    Comprehensive exam
        &   &   &   &   &   &   &   &   &   &   &   &   \\
4. &   Acquisition of chemical reagents and equipment
        &   &   &   &   &   &   &   &   &   &   &   &   \\
5. &    Design of the photocatalytic floating device
        &   &   &   &   &   &   &   &   &   &   &   &   \\
6. &    Synthesis of \ch{TiO_2/Ag} composites
        &   &   &   &   &   &   &   &   &   &   &   &   \\
7. &    Characterization of \ch{TiO_2/Ag} composites
        &   &   &   &   &   &   &   &   &   &   &   &   \\
8. &    Synthesis of \ch{PU/TiO_2/Ag} fibers
        &   &   &   &   &   &   &   &   &   &   &   &   \\
9. &    Characterization of \ch{PU/TiO_2/Ag} fibers
        &   &   &   &   &   &   &   &   &   &   &   &   \\
10. &   Construction of the photocatalytic floating device
        &   &   &   &   &   &   &   &   &   &   &   &   \\
11. &   Photocatalytic floating device tests
        &   &   &   &   &   &   &   &   &   &   &   &   \\
12. &   Article writing and submission
        &   &   &   &   &   &   &   &   &   &   &   &   \\
13. &   Thesis writing
        &   &   &   &   &   &   &   &   &   &   &   &    \\
14. &   Doctoral dissertation defense
        &   &   &   &   &   &   &   &   &   &   &   &   \\
    \bottomrule
\end{tblr}
    \end{table}
\end{landscape}
\end{document}

正如您所看到的,在序言中,仅加载了与表格相关的包和tabularray库。例外是siunitxhyperref哪些只是为了说明如何以及在文档序言中的位置而添加的。

相关内容