8

I recently updated my pgfgantt package, and can't figure out how to update one of my charts to draw properly under the new package. The chart has a two-tiered title, years over months. It also had a quarterly vertical grid. It's the quarterly vertical grid I'm having issues recreating.

My old working code was

\begin{tikzpicture}[x=.5cm, y=1cm]
  \begin{ganttchart}%
      [today=5.5, vgrid, vgrid lines list={4,7,...,\value{gtt@width}}]{19}
    \gantttitle{2012}{12} \gantttitle{2013}{7} \\
    \gantttitlelist{1,...,12}{1}\gantttitlelist{1,...,7}{1} \\
    \ganttgroup{Prospectus}{1}{7} \\
    %% more gantt items omitted
  \end{ganttchart}
\end{tikzpicture}

Following the examples in the package documentation I can create a dotted vertical grid for every other month, but not for every third month.

every other month:

\begin{tikzpicture}[x=.5cm, y=1cm]
  \begin{ganttchart}%
  [today=5.5, vgrid={draw=none, dotted}]{19}
    \gantttitle{2012}{12} \gantttitle{2013}{7} \\
    \gantttitlelist{1,...,12}{1}\gantttitlelist{1,...,7}{1} \\
    \ganttgroup{Prospectus}{1}{7} \\
  \end{ganttchart}
\end{tikzpicture}

but vgrid={draw=none, none, dotted} gives the error

ERROR: Package pgfkeys Error: I do not know the key '/tikz/none' and I am going to ignore it. Perhaps you misspelled it.

and vgrid={draw=*2{none}, dotted} gives the error

ERROR: Package xcolor Error: Undefined color `*2{none}'.

How can I get two skips followed by a dotted line?

  • What version are you running? Am I right in thinking that v3.0 is the most recent? – oLas May 6 '13 at 21:38
8

The problem is with your syntax for the vgrid style list.

From PGF Gantt Documentation: A style list item has the general syntax *{<n>}{<style>}. You are correct in using the additional draw = none for no style on the vgrid but it should be contained within the style argument {<style>}.

So rather than vgrid={draw=*2{none}, dotted}

You should use vgrid={*2{draw=none}, dotted} This would produce the following output:

enter image description here

| improve this answer | |
  • 1
    Sounds like an update to the package documentation is in order, because I lifted the vgrid={draw=none, dotted} directly from the doc, but it now appears that this is only half right. In fact, I'm not even sure why it works! Thanks. – mac May 7 '13 at 14:59
  • 1
    @mac {draw=none, dotted} would work, just not {draw=none, none, dotted} you should use {draw=none, draw=none, dotted}. Hope that helps – oLas May 7 '13 at 16:33
  • With vgrid={*2{draw=none}, dotted} you get problems, if you replace 2 with two digit values. So you better use vgrid={*{12}{draw=none}, dotted}. – knut Mar 3 '18 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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