有人能帮我创建这样的表格吗?我在颜色方面遇到了问题,而且表格也不适合我的页面。我将不胜感激,谢谢!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage{colortbl}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|l|l|l|l|l|l|l|l|l|}
\hline
Activity (2021) & \multicolumn{1}{c|}{Apr} & \multicolumn{1}{c|}{May} & \multicolumn{1}{c|}{Jun} & \multicolumn{1}{c|}{Jul} & \multicolumn{1}{c|}{Aug} & \multicolumn{1}{c|}{Sep} & \multicolumn{1}{c|}{Oct} & \multicolumn{1}{c|}{Nov} & \multicolumn{1}{c|}{Dec} \\
\hline
Create research proposal & {\cellcolor[rgb]{0.616,0.565,0.894}} & & & & & & & & \\
\hline
\textcolor[rgb]{0.2,0.2,0.2}{Create questions}\textcolor[rgb]{0.2,0.2,0.2}{ for interviews} & & {\cellcolor[rgb]{0.616,0.565,0.894}} & & & & & & & \\
\hline
\begin{tabular}[c]{@{}c@{}}Schedule interviews and \\conduct them\end{tabular} & & {\cellcolor[rgb]{0.616,0.565,0.894}} & {\cellcolor[rgb]{0.616,0.565,0.894}} & \multicolumn{1}{c|}{} & & & & & \\
\hline
\textcolor[rgb]{0.2,0.2,0.2}{Obtain relevant }\textcolor[rgb]{0.2,0.2,0.2}{financial information} & & & {\cellcolor[rgb]{0.616,0.565,0.894}} & & & & & & \\
\hline
\textcolor[rgb]{0.2,0.2,0.2}{Create and send surveys to}\textcolor[rgb]{0.2,0.2,0.2}{third-party logistics providers} & & & {\cellcolor[rgb]{0.616,0.565,0.894}} & & & & & & \\
\hline
Create outline & & & & {\cellcolor[rgb]{0.616,0.565,0.894}} & & & & & \\
\hline
Write first draft & & & & {\cellcolor[rgb]{0.616,0.565,0.894}} & {\cellcolor[rgb]{0.616,0.565,0.894}} & {\cellcolor[rgb]{0.616,0.565,0.894}} & & & \\
\hline
Submission of first draft & & & & & & {\cellcolor[rgb]{0.616,0.565,0.894}} & & & \\
\hline
Write final draft using feedback & & & & & & & {\cellcolor[rgb]{0.616,0.565,0.894}} & {\cellcolor[rgb]{0.616,0.565,0.894}} & {\cellcolor[rgb]{0.616,0.565,0.894}} \\
\hline
\end{tabular}
\end{table}
\end{document}
答案1
以下是另一种使用方法pgfgantt
:
\documentclass[a4paper, 12pt]{article}
\usepackage{pgfgantt}
\definecolor{myblue}{rgb}{0.616,0.565,0.894}
\begin{document}
\noindent
\begin{ganttchart}[
y unit title=0.75cm,
x unit =0.8cm,
vgrid,hgrid,
title height=1,
title/.style={fill=none},
title label font=\footnotesize,
bar/.style={fill=myblue},
bar height=1,
bar top shift=0,
progress label text={},
group right shift=0,
group height=.6,
group peaks width={0.2},
bar label node/.style={text width=6cm,
align=left,
anchor=east,
font=\small}
]{1}{9}
\gantttitle{Apr}{1} \gantttitle{May}{1} \gantttitle{Jun}{1}
\gantttitle{Jul}{1} \gantttitle{Aug}{1} \gantttitle{Sep}{1}
\gantttitle{Oct}{1} \gantttitle{Nov}{1} \gantttitle{Dec}{1}\\
\ganttbar{1. Create research proposal}
{1}{1}\\
\ganttbar{2. Create questions}
{2}{2}\\
\ganttbar{3. Schedule interviews and conduct them}
{2}{3} \\
\ganttbar{4. Obtain relevant financial information}
{3}{3}\\
\ganttbar{5. Create and send surveys to third-party logistics providers}
{3}{3}\\
\ganttbar{6. Create outline}
{4}{4}\\
\ganttbar{7. Write first draft}
{4}{6} \\
\ganttbar{8. Submission of first draft}
{6}{6}\\
\ganttbar{9. Write final draft using feedback}
{7}{9}
\end{ganttchart}
\end{document}
答案2
这里有一个使用 latex-tables.com 的简单示例。
\documentclass{article}
\usepackage{colortbl}
\begin{document}
\begin{table}
\centering
\begin{tabular}{|c|c|c|c|c|c|}
\hline
& A & C & D & F & G \\
\hline
a & & {\cellcolor[rgb]{0.435,0.827,0.82}} dsgsdgs& & & \\
\hline
b & & & {\cellcolor[rgb]{1,0.647,0}}dsgsdgs & & \\
\hline
c & & & & {\cellcolor[rgb]{0,0.502,0.502}}shyshr & \\
\hline
d & & & & & {\cellcolor{magenta}} adgag \\
\hline
\end{tabular}
\end{table}
\end{document}
答案3
正如我在评论中提到的,您可以使用来nicematrix
制作这样的表格。
\documentclass{article}
\usepackage{geometry}
\usepackage[table]{xcolor}
\usepackage{nicematrix}
\begin{document}
\begin{table}
\centering
\begin{NiceTabular}{p{4cm}*{9}{p{0.75cm}}}[hvlines]
\CodeBefore
\rowcolor[rgb]{1.0, 1.0, 0.8}{1}
\cellcolor[rgb]{0.8, 0.8, 1.0}{2-2, 3-3, 4-3, 4-4, 5-4, 6-5, 7-5,7-6, 7-7, 8-7, 9-8, 9-9, 9-10, 10-10}
\Body
Activity(2021) & Apr & May & June & July & Aug & Sep & Oct & Nov & Dec \\
Create research proposal & & & & & & & & &\\
Create questions & & & & & & & & &\\
Schedule interviews and conduct them & & & & & & & & &\\
Obtain relevant financial information & & & & & & & & &\\
Create and send surveys to third-party logistics providers & & & & & & & & &\\
Create outline & & & & & & & & &\\
Write first draft & & & & & & & & &\\
Submission of first draft & & & & & & & & &\\
Write final draft using feedback & & & & & & & & &\\
\end{NiceTabular}
\end{table}
\end{document}
这个表看起来不太好。您可以考虑减少使用的水平线和垂直线的数量。
更好的方法是去除所有垂直线和大部分水平线。
\documentclass{article}
\usepackage{geometry}
\usepackage[table]{xcolor}
\usepackage{nicematrix}
\usepackage{booktabs}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} % both vertically and horizontally centered column
\begin{document}
\begin{table}
\centering
\begin{NiceTabular}{m{4cm}*{9}{C{0.75cm}}}
\CodeBefore
\rowcolor[rgb]{1.0, 1.0, 0.8}{1}
\cellcolor[rgb]{0.8, 0.8, 1.0}{2-2, 3-3, 4-3, 4-4, 5-4, 6-5, 7-5,7-6, 7-7, 8-7, 9-8, 9-9, 9-10, 10-10}
\Body
\toprule
Activity(2021) & Apr & May & June & July & Aug & Sep & Oct & Nov & Dec \\\midrule
Create research proposal & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{2-3}
Create questions & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{3-4}
Schedule interviews and conduct them & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{3-4}
Obtain relevant financial information & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{4-5}
Create and send surveys to third-party logistics providers & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{5-7}
Create outline & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{5-7}
Write first draft & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{7-10}
Submission of first draft & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\cmidrule{8-10}
Write final draft using feedback & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15 & 15\\\bottomrule
\end{NiceTabular}
\end{table}
\end{document}
月份列中的条目用于获得更好的视觉效果。