I am writing a latex setup for exercise sheets.
I have defined a "solution" environment, that is only rendered if a boolean is set to true.
Sometimes, but not always, I will use a customised enumerate environment for different parts of an exercise. When i put the solution inside the enumerate, it will have a smaller linewidth.
How can i make it have the same linewidth as it would have outside of the enumerate?
MWE:
\documentclass[a4paper, 11pt]{article}
\usepackage{fullpage}
\usepackage{environ}
\usepackage{enumitem}
\usepackage{xcolor}
\setlength{\parindent}{0em}
\newcommand{\problem}[1]{\stepcounter{section}\section{Problem \sheetNr.\thesection: {#1}}}
\newenvironment{subproblems}{\enumerate[label=\textbf{\alph}.]}{\endenumerate}
\newif\ifanswers
\NewEnviron{solution}{
\ifanswers
\color{purple}
\par\mbox{}\hrulefill\newline
\textbf{Solution}:\
%
\expandafter\BODY
%
\fi
}
\newcommand{\sheetNr}{1}
\answerstrue
\begin{document}
\problem{Some Title}
A problem without subproblems
\begin{solution}
The solution has ``full" width.
\end{solution}
\problem{Another Title}
\begin{subproblems}
\item First part
\begin{solution}
This solution has reduced width
\end{solution}
\item Second Part
\end{subproblems}
\end{document}


\begin{enumerate}[wide]. B.t.w., for the labels formatting, it would be simpler to code[label=\alph*., font=\bfseries]. – Bernard Nov 16 '20 at 19:52