为什么 pgfkeys 说它不知道密钥?

为什么 pgfkeys 说它不知道密钥?

我遇到了如下错误消息

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}

相关内容