I'm having an issue with adding a frame around the solutions environment while using the exsheets package. I have a bit of my code below. My problem is that I'm greeted with an error if I choose to add a \begin{figure} environment within the boxed solution. I've tried a number of workarounds, including modifying my \begin{figure}\end{figure} to, instead, be a \begin{center}\end{center}. However, I also have instances where I wish to use \begin{subfigure}\end{subfigure}. As such, I've tried modifying these subfigures to, instead, use \begin{minipage}\end{minipage}; however, this overly complicates the layout and then the captions are not labelled as I would desire. I've also tried the suggestion given for list environments found here and here. The error I receive while using the figure environment within the mdframe is:
! LaTeX Error: Not in outer par mode.
...
! Undefined control sequence.
\@xfloat ...@fltovf \fi \global \setbox \@currbox
\color@vbox \normalcolor \...
I would like to include figures (and ultimately subfigures) in the mdframed solutions. Thanks in advance, and any/all help is much appreciated.
MWE
\documentclass[10pt,twoside,onecolumn]{book}
\usepackage[framemethod=TikZ]{mdframed} % Frames For exsheets
\usepackage{exsheets} % Creating Exercises and Solutions
\begin{document}
\chapter{Some Chapter}
\section{Some Section}
\subsection{Some Sub-Section}
\begin{question}
Here's a question
\end{question}
\mdframed
\begin{solution}[print=true]
Here's a solutions.
\begin{figure}
\includegraphics[width=\textwidth]{logo}
\caption{diagram}
\label{fig:solution}
\end{figure}
\end{solution}
\endmdframed
\end{document}
Per the comment from @leandriis, I've managed to get something working. This is not ideal, as I cannot seem to caption my "sub-images" appropriately; however, here is a close work around. Still hopeful for a solid solution that would keep subfloats and subcaptions intact.
\documentclass[10pt,twoside,onecolumn]{book}
\usepackage[framemethod=TikZ]{mdframed} % Frames For exsheets
\usepackage{exsheets} % Creating Exercises and Solutions
\usepackage{capt-of} % Add Captions to Images
\begin{document}
\chapter{Some Chapter}
\section{Some Section}
\subsection{Some Sub-Section}
\begin{question}
Here's a question
\end{question}
\mdframed
\begin{solution}[print=true]
Here's a solutions.
\begin{minipage}{\textwidth}
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\textwidth]{logo}
\label{fig:solution-left}
\end{minipage}
\begin{minipage}{0.45\textwidth}
\includegraphics[width=\textwidth]{logo}
\label{fig:solution-right}
\end{minipage}
\end{minipage}
\captionof{figure}{one caption for all images, just not subs}
\end{solution}
\endmdframed
\end{document}


