I have done something similar; in my experience, it was an environment that has
- a question
- a proof / answer
Here's an example:
\documentclass{article}
\usepackage{amsthm}
\newenvironment{questionanswer}{
\newcommand{\nextpart}{\end{quote}\begin{proof}}
\begin{quote}%
}{%
\end{proof}%
}
\begin{document}
\begin{questionanswer}
Something to be quoted.
\nextpart
Something to be proven.
\end{questionanswer}
\end{document}
To my understanding, this is expanded to exactly
\begin{document}
\begin{quote}
Something to be quoted.
\end{quote}\begin{proof}
Something to be proven.
\end{proof}
\end{document}
Note that by using \renewcommand
, this can be arbitrarily complex:
\documentclass{article}
\usepackage{amsthm}
\usepackage{amsmath}
\newenvironment{questionanswer}{%
\newcommand{\nextpart}{\end{quote}\begin{proof}%
\renewcommand{\nextpart}{\end{proof}\begin{itemize}%
\renewcommand{\nextpart}{\end{itemize}\begin{enumerate}%
\renewcommand{\nextpart}{\end{enumerate}\begin{equation}%
}}}}% As you can see, this can be arbitrarily complex
% (just be careful of your braces!)
\begin{quote}%
}{%
\end{equation}%
}
\begin{document}
Some normal text.
\begin{questionanswer}
Something to be quoted.
\nextpart
Something to be proven.
\nextpart
\item one
\item two
\nextpart
\item enum a
\item enum b
\nextpart
\sum_0^\infty a_n := \lim_{n\to\infty}\sum_0^n a_n
\end{questionanswer}
\end{document}

\nextpart
) that will change stuff in your environment (IMO, you do not need to repeat "myenv"). I think that the command\appendix
work like that in the environment "document"... – Lionel MANSUY Feb 27 '13 at 9:07