答案1
如果您愿意,只需使用tabular
或。tabularx
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\begin{document}
\begin{tabularx}{\textwidth}{|l*{3}{|>{\raggedright\arraybackslash}X}|}\hline
& Alice & Bob & Chris \\\hline
October & \multicolumn{2}{c|}{Read books} & Start Programing \\\hline
November & \multicolumn{3}{c|}{\cellcolor{green}Holidays}\\\hline
December & Read a book & Write a chapter & Programing\\\hline
\end{tabularx}
\end{document}
也可以使用以下方式加入列multirow
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{multirow}
\begin{document}
\begin{tabularx}{\textwidth}{|l*{3}{|>{\raggedright\arraybackslash}X}|}\hline
& Alice & Bob & Chris \\\hline
October & \multicolumn{2}{c|}{Read books} & Start Programing \\\hline
November & \multicolumn{3}{c|}{\cellcolor{green}Holidays}\\\hline
December & \cellcolor{red} & Write a chapter & Programing\\\cline{1-1}
January & \multirow{-2}{*}{\cellcolor{red}Read a book} & Write a chapter & Programing\\\hline
\end{tabularx}
\end{document}
您也可以将多行和多列进行组合。
\documentclass{article}
\usepackage[table]{xcolor}
\usepackage{tabularx}
\usepackage{multirow}
\begin{document}
\begin{tabularx}{\textwidth}{|l*{3}{|>{\raggedright\arraybackslash}X}|}\hline
& Alice & Bob & Chris \\\hline
October & \multicolumn{2}{c|}{Read books} & Start Programing \\\hline
November & \multicolumn{3}{c|}{\cellcolor{green}Holidays}\\\hline
December & \multicolumn{2}{c|}{\cellcolor{red}} & Programing\\\cline{1-1}
January & \multicolumn{2}{c|}{\multirow{-2}{*}{\cellcolor{red}Read a book}} & Programing\\\hline
\end{tabularx}
\end{document}