2
\documentclass[border=10pt]{article}
\usepackage{pgfgantt}




\ganttset{group/.append style={orange},
milestone/.append style={red},
progress label node anchor/.append style={text=red}}

\begin{document}
\begin{ganttchart}[
y unit title=0.4cm,
y unit chart=0.5cm,
vgrid,
time slot format=isodate-yearmonth,
time slot unit=month,
title/.append style={draw=none, fill=RoyalBlue!50!black},
title label font=\sffamily\bfseries\color{white},
title label node/.append style={below=-1.6ex},
title left shift=.05,
title right shift=-.05,
title height=1,
bar/.append style={draw=none, fill=OliveGreen!75},
bar height=.6,
bar label font=\normalsize\color{black!50},
group right shift=0,
group top shift=.6,
group height=.3,
group peaks height=.2,
bar incomplete/.append style={fill=Maroon}
]{2010-09}{2011-12}
\gantttitlecalendar{year} \\
\ganttbar[
progress=100,
bar progress label font=\small\color{OliveGreen!75},
bar progress label node/.append style={right=4pt},
bar label font=\normalsize\color{OliveGreen},
name=pp
]{Preliminary Project}{2010-09}{2010-12} \\
\ganttset{progress label text={}, link/.style={black, -to}}
\ganttgroup{Objective 1}{2011-01}{2011-12} \\
\ganttbar[progress=4, name=T1A]{Task A}{2011-01}{2011-06} \\
\ganttlinkedbar[progress=0]{Task B}{2011-07}{2011-12} \\
\ganttgroup{Objective 2}{2011-01}{2011-12} \\
\ganttbar[progress=15, name=T2A]{Task A}{2011-01}{2011-09} \\
\ganttlinkedbar[progress=0]{Task B}{2011-10}{2011-12} \\
\ganttgroup{Objective 3}{2011-05}{2011-08} \\
\ganttbar[progress=0]{Task A}{2011-05}{2011-08}
\ganttset{link/.style={OliveGreen}}
\ganttlink[link mid=.4]{pp}{T1A}
\ganttlink[link mid=.159]{pp}{T2A}
\end{ganttchart}
\end{document}

\end{document}

I have this example from the pgfgantt documentation. But it doesn't work. I get this error:

! Package xcolor Error: Undefined color `OliveGreen'.See the xcolor package documentation for explanation.Type H for immediate help.... ...ess=4, name=T1A]{Task A}{2011-01}{2011-06}

2

OliveGreen is a color name which stems from dvips. If you want to be able to refer to that color directly, you have to load xcolor with the option [dvipsnames] which can be achieved by adding the line \usepackage[dvipsnames]{xcolor} just before loading pgfgantt.

As you can see e.g. in this LaTeX WikiBook this also applies for the other colors used in your example that are not available, like RoyalBlue and Maroon.

2
  • thanks, i tried this before. Maybe i had a typo. But now it works. – Thomas Jul 22 '20 at 15:39
  • @Thomas you are welcome. Additionally to thanking me, you can accept this answer by clicking on the check mark next to it, thank you. – TobiBS Jul 22 '20 at 16:30

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.