答案1
这不是什么简单的事;需要掌握一些技巧。
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedright\vrule height4ex width 0pt}p{#1}<{\vrule depth 2.5ex width 0pt}}
\begin{document}
\begin{tabular}{|P{4cm}*{10}{|c}|}
\hline
\centering \raisebox{-2ex}[0pt][0pt]{Action plan} & \multicolumn{7}{c|}{2020} & \multicolumn{3}{c|}{2021} \\
\cline{2-11}
\multicolumn{1}{|c|}{\vphantom{$\Big|$}} &
\scriptsize Jun & \scriptsize Jul & \scriptsize Aug & \scriptsize Sep &
\scriptsize Oct & \scriptsize Nov & \scriptsize Dec & \scriptsize Jan &
\scriptsize Feb & \scriptsize Mar \\
\hline
1. Study the theoretical background and review existing literature &
\multicolumn{2}{c}{\cellcolor{gray}} &&&&&&&& \\
\hline
2. Synthesis monoclinic VO\textsubscript{2} nanoparticle and prepare the thermocromic film &
&& \multicolumn{3}{c}{\cellcolor{gray}} &&&&& \\
\hline
3. Determine the optical properties of the VO\textsubscript{2} thin film &
&&&& \multicolumn{3}{c}{\cellcolor{gray}} &&& \\
\hline
4. Analysis of the experimental results &
&&&&&& \multicolumn{3}{c}{\cellcolor{gray}} & \\
\hline
5. Prepare the report and presentation &
&&&&& \multicolumn{5}{c}{\cellcolor{gray}} \\
\hline
\end{tabular}
\end{document}
答案2
以下是使用nicematrix
或 的一些替代方案pgfgantt
:
\documentclass{article}
\usepackage{chemformula}
\usepackage{nicematrix}
\usepackage{pgfgantt}
\begin{document}
{\setlength{\tabcolsep}{4.5pt}
\begin{NiceTabular}{>{\raggedright\arraybackslash}p{3cm}*{10}{c}}[hvlines]
\Block{2-1}{Action plan} & \Block{1-7}{2020} &&&&&&& \Block{1-3}{2021} \\
& \scriptsize Jun & \scriptsize Jul & \scriptsize Aug & \scriptsize Sep &
\scriptsize Oct & \scriptsize Nov & \scriptsize Dec & \scriptsize Jan &
\scriptsize Feb & \scriptsize Mar \\
1. Study the theoretical background and review existing literature &
\Block[fill=gray]{1-2}{} \\
2. Synthesis monoclinic \ch{VO2} nanoparticle and prepare the thermocromic film &
&& \Block[fill=gray]{1-3}{} \\
3. Determine the optical properties of the \ch{VO2} thin film &
&&&& \Block[fill=gray]{1-3}{} \\
4. Analysis of the experimental results &
&&&&&& \Block[fill=gray]{1-3}{} \\
5. Prepare the report and presentation &
&&&&& \Block[fill=gray]{1-5}{} \\
\end{NiceTabular}}
\begin{ganttchart}[
y unit title=0.5cm,
y unit chart=1.75cm,
x unit =0.75cm,
vgrid,hgrid,
title height=1,
title/.style={fill=none},
title label font=\footnotesize,
bar/.style={fill=gray},
bar height=1,
bar top shift=0,
progress label text={},
group right shift=0,
group height=.6,
group peaks width={0.2},
inline,
bar label node/.style={text width=3.5cm,
align=right,
anchor=east,
font=\small}
]{1}{10}
\gantttitle{2020}{7}
\gantttitle{2021}{2} \\
\gantttitle{Jun}{1} \gantttitle{Jul}{1} \gantttitle{Aug}{1} \gantttitle{Sep}{1}
\gantttitle{Oct}{1} \gantttitle{Nov}{1} \gantttitle{Dec}{1}
\gantttitle{Jan}{1} \gantttitle{Feb}{1} \gantttitle{Mar}{1}\\
\ganttbar[progress=100,inline=false]
{1. Study the theoretical background and review existing literature}
{1}{2}\\
\ganttbar[progress=100,inline=false]
{2. Synthesis monoclinic \ch{VO2} nanoparticle and prepare the thermocromic film}
{3}{5}\\
\ganttbar[progress=100,inline=false]
{3. Determine the optical properties of the \ch{VO2} thin film}
{5}{7} \\
\ganttbar[progress=100,inline=false]
{4. Analysis of the experimental results}
{8}{9}\\
\ganttbar[progress=100,inline=false]
{5. Prepare the report and presentation}
{6}{10}
\end{ganttchart}
\end{document}