# Questions which include answers within the Question

I want to create Questions wherein each will include a series of fill in the blanks.

I want to display a worksheet which has an answer line in place of the answers. And then a worksheet where the answers are included over the answer line. And finally all the answers at the end.

What I'm aiming for:

Question worksheet with fill in the blanks.

Question worksheet with blanks filled in

I've looked at some packages like exercise, and exam but I don't think I can quite manipulate them to get what I'm after...

I've come up with a solution that does what I need. This might be helpful for anyone else. If anyone has other suggestions I'd be grateful as I'm just hacking around.

\documentclass[12pt,a4paper]{article}
\usepackage{ifthen}
\usepackage{tocloft}
\usepackage{exercise}

% Set the Show Answers Boolean
\newboolean{showAns}
\setboolean{showAns}{false}
\newcommand{\showAns}{\setboolean{showAns}{true}}

% The length of the Answer line

% ans command that indicates space for an answer or shows the answer in red
\ifthenelse{\boolean{showAns}}%
{\textcolor{red}{\underline{\hspace{2ex}#1\hspace{2ex}}}}%

% Formatting how multiple choices Questions are formated.

% Some commands for the Exercise Question package
\renewcommand{\QuestionNB}{\Large\protect\textcircled{\small\bfseries\arabic{Question}}\ }
\renewcommand{\QuestionBefore}{3ex} %Space above each Q
\setlength{\QuestionIndent}{8pt} % Indent after Q number

% To create the list of answers with tocloft...

% Creates a TOC for Answers
\newcounter{prevQ}
\ans{#1}%
\ifnum\theQuestion=\theprevQ%
\else%
\setcounter{prevQ}{\value{Question}}%
\fi%
}%

\begin{document}

\showAns

\begin{Exercise}
\Question $1+2$ is (\answer{C})

\Question $2+3=$~\answer{$5$}

\end{Exercise}

Here's what the code produces without \showAns
with \showAns
And the tocloft package produces this for \listofanswer