Here is a different solution with pgfkeys.
One can:
- start a sub problem with
start sub problem (this prints 2a for example);
- continue a sub problem with
continue sub problem (this prints 2b for example).
These two keys should be used for "continuous" sub problems. If instead, sub problems are no "continuous":
start custom sub problem again starts the list, i.e prints 6a;
continue sub problem list continues the list, i.e prints 7a;
continue custom sub problem changes sub problem, i.e prints 6b.
An example:
\documentclass[a4paper, 12pt]{article}
\usepackage{fouriernc}
\usepackage{amsmath}
\usepackage[thmmarks,standard,thref]{ntheorem}
\usepackage{pgfkeys}
\pagestyle{empty}
\theoremseparator{.}
\theorembodyfont{\upshape}
\newtheorem{prob}{Problem}
\newcounter{subproblem}
\newcounter{auxproblem}
\pgfkeys{/theorem prob/.cd,
start sub problem/.code={%
\setcounter{subproblem}{1}
\renewcommand{\theprob}{\arabic{prob}\alph{subproblem}}
},
continue sub problem/.code={
\stepcounter{subproblem}
\addtocounter{prob}{-1}
\renewcommand{\theprob}{\arabic{prob}\alph{subproblem}}
},
start custom sub problem/.code={
\setcounter{subproblem}{1}
\renewcommand{\theprob}{\arabic{prob}\alph{subproblem}}
\setcounter{auxproblem}{\value{prob}}
},
continue sub problem list/.code={
\renewcommand{\theprob}{\arabic{prob}\alph{subproblem}}
},
continue custom sub problem/.code={
\setcounter{prob}{\value{auxproblem}}
\stepcounter{subproblem}
\renewcommand{\theprob}{\arabic{prob}\alph{subproblem}}
},
}
\newenvironment{pro}[1][]{%
\pgfkeys{/theorem prob/.cd,#1}
\begin{prob}
}{%
\end{prob}
}
\begin{document}
\begin{pro}
This is a Problem.
\end{pro}
\begin{pro}
This is a Problem.
\end{pro}
\begin{pro}
This is a Problem.
\end{pro}
\begin{pro}[start sub problem]
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem]\label{pro:4b}
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem]
This is a Problem.
\end{pro}
\begin{pro}
This is a Problem.
\end{pro}
\begin{pro}[start custom sub problem]
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem list]
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem list]
This is a Problem.
\end{pro}
\begin{pro}[continue custom sub problem]
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem list]
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem list]\label{pro:8b}
This is a Problem.
\end{pro}
\begin{pro}[continue custom sub problem]
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem list]
This is a Problem.
\end{pro}
\begin{pro}[continue sub problem list]
This is a Problem.
\end{pro}
\begin{pro}
This is a Problem.
\end{pro}
\begin{pro}
This is a Problem which refers to problem~\ref{pro:4b} and to problem~\ref{pro:8b}.
\end{pro}
\end{document}
The result:
