1

I would like to draw Gantt chart, where:

is generated by:

\documentclass{article}

\usepackage{pgfgantt}

\begin{document}

\begin{ganttchart}{1}{12}

    \gantttitle{2011}{12} \\
    \gantttitlelist{1,...,12}{1} \\

    \ganttgroup{Group 1}{1}{7} \\
    \ganttbar{Task 1}{1}{2} \\
    \ganttlinkedbar{Task 2}{3}{7} \ganttnewline
    \ganttmilestone{Milestone}{7} \ganttnewline
    \ganttbar{Final Task}{8}{12}
    \ganttlink{elem2}{elem3}
    \ganttlink{elem3}{elem4}

\end{ganttchart}

\end{document}

I would like it span all the width. So I played with \begin{ganttchart}[x unit=10mm]{1}{12} and got:

How to make pgfgantt span all i.e. \textwidth?

Using \usepackage[showframe]{geometry} to check the position helps, but is there a side effect? Looks like chart moves a bit to the top left.

enter image description here

  • One option is to create a separate file, then include the PDF as graphics with \includegraphics[width=\textwidth]{...pdf} – pushpen.paul Jan 24 at 11:52
  • I believe you meant span (not spam). Please edit your question.... – pushpen.paul Jan 24 at 11:53
  • Also, do you mean \textwidth or something else? – pushpen.paul Jan 24 at 11:57
  • 1
    It might be difficult to do it automatically, because you need to reserve some space for the labels and pgfgantt does not yet know the size of the labels when the title bar is generated. So it may be easier just to manually play around with the x unit value (for each of your charts if you have more than one). – Marijn Jan 24 at 15:24
  • 1
    If you add \usepackage[showframe]{geometry} to the preamble of your document, you will realize that you are almost there. I would like to argue that a small distance at the right end is better than overshooting. – marmot Jan 24 at 15:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.