Deseo hacer una hoja sencilla de preguntas y respuestas para mis alumnos. Me gustaría tener algo como esto:
\section{Differential Equations}
\begin{questions}
\begin{question}
... Question here ...
\end{question}
\begin{answer}
... Answer here ...
\end{answer}
\end{questions}
Deseo tener el entorno PREGUNTAS para tener contadores como enumerar. Es decir, cada uno \begin{question} ... \end{question}
debe comportarse como \item
en
\begin{question}
\item
\end{question}
El \begin{question} ... \end{question}
entorno debería aceptar comandos LaTeX "normales".
Si es posible, me gustaría aplazar la impresión para imprimir las respuestas al final del documento.
Primero probé esto
\makeatletter
\newtoks\answerscollect
\newcounter{question}
\setcounter{question}{0}
\def\thequestion{{\bfseries{Question \arabic{question}. }}\\}
\def\answer#1{%
\protected@edef\answertmp{%
\the\answerscollect\vspace{.5\baselineskip}\noindent\thequestion#1\par}%
\par\answerscollect=\expandafter{\answertmp}}
\def\printanswers{\the\answerscollect\answerscollect={}}
\def\initbox{\answerscollect={\par\noindent Answers:\par}}
\newcommand{\question}[1]{\stepcounter{question}\par\noindent\thequestion#1}
\makeatother
pero no se está comportando como me gustaría que fueran los resultados...
Respuesta1
Uso simple del exam
paquete:
\documentclass{exam}
%\printanswers
\begin{document}
\section{Differential Equations}
\begin{questions}
\question ... Short question here ... \answerline[Short answer]
\question ... Question here ...
\begin{solution}[.2in]
... Answer here ...
\end{solution}
\question Long descriptive question about everything
\begin{solutionorlines}[2in]
Long descriptive answer is a long descriptive answer that is a long descriptive answer that is along descriptive answer that is along descriptive answer that is along descriptive answer that is a lie.
\end{solutionorlines}
\question Draw an arrow showing north direction.
\begin{solutionorbox}[2in]
$\uparrow$
\end{solutionorbox}
\end{questions}
\ifprintanswers
Stuff to appear only when answers \textbf{are} being printed.
\else
Stuff to appear only when answers \textbf{are not} being printed.
\fi
\end{document}
Comentar y descomentar \printanswers
produce uno de los dos siguientes:
1)
2)
No veo ninguna falta de funcionalidad en comparación con su ejemplo.