我无法控制考试中的 SolutionColor \shadedsolution

我无法控制考试中的 SolutionColor \shadedsolution

我想选择解决方案颜色阴影(绿色),并尝试以下

\documentclass[a4paper]{exam}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[danish]{babel}
\usepackage{amsfonts,amsmath,amssymb,amsthm}
\printanswers
\usepackage{color}
\definecolor{SolutionColor}{rgb}{0.0,1.0,0.}
\shadedsolutions
\pointpoints{point}{point} % Same form in plural and singular
\qformat {\textbf{Spørgsmål \thequestion}\quad(\thepoints):\hfill}
\renewcommand{\solutiontitle}{\noindent\textbf{Svar:}\par\noindent}
\begin{document}
  \begin{questions}
    \question[1]
      Hvad er meningen?
    \begin{solution}
      Ikke hvad vi gør, men hvordan vi gør det.
    \end{solution}
  \end{questions}
\end{document}

我得到了这个结果,而我希望绿色的解决方案的阴影(Svar): 带灰色阴影的 MWE

我如何控制SolutionColor命名的颜色?

答案1

\shadedsolutions如果你看一下(from )的定义exam.cls:6350,你就会发现它将颜色设置为灰色:

\def\shadedsolutions{%
  \@ifundefined{definecolor}
  {%
    % output an error if the color package isn't used
    % (snipped)
  }%
  {%
    \definecolor{SolutionColor}{gray}{0.8} % this is overwriting your color
    \@shadedsolutionstrue
    \@framedsolutionsfalse
  }%
}

\definecolor因此,您可以通过在后面添加以下内容来获得所需的结果\shadedsolutions

\documentclass[a4paper]{exam}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[danish]{babel}
\usepackage{amsfonts,amsmath,amssymb,amsthm}
\printanswers
\usepackage{color}
\shadedsolutions
\definecolor{SolutionColor}{rgb}{0.0,1.0,0.}
\pointpoints{point}{point} % Same form in plural and singular
\qformat {\textbf{Spørgsmål \thequestion}\quad(\thepoints):\hfill}
\renewcommand{\solutiontitle}{\noindent\textbf{Svar:}\par\noindent}
\begin{document}
  \begin{questions}
    \question[1]
      Hvad er meningen?
    \begin{solution}
      Ikke hvad vi gør, men hvordan vi gør det.
    \end{solution}
  \end{questions}
\end{document}

固定 MWE 输出

相关内容