1

Duplicate of:
How to exclude or remove weekends from ganttchart

I'm looking to create a Gantt chart using pgfgantt that only displays certain days of the week, specifically excluding weekends or Sundays. The closest thing I've found (see full code at bottom) is now four years old and refuses to compile with errors that are completely opaque to me.

1 Answer 1

2

The answer in the other question uses the key compress calendar. However, since version 5.0 of the pgfgantt package this key has been changed into time slot unit. See the manual for version 5.0 (page 101-102):

Change History

[...]

v5.0

[...]

Key compress calendar has been replaced by time slot unit to allow an additional level of compression (year).

This new key has three values: day (no compression, default), month (don't show days but only months and years) and year (don't show months but only years and possibly decades). The value day corresponds to the old compress calendar=false, month is compress calendar=true, and year did not exist in version 4.0.

The code from the previous question only accounts for the first two key values, so if you want to use that code with minimal changes then you cannot use time slot unit=year. For the two other option values the fix is quite straightforward: change every occurrence of \ifgtt@compresscalendar by \ifgtt@timeslotunit@month (there are four occurrences in total). Note that the final two occurrences (line 203 and 217) have a 1 at the end, so they should be replaced by \ifgtt@timeslotunit@month1.

Result:

enter image description here

6
  • I assume that you will make comment to this answer in the answer to te other question.
    – albert
    Commented Dec 31, 2020 at 17:34
  • Marvellous, thanks a bunch Commented Jan 1, 2021 at 1:06
  • @Marijin Could you 1. link my post and 2. copy the code from my post with your changes applied to it? Commented Jan 1, 2021 at 1:17
  • Oh I see my code is really long... Commented Jan 1, 2021 at 1:18
  • 1
    @HoodChatham indeed because it was long and my changes are very minor I thought it would be more concise not to copy the whole 360 lines - hopefully my post is clear enough to allow the OP and other interested readers to apply the fix.
    – Marijn
    Commented Jan 1, 2021 at 9:27

You must log in to answer this question.

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