Guide · 2026-12-05

How to Build a Gantt Chart in LaTeX: Step-by-Step Guide

Building a Gantt chart in LaTeX can feel harder than planning the project itself. One misplaced brace or confusing time scale can turn a simple schedule into a frustrating compile error.

You may also be unsure whether to draw bars manually or use a package. That uncertainty costs time, especially when dates shift and the chart needs updating.

But here's the truth: the pgfgantt package handles bars, milestones, groups, and timelines with a small amount of structured code. I’ll walk you through a working chart, explain the key commands, and show how to customize and troubleshoot it. Start with a 12-period example, then adjust the labels and styling to fit your project.

How to Make a Gantt Chart in LaTeX

The quickest route is to use pgfgantt, define your timeline, and add tasks with start and end periods. This example creates a project schedule with three phases, several tasks, and a go-live milestone.

  1. Add the package. Include \usepackage{pgfgantt} in your LaTeX preamble. If your LaTeX setup does not have the package, install it through your distribution’s package manager.

  2. Choose the timeline. The example below uses 12 numbered periods. You can treat them as weeks, months, or project stages, then label them clearly.

  3. Set chart dimensions and labels. Options such as x unit control horizontal spacing, while y unit chart adjusts row height.

  4. Add groups, tasks, and a milestone. Use \ganttgroup for phases, \ganttbar for tasks, and \ganttmilestone for key events.

  5. Compile and review. Check that labels fit, tasks fall within the timeline, and the result remains readable at its intended page size.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{pgfgantt}

\begin{document}

\begin{center}
\begin{ganttchart}[
  hgrid,
  vgrid,
  x unit=0.8cm,
  y unit chart=0.7cm,
  bar height=0.6,
  group height=0.7,
  bar label font=\small,
  group label font=\small\bfseries
]{1}{12}
  \gantttitlelist{1,...,12}{1} \\
  \ganttgroup{Planning}{1}{3} \\
  \ganttbar{Requirements}{1}{2} \\
  \ganttbar{Approval}{3}{3} \\
  \ganttgroup{Build}{4}{9} \\
  \ganttbar{Implementation}{4}{7} \\
  \ganttbar{Testing}{8}{9} \\
  \ganttgroup{Launch}{10}{12} \\
  \ganttbar{Training}{10}{11} \\
  \ganttmilestone{Go-live}{12}
\end{ganttchart}
\end{center}

\end{document}

In this example, the chart runs from period 1 through period 12. A task that starts and ends in period 3 appears as a one-period bar, while the go-live event appears as a milestone.

Choose a Timeline and Organize Tasks

Before styling the chart, decide what each time slot represents. For a class assignment, slots could be weeks; for a product launch, they might be months or numbered project stages.

Here's why: the timeline determines how readers interpret every bar. A label such as “1” is ambiguous, while a clear title row can identify the periods as weeks or months.

Match the chart range to the plan

The pair of values after the chart options defines the chart’s first and last periods. In the example, {1}{12} creates a range covering 12 periods.

For a six-week plan, use a six-period range and six corresponding labels. If tasks extend beyond the chart’s range, expand it or revise the task dates.

Break work into useful phases

Groups help readers scan the schedule. For example, a research project could use phases such as Preparation, Fieldwork, Analysis, and Presentation.

Keep task labels short enough to read beside their bars. “Review draft” is easier to scan than a long description of every review activity.

Customize the Chart’s Appearance

Start with readability rather than decoration. A chart used in a report, presentation, or printed handout needs labels that remain clear at its final size.

The best part? You can make several useful adjustments through chart options instead of redrawing the schedule. Try one change at a time, then compile and inspect the result.

Adjust spacing and grid lines

Increase x unit when period labels or bars look crowded. Reduce it when the chart is too wide for the page, but check that task labels still fit.

The hgrid and vgrid options add horizontal and vertical grid lines. They help readers compare task positions, though a dense grid can make a compact chart feel busy.

Improve labels and color

Use concise task names and adjust label fonts when text is difficult to read. You can also set colors for groups and bars through package options.

For example, assign a distinct color to a launch phase or use a different shade for completed work. Keep the meaning consistent and explain unusual colors in a nearby note.

Choose a suitable page layout

A 12-period chart with many tasks may need landscape orientation. A shorter schedule might fit comfortably on a portrait page.

If the chart remains too wide, consider dividing it into phases or reducing the horizontal unit slightly. Avoid shrinking it until the labels become hard to read.

