I am using \gantttitlecalendar
to generate my title block that consists of months and weeks.
The default behaviour of vgrid
is to take each unit as a day, or if compress calendar
is true, each unit is taken as a month.
I would like to have vertical grid lines to demarcate each week.
This is what I currently have
% Minimal
\documentclass{article}
\usepackage{pgfgantt}
\begin{document}
\ganttset{calendar week text= \small {\startday/\startmonth}}
\begin{ganttchart}[
hgrid,x unit=1.5mm,
hgrid style/.style={draw=black!5, line width=.75pt},
vgrid,
time slot format=little-endian]{22-09-2014}{30-11-2014}
\gantttitlecalendar{ month=shortname,week=4} \\
\ganttgroup{Group A}{22-09-14}{28-11-14}\\
\ganttbar{Task A}{22-09-14}{10-11-14}
\end{ganttchart}
\end{document}
Which gives me
How would one adjust the vgrid
for weeks?
Best Answer
You can use a
<style list>
value for thevgrid
key to draw a grid line only once per week, like this:The
<style list>
is cycled through as we move left to right through the Gantt chart, and the*{<num>}{<style>}
works just like intabular
preambles for repeating elements. So the line of code above makes the first 6 grid lines with styledraw=none
(so not visible at all) and the seventh isdotted
style. This repeats, so it achieves the goal of one grid line per week.Here's the full code and output:
I assumed you wanted the grid line to correspond to the week markers in the title block section, but if you want the line on a different day of the week, you can adjust the
<style list>
to include the required offset.