3

I would like to configure the colours in the Exam class, but it is not working and I get no colours.

\documentclass[french,a4paper,addpoints,12pt]{exam}
\usepackage[dvipsnames]{xcolor}

\definecolor{FillWithLinesColor}{HTML}{00F9DE}
\definecolor{FillWithDottedLinesColor}{gray}{0.8}
\colorlet{GridColor}{Cerulean}

\begin{document}

\begin{questions}
    \question[10]
    Foo?

    \fillwithlines{2cm}

    \question[15]
    Bar?

    \fillwithdottedlines{2cm}

    \question[10] Compute $\displaystyle\int_0^1 x^2 \, dx$.

    \fillwithgrid{2cm}

\end{questions}
\end{document}

enter image description here

What's wrong?

1 Answer 1

5

You need to specify that you want colours for the lines/dots/grids via

\colorfillwithlines
\colorfillwithdottedlines
\colorgrids

These commands each sets a conditional flag and also define the associated colours (FillWithLinesColor, FillWithDottedLinesColor and GridColor) with the defaults. Only after that you should (re)define the colours. Using your approach the colours are overwritten by the defaults, hence no change in the (colour of the) output.

enter image description here

\documentclass[addpoints]{exam}

\usepackage[dvipsnames]{xcolor}

\colorfillwithlines
\colorfillwithdottedlines
\colorgrids

\colorlet{FillWithLinesColor}{red}%\definecolor{FillWithLinesColor}{HTML}{00F9DE}
\colorlet{FillWithDottedLinesColor}{green}%\definecolor{FillWithDottedLinesColor}{gray}{0.8}
\colorlet{GridColor}{blue}%\colorlet{GridColor}{Cerulean}

\begin{document}

\begin{questions}
  \question[10]
  Foo?

  \fillwithlines{2cm}

  \question[15]
  Bar?

  \fillwithdottedlines{2cm}

  \question[10] Compute $\displaystyle\int_0^1 x^2 \, dx$.

  \fillwithgrid{2cm}

\end{questions}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .