0

Is there a simple way to have a document created with the exam class show the grade table only when \printanswers is invoked? Wrapping the grade table in a solution environment works but forces me to place it inside a questions environment. I've also tried using \fillin[\gradetable[h][questions]][0em] (which works for hiding question points), but this triggers the error "Missing number, treated as zero." and a few other errors that mystify me.

1 Answer 1

0

I don't know why you want to hide the grade table, but one way is shown here

\documentclass[answers]{exam}

\usepackage{etoolbox,expl3}
\newtoggle{gradation}
\ExplSyntaxOn
\makeatletter
\clist_set:NV  \l_tmpe_clist{ \@classoptionslist }
\clist_if_in:NnT
 { \l_tmpe_clist } { answers }
 { \toggletrue{gradation} }
\makeatother
\ExplSyntaxOff

\begin{document}

\iftoggle{gradation}{%
  \printanswers
}
morestufs
\iftoggle{gradation}{%
  \gradetable[h][questions]
}
foobar
\end{document}

You may consider the packages ifthen or xparse also.

You can also take a look at condition compilation with \ifdef or \ifx

You must log in to answer this question.

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