Show Dependencies and Calendar Dates

A basic chart shows when tasks occur, but it does not automatically explain their relationships. If one task must finish before another begins, add a dependency link.

Let me explain: named chart elements give you a way to connect specific tasks. Add a name to each relevant bar, then link the names with \ganttlink.

\ganttbar[name=requirements]{Requirements}{1}{2} \\
\ganttbar[name=approval]{Approval}{3}{3} \\
\ganttlink{requirements}{approval}

The link indicates that approval follows requirements. Review the package’s link options when you need to change arrow direction or spacing around connected tasks.

Use real dates when the schedule needs them

Numbered periods work well for a conceptual plan. When readers need actual dates, configure a calendar-based time scale and label its periods with dates.

Calendar formatting takes more setup than a numbered range. Choose a period format that matches the schedule, such as daily or weekly, and test how the labels fit before adding every task.

Compile and Troubleshoot the Result

Compile the chart after adding a few tasks, not only after finishing the whole schedule. Small checks make it easier to locate a syntax problem or an awkward layout.

You might be wondering: what should you check first when the chart fails? Start with the package, braces, task boundaries, and line endings.

Common LaTeX issues to check

If the chart compiles but looks wrong, change one setting at a time. For example, adjust the horizontal spacing first, compile again, then evaluate the label size.

Project Planning Beyond a LaTeX Chart: ONES.com

LaTeX is useful when you need precise control over a chart’s appearance. For teams coordinating changing tasks, ownership, and project knowledge, ONES.com offers a separate project and knowledge management workflow.

ONES.com product screenshot

ONES.com is a unified platform for project management and knowledge management, powered by ONES Assistant. ONES Project is a Jira alternative, and ONES Wiki is a Confluence alternative. They are sold separately.

Value Proposition

If you spend more time coordinating work than typesetting a schedule, ONES.com can help organize tasks, workflows, and team knowledge in one platform. You can still create a LaTeX chart for a polished publication or a static project overview.

Core Capabilities

Application Scenarios

Software team: A team can manage sprint tasks, custom workflow stages, and progress reporting in ONES Project. It can still prepare a LaTeX Gantt chart when a proposal needs a fixed visual schedule.

Research group: A group coordinating reviews, approvals, and written guidance can use ONES Project for work tracking and ONES Wiki for knowledge management. The products are separate, so the group can choose the one that fits its needs.

Common Challenges and Practical Fixes

Most chart problems come from unclear planning decisions or small LaTeX syntax mistakes. These fixes can help you move forward without rebuilding the whole chart.

FAQs

Which LaTeX package should I use for a Gantt chart?

pgfgantt is a practical choice for charts with task bars, milestones, groups, and timeline labels. It works within a LaTeX document and offers options for spacing, grid lines, labels, and links. For a simple schedule, you can begin with a numbered timeline. If you need calendar dates or detailed styling, add those features after the basic chart compiles.

How do I show weeks or months instead of numbers?

You can label timeline slots with the periods your readers need, such as week numbers or month names. A numbered range is a simple starting point, but the labels should explain what each slot represents. For schedules tied to exact dates, configure the package’s calendar formatting and select a time scale that suits the plan. Check label spacing before adding the full task list.

Can I add dependencies between tasks?

Yes. Give tasks names in their chart commands, then connect them with \ganttlink. For example, a requirements task can link to an approval task that follows it. Dependencies make sequence visible, but too many arrows can reduce readability. Add links for relationships that affect the schedule, and review the rendered chart to see whether the arrows are clear.

nTask product screenshot

Why does my Gantt chart fail to compile?

Common causes include a missing pgfgantt package, unmatched braces, a task outside the defined period range, or a missing line break between chart commands. Read the first LaTeX error carefully and inspect the nearby command. Make one correction at a time and compile again. If compilation succeeds but the chart looks wrong, check spacing, label length, and page orientation.

Conclusion

You can build a Gantt chart in LaTeX by installing pgfgantt, defining a time range, and adding tasks, phases, and milestones. Then refine spacing, labels, dependencies, and page layout until the schedule is easy to read.

When syntax or formatting gets frustrating, return to a small working chart and add one feature at a time. That approach makes errors easier to find and keeps the schedule manageable when dates change.

LaTeX gives you detailed control over a static chart. For ongoing team coordination, a project management workflow can help track changes beyond the chart itself.