# Checkbox enumerate list, with checked items

Following this post, I would like to do a checkbox list, with enumerate elements. Before each enumerate label, an empty checkbox is present. In the MWE below, I'd like to have the box in front of the third element checked. (But still be numbered c.)

\documentclass{article}

\usepackage{pifont,amssymb} % for the symbols
\usepackage[shortlabels]{enumitem}
\newlist{answerlist}{enumerate}{2}
\setlist[answerlist]{label={$\square$ \hspace{1pt}\alph*.}}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\correct}{
\rlap{$\square$ \hspace{1pt}\alph*{\theenumi}.}{\raisebox{2pt}{\large\hspace{1pt}\cmark} \*a}%
\hspace{-2.5pt}
}
\newcommand{\correctanswer}{\item[\correct] }

\begin{document}

\begin{answerlist}
\item One
\item Two
\correctanswer Test
\end{answerlist}

\end{document}


But the \correctanswer above generates an error because the counter \theenumi seems to be zero at that point.

## 1 Answer

\alph has special meaning inside the definitions of enumitem; it defines \alph*to be an alphabetic representation of the current counter level. You're using it outside the list setup and therefore \alph* is actually the same as \alph{*}... and there exists no * counter.

The following example provides what you're after though:

\documentclass{article}

\usepackage{pifont,amssymb} % for the symbols
\usepackage[shortlabels]{enumitem}

\newlist{answerlist}{enumerate}{2}
\setlist[answerlist]{label={\alph*.\makebox[0pt][r]{\noexpand\emptysquare\hspace{2em}}},ref=\alph*}

\newcommand{\emptysquare}{$\square$}
\newcommand{\checkedsquare}{\makebox[0pt][l]{\raisebox{1pt}[0pt][0pt]{\large\hspace{1pt}\cmark}}$\square$}
\newcommand{\cmark}{\ding{51}}%

\begin{document}

\begin{answerlist}
\item One
\item Two
\correctanswer Test
\item Three
\end{answerlist}

\end{document}

• Thank you for your explanations. I can't claim to perfectly understand the solution, but I'll play around with it until I do! – Peutch Oct 2 at 14:02