\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{xexercise}[2020/09/10 1.0.0 Usefull definitions for exercise solutions]

\RequirePackage{enumitem}
\RequirePackage{kvoptions}

\SetupKeyvalOptions{
  family=xexercise,
  prefix=xexercise@
}

\DeclareStringOption[Exercise]{exerciselabel}
\ProcessKeyvalOptions*

\newcounter{exercise}
\stepcounter{exercise}

% Option to reset the exercise label
\newcommand{\setexerciselabel}[1]
  {\renewcommand{\xexercise@exerciselabel}{#1}}

% Exercise
\newenvironment{exercise}[1][\theexercise]
  {\vspace{2mm}\noindent {\bfseries \xexercise@exerciselabel\, #1. }}
  {\stepcounter{exercise}}

% Exercise items ((a), (b), (c), ...)
\newenvironment{exerciseitems}
  {\begin{enumerate}[label={\bfseries(\alph*)}]}
  {\end{enumerate}}

\endinput

