尝试覆盖现有命令时,\cvskill 的参数有一个额外的 }

尝试覆盖现有命令时,\cvskill 的参数有一个额外的 }

我正在使用moderncv已经定义\cvskill命令的包。

我正在尝试使用以下命令覆盖/重新定义该命令\renewcommand

% ...

% param 1: name of the skill / tech / etc.
% param 2: level (for example in years)
% param 3: percent, values range from 0 to 1
% (maincol, lightcol are defined in the code before)
\renewcommand{\cvskill}[3]{
    \begin{tabular*}{1\mpwidth}{p{0.72\mpwidth} r}%
        \textcolor{black}{\textbf{#1}} & \textcolor{maincol}{#2} \\%
    \end{tabular*}%
    \hspace{4pt}%
    \begin{tikzpicture}[scale=1,rounded corners=2pt,very thin]%
        \fill [lightcol] (0,0) rectangle (1\mpwidth, 0.15);%
        \fill [maincol] (0,0) rectangle (#3\mpwidth, 0.15);%
    \end{tikzpicture}%
}

\begin{document}

% ...

\cvskill{Internet of Things}{5+ yrs}{1} \\ [-2pt]

我收到此错误信息:

! Argument of \cvskill has an extra }.<inserted text>\par \begin{document}
! Paragraph ended before \cvskill was complete. <to be read again>\par \begin{document}

\newcommand仅当我使用另一个名称来定义它时,它才会编译而不会出现错误,\cvskillbis例如。

我如何\cvskill以适当的方式覆盖命令?

相关内容