4

I tried the example given here.

\documentclass{article}
\usepackage{pgfgantt}

\begin{document}

\begin{figure}[ftbp]
\begin{center}

\begin{ganttchart}[y unit title=0.4cm,
y unit chart=0.5cm,
vgrid,hgrid, 
title label anchor/.style={below=-1.6ex},
title left shift=.05,
title right shift=-.05,
title height=1,
bar/.style={fill=gray!50},
incomplete/.style={fill=white},
progress label text={},
bar height=0.7,
group right shift=0,
group top shift=.6,
group height=.3,
group peaks={}{}{.2}]{24}
%labels
\gantttitle{Week}{24} \\
\gantttitle{Monday}{4} 
\gantttitle{Tuesday}{4} 
\gantttitle{Wednesday}{4} 
\gantttitle{Thursday}{4} 
\gantttitle{Friday}{4} 
\gantttitle{Saturday}{4} \\
%tasks
\ganttbar{first task}{1}{2} \\
\ganttbar{task 2}{3}{8} \\
\ganttbar{task 3}{9}{10} \\
\ganttbar{task 4}{11}{15} \\
\ganttbar[progress=33]{task 5}{20}{22} \\
\ganttbar{task 6}{18}{19} \\
\ganttbar{task 7}{16}{18} \\
\ganttbar[progress=0]{task 8}{21}{24}

%relations 
\ganttlink{elem0}{elem1} 
\ganttlink{elem0}{elem3} 
\ganttlink{elem1}{elem2} 
\ganttlink{elem3}{elem4} 
\ganttlink{elem1}{elem5} 
\ganttlink{elem3}{elem5} 
\ganttlink{elem2}{elem6} 
\ganttlink{elem3}{elem6} 
\ganttlink{elem5}{elem7} 
\end{ganttchart}
\end{center}
\caption{Gantt Chart}
\end{figure}

\end{document}

I probably forgot to install a package but Tex Live shows that pgfgantt is installed. I get a lot of errors. The first two are:

! LaTeX Error: Unknown float option `f'.
! Package pgfkeys Error: I do not know the key '/pgfgantt/group peaks', to whic h you passed '{}{}{.2}', and I am going to ignore it. Perhaps you misspelled it . See the pgfkeys package documentation for explanation. Type H <return> for immediate help.... \gantttitle

Could you help me? Thanks in advance.

1 Answer 1

8
  • There is no option f for the environment float, remove it.

  • The example you are trying uses an old version of pgfgantt. For the current version, 5.0, you have to change three things.

    • Remove group peaks={}{}{.2} from the options of ganttchart.
    • Replace the parameter {24} of the ganttchart environment by {1}{24}.
    • The key incomplete changed to bar incomplete. In the example below, I removed the key, as the current default settings might be what you want anyway.

enter image description here

\documentclass{article}
\usepackage{pgfgantt}

\begin{document}

\begin{figure}[tbp]
\begin{center}

\begin{ganttchart}[y unit title=0.4cm,
y unit chart=0.5cm,
vgrid,hgrid, 
title label anchor/.style={below=-1.6ex},
title left shift=.05,
title right shift=-.05,
title height=1,
progress label text={},
bar height=0.7,
group right shift=0,
group top shift=.6,
group height=.3]{1}{24}
%labels
\gantttitle{Week}{24} \\
\gantttitle{Monday}{4} 
\gantttitle{Tuesday}{4} 
\gantttitle{Wednesday}{4} 
\gantttitle{Thursday}{4} 
\gantttitle{Friday}{4} 
\gantttitle{Saturday}{4} \\
%tasks
\ganttbar{first task}{1}{2} \\
\ganttbar{task 2}{3}{8} \\
\ganttbar{task 3}{9}{10} \\
\ganttbar{task 4}{11}{15} \\
\ganttbar[progress=33]{task 5}{20}{22} \\
\ganttbar{task 6}{18}{19} \\
\ganttbar{task 7}{16}{18} \\
\ganttbar[progress=0]{task 8}{21}{24}

%relations 
\ganttlink{elem0}{elem1} 
\ganttlink{elem0}{elem3} 
\ganttlink{elem1}{elem2} 
\ganttlink{elem3}{elem4} 
\ganttlink{elem1}{elem5} 
\ganttlink{elem3}{elem5} 
\ganttlink{elem2}{elem6} 
\ganttlink{elem3}{elem6} 
\ganttlink{elem5}{elem7} 
\end{ganttchart}
\end{center}
\caption{Gantt Chart}
\end{figure}

\end{document}
5
  • Thank you. I didn't see {24} in ganttchart.
    – Dunno
    Mar 15, 2021 at 16:44
  • I wrote "didn't" because I was looking at the exact line of ganttchart. I copied this line and I don't understand everything it does.
    – Dunno
    Mar 21, 2021 at 12:33
  • Seems like progress is no longer displayed? Jun 27, 2021 at 13:33
  • @TheSimpliFire Thanks for the note. The progress is still displayed but was invisible since the name of the style incomplete changed. In my example, I removed it such it now shows the default styling.
    – gernot
    Jun 27, 2021 at 13:54
  • @gernot I just realised that the now too, and got round it by using bar/.style={fill=blue!50} Jun 27, 2021 at 13:55

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.