![为什么 pgfkeys 说它不知道密钥?](https://linux22.com/image/445959/%E4%B8%BA%E4%BB%80%E4%B9%88%20pgfkeys%20%E8%AF%B4%E5%AE%83%E4%B8%8D%E7%9F%A5%E9%81%93%E5%AF%86%E9%92%A5%EF%BC%9F.png)
我遇到了如下错误消息
Package pgfkeys Error: I do not know the key '/tikz/cvGreenLight'
and I am going to ignore it. Perhaps you misspelled it.
\fill[cvGreenLight]"
在使用下面的行时。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,backgrounds,matrix}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\fill[cvGreenLight] (current page.north west)
rectangle ++(\cvSideWidth+2\cvMargin,-\paperheight);
\end{tikzpicture}
\end{document}
答案1
所示代码的颜色未定义(会产生所示错误)且长度未定义。定义它们可使其无错误运行。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,backgrounds,matrix}
\definecolor{cvGreenLight}{rgb}{0,0,1}
\newlength\cvSideWidth \setlength\cvSideWidth{5cm}
\newlength\cvMargin \setlength\cvMargin{1cm}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\fill[cvGreenLight] (current page.north west)
rectangle ++(\cvSideWidth+2\cvMargin,-\paperheight);
\end{tikzpicture}
\end{document}