Creating a Problem Sheet using datatool.sty
This example requires mth101.dbtex.\documentclass{article} \usepackage{etoolbox} \usepackage{datatool} \newbool{showanswers} \booltrue{showanswers} \DTLloaddbtex{\problemDB}{mth101.dbtex} \begin{document} \begin{center}\bfseries\Large Assignment~1\ifbool{showanswers}{ (Solution Sheet)}{} \end{center} \begin{enumerate} \DTLforeach*{\problemDB} {\Label=Label,\Question=Question,\Answer=Answer}% {% \item \Question \ifbool{showanswers}{\par\textbf{Solution: }\Answer}{}% } \end{enumerate} \end{document}
Download datatoolprob.tex or datatoolprob.pdf.