pgfgantt xcolor 错误未定义颜色

pgfgantt xcolor 错误未定义颜色
\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}

我从 pgfgantt 文档中找到了此示例。但它不起作用。我收到此错误:

!软件包 xcolor 错误:未定义颜色“OliveGreen”。请参阅 xcolor 软件包文档以获取解释。输入 H 可立即获得帮助.... ...ess=4, name=T1A]{任务 A}{2011-01}{2011-06}

答案1

OliveGreen是源自 dvips 的颜色名称。如果您想要直接引用该颜色,则必须xcolor使用选项进行加载,只需在加载之前[dvipsnames]添加一行即可。\usepackage[dvipsnames]{xcolor}pgfgantt

正如你所见LaTeX 维基百科这也适用于示例中使用的其他不可用的颜色,如RoyalBlueMaroon

相关内容