我需要一个在 LaTeX 中绘制甘特图的软件包,主要标准就是:易于使用。我花了太多时间到处学习“软件包”,这个只需要完成一个简单的工作。我可能有兴趣知道哪些“更好”以供以后参考,如果你愿意的话可以把它们包括进去,但现在……快速而粗暴才是黄金。
答案1
像 Claudio 一样,我建议你使用pgfGantt
包,我发现它非常简单,并且其文档非常清晰。
这是一个 MWE,带有自定义标签、进度条和关系:
\documentclass{article}
\usepackage{pgfgantt}
\begin{document}
\begin{figure}[tbp]
\begin{center}
\begin{ganttchart}[y unit title=0.4cm,
y unit chart=0.5cm,
vgrid,hgrid,
title label anchor/.style={below=-1.6ex},
title left shift=.05,
title right shift=-.05,
title height=1,
progress label text={},
bar height=0.7,
group right shift=0,
group top shift=.6,
group height=.3]{1}{24}
%labels
\gantttitle{Week}{24} \\
\gantttitle{Monday}{4}
\gantttitle{Tuesday}{4}
\gantttitle{Wednesday}{4}
\gantttitle{Thursday}{4}
\gantttitle{Friday}{4}
\gantttitle{Saturday}{4} \\
%tasks
\ganttbar{first task}{1}{2} \\
\ganttbar{task 2}{3}{8} \\
\ganttbar{task 3}{9}{10} \\
\ganttbar{task 4}{11}{15} \\
\ganttbar[progress=33]{task 5}{20}{22} \\
\ganttbar{task 6}{18}{19} \\
\ganttbar{task 7}{16}{18} \\
\ganttbar[progress=0]{task 8}{21}{24}
%relations
\ganttlink{elem0}{elem1}
\ganttlink{elem0}{elem3}
\ganttlink{elem1}{elem2}
\ganttlink{elem3}{elem4}
\ganttlink{elem1}{elem5}
\ganttlink{elem3}{elem5}
\ganttlink{elem2}{elem6}
\ganttlink{elem3}{elem6}
\ganttlink{elem5}{elem7}
\end{ganttchart}
\end{center}
\caption{Gantt Chart}
\end{figure}
\end{document}