[Tex/LaTex] How to make a enumerate list with numbers and given letter

#enumerate

I would like to create a enumerate as following:

C1
 C1.1
 C1.2
C2
C3

Basically, all numbers have a given letter.

Thanks.

Best Answer

Using enumitem you can define the first level list to have label=C\arabic*, which will prepend the C to the counter. for the following lists you can use label*=.\arabic*, which will append .<counter> to the parent list counter.

enter image description here

\documentclass{article}

\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label=C\arabic*]
  \item item
  \begin{enumerate}[label*=.\arabic*]
    \item sub item
    \item another sub item
  \end{enumerate}
  \item another item
  \item one more item
\end{enumerate}

\end{document}

If you want this to be the global setting of your document, instead of using \begin{enumerate}[label... every time (which can be quite tedious and error-prone), you can use \setlist:

\documentclass{article}

\usepackage{enumitem}

\setlist[1]{label=C\arabic*}
\setlist{label*=.\arabic*}

\begin{document}

\begin{enumerate}
  \item item
  \begin{enumerate}
    \item sub item
    \item another sub item
  \end{enumerate}
  \item another item
  \item one more item
\end{enumerate}

\end{document}

The first \setlist will make C<counter> for first level lists, and the second will append .<counter> to the other levels.