6

I'd like to use \gantttitlecalendar to generate a title with week as the smallest unit (i.e. one unit = one week). By default, each unit represents one calendar day:

\begin{ganttchart}[
  hgrid,
  vgrid,
  time slot format=isodate,
  ]{2015-09-01}{2016-04-01}
\gantttitlecalendar{year, month, week} \\
\ganttbar{Task 1}{2015-09-01}{2015-11-15} \\
\end{ganttchart}

However, for a chart spanning several months, this is ridiculously scaled:

Uncompressed

Using the compressed calendar option, I know I'm able to set each timeslot to correspond to a single month:

\begin{ganttchart}[
  hgrid,
  vgrid,
  time slot format=isodate-yearmonth,
  compressed calendar
  ]{2015-09}{2016-04}
\gantttitlecalendar{year, month} \\
\ganttbar{Task 1}{2015-09}{2015-11} \\
\end{ganttchart}

However, now I have the opposite problem. For a project that only lasts a couple of months, the produced chart is ridiculously small:

Compressed

I almost hate myself for asking - but is there any way I can have something in between these two extremes? (I.e. have a single time slot representing a single week)

1 Answer 1

6

Sorry for reviving an old question, but this is an easy fix.

You can set the width of the x units with x unit= in the options field of \begin{ganttchart}[ options ]{}{}. You can either use cm or mm.

For your example the following code:

\begin{document}
     \begin{ganttchart}[hgrid,
                        vgrid,
                        x unit=1.75cm,
                        time slot format={isodate-yearmonth},
                        compress calendar
                        ]{2015-09}{2016-04}
           \gantttitlecalendar{year, month} \\
           \ganttbar{Task 1}{2015-09}{2015-11} \\
           \ganttbar{Task 2}{2015-10}{2016-02} 
      \end{ganttchart}
\end{document}

Which produces the following: x unit width adjusted

2
  • It seems something changed between 2016 and today, as Package pgfkeys Error: I do not know the key '/pgfgantt/compress calendar' and I am going to ignore it. Perhaps you misspelled it. ]{2015-09}{2016-04} is the result I get with your code. Thereafter Dimension too large. \gantttitlecalendar{year, month} is also reported.
    – TobiBS
    Commented Jun 22, 2022 at 18:48
  • According to the manual, this option was replaced: Key compress calendar has been replaced by time slot unit to allow an additional level of compression (year).
    – TobiBS
    Commented Jun 22, 2022 at 18:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .