TransWikia.com

pgfgantt xcolor Error undefined color

TeX - LaTeX Asked on August 25, 2021

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=sffamilybfseriescolor{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=normalsizecolor{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=smallcolor{OliveGreen!75},
bar progress label node/.append style={right=4pt},
bar label font=normalsizecolor{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}

One Answer

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.

Answered by TobiBS on August 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP