2

Within the exam class i have been putting tables in for the people doing the questions to fill in the gaps. However when i write \printanswers i wish for the answers to appear within the table


\begin{table}[h]
\centering
\begin{tabular}{|l|l|l|}
\hline
\textbf{Item }  & \textbf{Full Price (£)} & \textbf{Sale Price (£)} \\ \hline
Shoes  & 25             &                \\ \hline
Jeans  & 40             &                \\ \hline
Socks  & 2              &                \\ \hline
Jumper & 17.50          &                \\ \hline
Suit   & 120            &                \\ \hline
\end{tabular}
\end{table}

But i wish the answers to appear red or something to clearly show that they are the solutions.

\begin{table}[h]
\centering
\begin{tabular}{|l|l|l|}
\hline
\textbf{Item }  & \textbf{Full Price (£)} & \textbf{Sale Price (£)} \\ \hline
Shoes  & 25             &        21.25        \\ \hline
Jeans  & 40             &     34           \\ \hline
Socks  & 2              &     1.70           \\ \hline
Jumper & 17.50          &        14.88        \\ \hline
Suit   & 120            &       102         \\ \hline
\end{tabular}
\end{table} 
0

1 Answer 1

2

There is the \fillin command which do what you need

\documentclass[answers]{exam}
\usepackage{xcolor}

\CorrectChoiceEmphasis{\color{red}}

\setlength\fillinlinelength{1cm}

\setlength\answerclearance{0.5ex}

\begin{document}
\begin{questions}
\question

Fill in the table 

\centering
\begin{tabular}{|l|l|c|}
\hline
\textbf{Item }  & \textbf{Full Price (£)} & \textbf{Sale Price (£)} \\ \hline
Shoes  & 25             &  \fillin[20]              \\ \hline
Jeans  & 40             &   \fillin[30]             \\ \hline
Socks  & 2              &    \fillin[1]            \\ \hline
Jumper & 17.50          &    \fillin[15]            \\ \hline
Suit   & 120            &    \fillin[100]            \\ \hline
\end{tabular}

\end{questions}
\end{document}

enter image description here

enter image description here

You must log in to answer this question.

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