尝试了很多搜索 examclass 和 xcolor 的文档,但我找不到任何有用的信息。Chat GPT 建议了两种方法,但离预期结果还很远。即:
\ifnum#1=1
\setlength{\fboxsep}{-2pt}%
\setlength{\fboxrule}{4pt}%
\colorbox{easy}{\textcolor{white}{#2}}%
\else
\ifnum#1=2
\setlength{\fboxsep}{-2pt}%
\setlength{\fboxrule}{1pt}%
\colorbox{medium}{\textcolor{black}{#2}}%
\else
\ifnum#1=3
\setlength{\fboxsep}{-2pt}%
\setlength{\fboxrule}{2pt}%
\colorbox{hard}{\textcolor{white}{#2}}%
\else
#2%
\fi
\fi
\fi
}
有谁能够帮助我?