I'm trying to define a custom environment within mdframed for handling questions in a document. The reason for the question-solution structure is to enable parsing into other formats (html etc).
The following code demonstrates my problem; the enumerate does not display properly in mdframed.
I realise there have been related posts but I cannot find a solution to this.
\documentclass[12pt, a4paper]{article}
\usepackage{tikz,pgf}
\usetikzlibrary{shadows}
\usepackage[framemethod=tikz]{mdframed}
\newcounter{exercises}
\def\theexercise{\thesection.\arabic{exercises}}
\newenvironment{exercises1}
{ \refstepcounter{exercises}
\begin{enumerate} }
{ \end{enumerate}
}
\newenvironment{exercises_mdf}
{ \refstepcounter{exercises}
\begin{mdframed}[backgroundcolor=black!10, frametitle={Exercise \theexercise}]
\begin{enumerate} }
{ \end{enumerate}
\end{mdframed}
}
\newenvironment{question}{ \item } { }
\newenvironment{solution}{ \\ {\bf Solution:} \\ }{ }
\begin{document}
\begin{exercises1}
\begin{question} Q1
\begin{solution} S1 \end{solution}
\end{question}
\begin{question} Q2
\begin{solution} S1 \end{solution}
\end{question}
\end{exercises1}
\begin{exercises_mdf}
\begin{question} Q1
\begin{solution} S1 \end{solution}
\end{question}
\begin{question} Q2
\begin{solution} S2 \end{solution}
\end{question}
\end{exercises_mdf}
\end{document}