TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using pgfgantt within MikTeX (both latest version) running fine.
In my gantt diagramm I have three title-lines: First year, than month and beneath the project month.
I'd like to place the text project month in the last title line just aligned like the titles produced by ganttbar.

For better understanding here is a mwe (okay, the progress issues could further be removed)

\documentclass{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{ganttchart}[vgrid={draw=none,dotted,draw=none},%
                today=15,%
                today offset=.5,%
                today label=Heute,%
                progress=today,%
                bar incomplete/.append style={fill=red},%
                progress label text={\quad\pgfmathprintnumber[precision=0,verbatim]{#1}\%}%
                ]{1}{36}
\gantttitlecalendar*[compress calendar,time slot format=isodate]{2012-5-1}{2015-4-30}{year, month} \\
\gantttitlelist{1,...,36}{1}\\
\ganttbar{Arbeitspaket 1}{1}{4}\\
\ganttbar{Arbeitspaket 2}{3}{24}\\
\ganttbar{Arbeitspaket 3}{17}{36}\\
\end{ganttchart}
\end{document}

and the corresponding result:

typesetted mwe

share|improve this question
up vote 1 down vote accepted

Strange that this hasn't been answered before. I suppose you're done with that project by now, but perhaps you, or someone else, is interested in a solution anyways.

I'm not very familiar with pgfgantt, so this solution, while it does work, is not very elegant. Three modifications has been made to your code:

  • Add a tikzpicture environment around the pgfgantt environment.
  • Give the canvas a node name with canvas/.append style={name=mycanvas} added to the chart options.
  • Place a new node with the text project month relative to the top left corner of the canvas node. This requires some trial and error to find an appropriate value.

enter image description here

\documentclass{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{tikzpicture}
\begin{ganttchart}[vgrid={draw=none,dotted,draw=none},%
                today=15,%
                today offset=.5,%
                today label=Heute,%
                progress=today,%
                bar incomplete/.append style={fill=red},%
                progress label text={\quad\pgfmathprintnumber[precision=0,verbatim]{#1}\%},
                canvas/.append style={name=mycanvas}
                ]{1}{36}
\gantttitlecalendar*[compress calendar,time slot format=isodate]{2012-5-1}{2015-4-30}{year, month} \\
\gantttitlelist{1,...,36}{1}\\
\ganttbar{Arbeitspaket 1}{1}{4}\\
\ganttbar{Arbeitspaket 2}{3}{24}\\
\ganttbar{Arbeitspaket 3}{17}{36}\\
\end{ganttchart}
\node [left] at ([yshift=-2.3cm]mycanvas.north west) {Project month};
\end{tikzpicture}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.