1

I want the pgfgantt chart to automatically update the "today" line so that it always shows \today when compiled.

The problem is that though I am using time slot format=isodate and have set the document date format to \yyyymmdddate from the datetime package with the date separator '-'. If I put \today in the text the date is shown as expected but when I set today=\today or {\today} in the pgfgantt environment:

\documentclass[paper=a4]{article}
\usepackage{pgfgantt}
\usepackage{datetime}
\renewcommand{\dateseparator}{-}
\begin{document}
\yyyymmdddate
\today
\begin{ganttchart}[
vgrid={*{6}{draw=none}, dotted},
x unit=.5cm,
y unit title=.6cm,
y unit chart=.6cm,
time slot format=isodate,
time slot format/start date=2015-03-02,
today=\today ,
today offset=.5]{2015-03-02}{2015-03-22}
\ganttset{bar height=.6}
\gantttitlecalendar{year, month=name, week, day} \\
\ganttbar[bar/.append style={fill=blue}]{Goal Document}{2015-03-02}{2015-03-20}\\
\end{ganttchart}
\end{document}

I get the errors:

! Missing number, treated as zero.<to be read again>\protect l.19 today offset=.5]{2015-03-02}{2015-03-22}
! Dimension too large.<to be read again>\relax l.27 \end{ganttchart}
! Dimension too large.<recently read> \pgfmath@x l.27 \end{ganttchart}
! Dimension too large.<argument> \pgf@x l.27 \end{ganttchart}
! Dimension too large.<recently read> \pgf@x l.27 \end{ganttchart}
! Dimension too large.\pgfusepath ...@x by.5\pgflinewidth \ifdim \pgf@x>\pgf@picmaxx \global \pgf... l.27 \end{ganttchart}
! Dimension too large.\pgfsys@typesetpicturebox ... \wd #1=\pgf@picmaxx\dp #1=0pt\leavevmode \pgf... l.27 \end{ganttchart}

Any ideas?

  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Mar 6 '15 at 12:31
  • Instead of today=\today use today={\the\year-\the\month-\the\day} – Gonzalo Medina Mar 6 '15 at 13:12
3

Instead of today=\today use today={\the\year-\the\month-\the\day}. A complete example:

\documentclass{article} 
\usepackage{pgfgantt} 
\usepackage{datetime} 

\renewcommand{\dateseparator}{-} 

\begin{document} 
\yyyymmdddate \today 

\begin{ganttchart}[ 
  vgrid={*{6}{draw=none}, dotted}, 
  x unit=.5cm, 
  y unit title=.6cm, 
  y unit chart=.6cm, 
  time slot format=isodate, 
  time slot format/start date=2015-03-02, 
  today={\the\year-\the\month-\the\day}, 
  today offset=.5
  ]{2015-03-02}{2015-03-22} 
\ganttset{bar height=.6} 
\gantttitlecalendar{year, month=name, week, day} \\ \ganttbar[bar/.append style={fill=blue}]{Goal Document}{2015-03-02}{2015-03-20}\\ 
\end{ganttchart} 

\end{document} 

enter image description here

  • Thank you very much. I don't know why I didn't try that. – Kajsa Mar 6 '15 at 13:31

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.