多列表格

多列表格

在此处输入图片描述

您好,我在构建此表时遇到了问题。请尽快给我答复。因此我尝试了以下方法:

\documentclass{article}

% Definitions
\usepackage{lscape}
\usepackage[height=25cm]{geometry}
\usepackage{timetable}
\usepackage{array}
\usepackage{multirow}

\begin{document}
\begin{table}[htbp]
  \centering
  %\caption{Add caption}
    \begin{tabular}{|c|c|c|c|c|c|c|}
    \hline
    \multirow{3}[4]{*}{S.No} & \multirow{4}[5]{*}{Activity} & \multicolumn{4}{c|}{\multirow{2}[2]{*}{2017 }}\\
         & \multicolumn{5}{c|}{} \\
\cline{2-3} & \cline{3-5}           & Feb-Mar   & Apr-Jun    & Jul-Sept    & Oct-Dec   \\
    \hline
     1& Literature on Polynomial Optimization   &       &       &       &        \\
    \hline
     2&Solution to Question 1A   &       &       &       &        \\
    \hline
     3&Solution to Question 1b    &       &       &       &       \\
    \hline
     4& Solution to Question 2  &       &       &       &        \\
    \hline
     5& Conjecture    &       &       &       &        \\
    \hline
    \end{tabular}%
  \label{tab:addlabelkiki}%
\end{table}%
\end{document} 

\documentclass{article}

% Definitions
\usepackage{lscape}
\usepackage[height=25cm]{geometry}
\usepackage{timetable}
\usepackage{array}
\usepackage{multirow}

\begin{document}
\begin{table}[htbp]
  \centering
  %\caption{Add caption}
    \begin{tabular}{|c|c|c|c|c|c|c|}
    \hline
    \multirow{3}[4]{*}{S.No} & \multirow{4}[5]{*}{Activity} & \multicolumn{4}{c|}{\multirow{2}[2]{*}{2017 }}\\
         & \multicolumn{5}{c|}{} \\
\cline{2-3} & \cline{3-5}           & Feb-Mar   & Apr-Jun    & Jul-Sept    & Oct-Dec   \\
    \hline
     1& Literature on Polynomial Optimization   &       &       &       &        \\
    \hline
     2&Solution to Question 1A   &       &       &       &        \\
    \hline
     3&Solution to Question 1b    &       &       &       &       \\
    \hline
     4& Solution to Question 2  &       &       &       &        \\
    \hline
     5& Conjecture    &       &       &       &        \\
    \hline
    \end{tabular}%
  \label{tab:addlabelkiki}%
\end{table}%
\end{document} 

事实上这就是我尝试过的。

答案1

在此处输入图片描述

\documentclass{article}

% Definitions
\usepackage[margin=2cm]{geometry}
\usepackage[table]{xcolor}
\usepackage{array,
            makecell, multirow, 
            tabularx}
\renewcommand\theadfont{\small\bfseries}

\begin{document}
    \begin{table}[ht]
\caption{Add caption}
    \small
    \sffamily
    \centering
\renewcommand\arraystretch{1.2}
    \begin{tabularx}{\linewidth}{|c|>{\raggedright}p{11em}|*{9}{>{\centering\arraybackslash}X|}}
    \cline{3-11}
\multicolumn{2}{c|}{}
        &   \multicolumn{4}{c|}{\thead{2017}}
            &   \multicolumn{4}{c|}{\thead{2018}}
                &   \thead{2019}                            \\
    \hline
\thead{S.\\ No}
    &   \thead{Activity}
        &   \thead{Feb -\\ Mar}
            &   \thead{Apr -\\ Jun}
                &   \thead{Jul -\\ Sep}
                    &   \thead{Oct -\\ Dec}
        &   \thead{Jan -\\ Mar}
            &   \thead{Apr -\\ Jun}
                &   \thead{Jul -\\ Sep}
                    &   \thead{Oct -\\ Dec} 
        &   \thead{Jan -\\ Mar}                             \\      
    \hline
1   &   Literature on Polynomial Optimization   
        &   \cellcolor{gray!30}       
            &   \cellcolor{gray!30}
                &   &   &   &   &   &   &                   \\
    \hline
2   &   Solution to Question 1A   
        &   &   \cellcolor{gray!30}
                &   \cellcolor{gray!30}
                    &   &   &   &   &   &                   \\
    \hline
3   &   Solution to Question 1B    
        &   &   &   \cellcolor{gray!30}
                    &   \cellcolor{gray!30}
                        &   &   &   &   &                   \\
    \hline
4   &   Solution to Question 2  
        &   &   &   &  \cellcolor{gray!30}
                        &   \cellcolor{gray!30}
                            &   &   &   &                   \\
    \hline
5   &   Conjecture
        &   &   &   &  \cellcolor{gray!30}
                        &   \cellcolor{gray!30}
                            &   \cellcolor{gray!30}
                                &   &   &                   \\
    \hline
6   &   Thesis Writing
        &   &   &   &   &  \cellcolor{gray!30}
                            &   \cellcolor{gray!30}
                                &   &   &                   \\
    \hline
    \end{tabularx}%
  \label{tab:addlabelkiki}%
\end{table}%
\end{document} 

相关内容