We wish to handle subquestions on classroom notes. In some situations, it is desired to present a specific subquestion (with its answer), but before presenting the subquestion, we wish to show the problem enunciation. In the example below, "Solve the following recurrences." is required to appear when one of its subquestions is "invoked".
\documentclass{article}
\usepackage[answers,draft]{probsoln}
%\usepackage[noanswers,final]{probsoln}
\usepackage{enumitem}
\usepackage{amsmath,amsfonts}
\makeatletter
\newcommand{\amdlabel}[1]{% Avoiding Multiply defined labels
@ifundefined{c@#1}{ \newcounter{#1}\setcounter{#1}{0}}{}%
\ifthenelse{\value{#1} > 0}{}{\label{#1}\addtocounter{#1}{1}}%
} \makeatother
\newcommand{\Useproblem}[1]{
\item \amdlabel{#1} \useproblem{#1}
}
\newcommand{\Exercise}[1]{\paragraph*{Ex.~\ref{#1}}\useproblem{#1}}
\newcommand*\fixitem[2]{\item[]
\refstepcounter{enumi}\hskip-\labelwidth\hskip-\labelsep
\textbf{#1 \ref{#2}} }
\newcommand{\ExerciseT}[1] %
{\begin{enumerate}%
\fixitem{\textbf{Ex.}}{#1} \useproblem{#1}%
\end{enumerate}%
}
\newcommand{\ExerciseTS}[2] %
{\begin{enumerate}%
\fixitem{\textbf{Ex.}}{#2}%
\useproblem{#2}%
\end{enumerate}%
}
\newproblem{ex:nHLR:2}{
\begin{equation}
f(n) = \begin{cases} n, & \text{ if } n < 1, \
2f(n-1) + n, & \text{ if } n \geq 1. \end{cases}
\end{equation}
}{
\begin{equation}
f(n) = c_{1,0} + c_{1,1} n + c_{2,0} 2^{n},
\end{equation}
\begin{equation}
f(n) = 2^{n+1} - n - 2,
\end{equation}
for all $n \in \mathbb{N}$.
}
\newproblem{ex:nHLR:n2}{
\begin{equation}
f(n) = 2 f(n-1) + n^2
\end{equation}
for all $n \in \mathbb{N}$.
}{
\begin{equation}
f(n) = c_{1,0} + c_{1,1} n + c_{1,2} n^2 + c_{2,0} 2^{n},
\end{equation}
for all $n \in \mathbb{N}$.
\begin{equation}
f(n) = ( 6 + f(0) ) 2^{n} -6 -4n -n^{2} \
\end{equation}
for all $n \in \mathbb{N}$.
}
\begin{defproblem}{ex:nHLR}
Solve the following recurrences.
\begin{enumerate}
\Useproblem{ex:nHLR:2}
\Useproblem{ex:nHLR:n2}
\end{enumerate}
\end{defproblem}
\begin{document}
\section{Classroom Notes 10}
At a specific point, we wish to present only a subquestion, i.e., \ExerciseTS{ex:nHLR}{ex:nHLR:n2} with the \textbf{main enunciate} of the exercise.
\vspace{24pt}
We also might wish, during the lecture, to present an entire exercise, i.e., \ExerciseT{ex:nHLR}
\section*{Exercises}
\begin{enumerate}
\Useproblem{ex:nHLR}
\end{enumerate}
\end{document}