The pgfgantt package
Draws Gantt charts for project plans: \ganttbar, \ganttgroup and \ganttmilestone inside a ganttchart environment.
Loading the package
\usepackage{pgfgantt}The two arguments of \begin{ganttchart}{1}{12} are the first and the last time slot. Each element takes a label, a start slot and an end slot. \\ moves to the next row; without it, the next element is drawn in the same row.
Time slots are numbers by default. With the option time slot format=isodate they are dates such as 2026-01-05, and \gantttitlecalendar prints years, months or weeks as the title rows. The package draws with tikz.
Main commands
\begin{ganttchart}[hgrid, vgrid]{1}{12} | Chart with 12 time slots and grid lines in both directions. |
\gantttitle{Project plan}{12} | Title cell that spans 12 slots. |
\gantttitlelist{1,...,12}{1} | Row of title cells, one slot wide each. |
\ganttbar{Literature}{1}{3} | Task from slot 1 to slot 3. |
\ganttlinkedbar{Experiments}{4}{8} | Task with an arrow from the element before it. |
\ganttgroup{Thesis}{1}{12} | Bracket above a group of tasks. |
\ganttmilestone{Submission}{12} | Diamond that marks a milestone at slot 12. |
\ganttbar[progress=40]{Writing}{7}{11} | Fills 40 % of the bar and prints "40% complete" next to it. |
Complete example
\documentclass{article}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[hgrid, vgrid, x unit=0.7cm]{1}{12}
\gantttitle{Project plan (weeks)}{12} \\
\gantttitlelist{1,...,12}{1} \\
\ganttgroup{Thesis}{1}{12} \\
\ganttbar{Literature}{1}{3} \\
\ganttlinkedbar{Experiments}{4}{8} \\
\ganttbar[progress=40]{Writing}{7}{11} \\
\ganttmilestone{Submission}{12}
\end{ganttchart}
\end{document}Compiled with pdfLaTeX from TeX Live 2023.
Pitfalls
- The width of the chart is the number of slots times
x unitplus the label column. A chart with many slots runs past the right margin; reducex unit, for examplex unit=2mmfor a chart with one slot per day. - To connect two elements that do not follow each other, give them names with
name=and write\ganttlink{a}{b}. Elements without a name are calledelem0,elem1and so on.
Related pages
- Package
tikz - How-to Draw with TikZ in LaTeX
- How-to Set up a thesis in LaTeX