2

I would like to define e.g. a 3 years study plane, but it shows me only 1 year in pdf, where is the error in the following code:

\documentclass{article}       
\usepackage{etoolbox}
\usepackage{parskip}
\usepackage{tikz}
\usepackage{pgfgantt}
\usepackage{ifthen}
\newcounter{myWeekNum}
\stepcounter{myWeekNum}

\begin{document}
    \newcommand{\myWeek}{\themyWeekNum
        \stepcounter{myWeekNum}
        \ifnum\themyWeekNum=53
        \setcounter{myWeekNum}{2}
        \else\fi
    }
    %
    %%% Begin document

        \setcounter{myWeekNum}{1}
        \ganttset{%
            calendar week text={\myWeek{}}%
        }
        %
        \begin{figure}[h!bt]
            \begin{center}
                \begin{ganttchart}[
                    vgrid={*{6}{draw=none}, dotted},
                    x unit=.08cm,
                    y unit title=.6cm,
                    y unit chart=.6cm,
                    time slot format=isodate,
                    time slot format/start date=2019-6-01]{2021-12-01}{2022-04-30}
                    \ganttset{bar height=1.6}
                    \gantttitlecalendar{year, month=name} \\
                    \ganttbar[bar/.append style={fill=blue}]{Task 1}{2019-6-01}{2021-12-01}\\
                    \ganttbar[bar/.append style={fill=blue}]{Task 2}{2019-6-01}{2021-12-01}\\
                    \ganttbar[bar/.append style={fill=blue}]{Task 3}{2019-6-01}{2021-12-01}\\
                    \ganttbar[bar/.append style={fill=red}]{Task 4}{2021-12-01}{2022-04-19}
                \end{ganttchart}
            \end{center}
                \caption{Time Plan}
            \end{figure}
    \end{document}

Thanks in advance.

  • 2
    Welcome to TeX SX! Please post a full compilable code, not just a snippet. – Bernard Nov 15 '18 at 20:09
  • @Bernard, it's not snipping JPG, I have checked, it works in latex. – acsdaswe Nov 15 '18 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.