Como definir ambientes para perguntas e respostas

Como definir ambientes para perguntas e respostas

Desejo fazer uma folha simples de perguntas e respostas para meus alunos. Eu gostaria de ter algo assim:

\section{Differential Equations}

    \begin{questions}

         \begin{question}
              ... Question here ...
         \end{question}

         \begin{answer}
              ... Answer here ...
         \end{answer}

    \end{questions}

Desejo que o ambiente PERGUNTAS tenha contadores como enumerar. Ou seja, cada um \begin{question} ... \end{question}deve se comportar exatamente \itemcomo

\begin{question} 
\item 
\end{question}

O \begin{question} ... \end{question}ambiente deve receber comandos LaTeX "normais".

Se possível, gostaria de adiar a impressão para imprimir as respostas no final do documento.

Eu tentei isso pela primeira vez

\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

mas não está se comportando como eu gostaria que os resultados fossem...

Responder1

Uso simples do exampacote:

\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 e descomentar \printanswersresulta em um dos dois seguintes:

1)

Apenas perguntas

2)

Perguntas com respostas

Não vejo falta de funcionalidade em comparação com o seu exemplo.

informação relacionada