With the new class option coloranswers, answers shown via showanswers are
typeset in color, gray by default. The color can be changed with
\answercolor{...}. Without the option, the output is unchanged and xcolor
is not loaded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
+Mit der zusätzlichen Option `coloranswers` werden die Antworten farbig
+gesetzt, standardmäßig grau. Die Farbe lässt sich mit `\answercolor{...}`
+ändern, z.B. `\answercolor{blue!70!black}`. Die Option lädt `xcolor`.
+
Ein optionales Argument erlaubt es die Punkteanzahl bekanntzugeben. Die
Umgebung `choices` erlaubt es single- oder multiple-choice Fragen zu
formulieren:
Ein optionales Argument erlaubt es die Punkteanzahl bekanntzugeben. Die
Umgebung `choices` erlaubt es single- oder multiple-choice Fragen zu
formulieren:
\DeclareOption{austrian}{\def \exsheetgerman{}}
\DeclareOption{naustrian}{\def \exsheetgerman{}}
\DeclareOption{showanswers}{\def \exsheetshowanswers{}}
\DeclareOption{austrian}{\def \exsheetgerman{}}
\DeclareOption{naustrian}{\def \exsheetgerman{}}
\DeclareOption{showanswers}{\def \exsheetshowanswers{}}
+\DeclareOption{coloranswers}{\def \exsheetcoloranswers{}}
\DeclareOption{exam}{\def \exsheetexam{}}
\DeclareOption{nostudentinfo}{\def \exsheetnostudentinfo{}}
\DeclareOption{nogradeinfo}{\def \exsheetnogradeinfo{}}
\DeclareOption{exam}{\def \exsheetexam{}}
\DeclareOption{nostudentinfo}{\def \exsheetnostudentinfo{}}
\DeclareOption{nogradeinfo}{\def \exsheetnogradeinfo{}}
+% Color of answers, only effective with option coloranswers.
+\def\exsheet@answercolor{gray}
+\newcommand{\answercolor}[1]{\def\exsheet@answercolor{#1}}
+
+\@ifundefined{exsheetcoloranswers}{}{\RequirePackage{xcolor}}
+
\@ifundefined{exsheetshowanswers}{
\excludecomment{answer}
}{
\@ifundefined{exsheetshowanswers}{
\excludecomment{answer}
}{
- \newenvironment{answer}{\vspace*{0.5em}\textit{\theanswer:} \hspace*{0.5em} }{}
+ \newenvironment{answer}{%
+ \vspace*{0.5em}%
+ \@ifundefined{exsheetcoloranswers}{}{\color{\exsheet@answercolor}}%
+ \textit{\theanswer:} \hspace*{0.5em} }{}
}
\newenvironment{choices}{%
}
\newenvironment{choices}{%