TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to input the current date taken from "datetime" into the "pgfgantt" package to update the date bar automatically at compilation.

The date seems to be in the correct format, however when input to pgfgantt, it throws an error:

! Use of \\ganttchart doesn't match its definition.
\new@ifnextchar ...served@d = #1\def \reserved@a {
                                                  #2}\def \reserved@b {#3}\f...
l.23 ]{2014-06-01}{2014-07-30}

Working code is here (replace "today=2014-06-02" with "today=\dashdate\today" to reproduce error):

\documentclass[a4paper,10pt]{report}

\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage{pgfgantt}
\usepackage{pgfcalendar}
\usepackage{ifthen}
\usepackage{datetime}

\newdateformat{dashdate}{\THEYEAR-\twodigit{\THEMONTH}-\twodigit{\THEDAY}}
%\dashdate\today

\begin{document}
\begin{preview}

\begin{ganttchart}[x unit=.3cm, hgrid,vgrid={dotted},time slot format=isodate,
today=
2014-06-02, %replace "2014-06-02" with "\dashdate\today" to reproduce error
today offset=.5,
today label=Current Date,
today label node/.append style={anchor=north west},
today label font=\itshape\color{red},today rule/.style={draw=blue, ultra thick}
]{2014-06-01}{2014-07-30}
\gantttitlecalendar{year, month=name, week} \\
\ganttbar{Task-1.1}{2014-06-01}{2014-06-03} \\
\ganttbar{Task-1.2}{2014-06-03}{2014-06-06} \\
\ganttmilestone{Milestone 1}{2014-06-06} 

\end{ganttchart}
\end{preview}
\end{document}

Any ideas how I can make this work?

share|improve this question
    
Hm, I get: ERROR: Package pgfkeys Error: I do not know the key '/pgfgantt/time slot format' and I am going to ignore it. Perhaps you misspelled it. – John Wickerson Jun 2 '14 at 13:07
1  
Use today=\the\year-\the\month-\the\day, – Ulrike Fischer Jun 2 '14 at 13:13
    
Thanks Ulrike it works now! – mikesapi Jun 2 '14 at 13:20

You can use today=\the\year-\the\month-\the\day.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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