3

I want to create a list with the label LN, e.g. L1, L2, L3...

Sublists should have then the label L1a, L1b, L1c (for the first item in the list).

I tried the following:

\documentclass{article}
\usepackage{enumitem}

\begin{document}

\begin{enumerate}[label=\textbf{L\arabic*}]
\item Foo
\begin{enumerate}
\item Bar
\item FooBar
\item BarFoo \ref{l}
\end{enumerate}
\item \label{l} FooBarBarFoo
\item raBooF \ref{l}
\end{enumerate}

\end{document}

This gives me almost the desired output but I get in the sublist the labels (a), (b), (c)...

Looks like this:

Enumerate sublist

However, how can I change the labels of the sublist to get L1a, L1b, L1c?

2
  • 1
    Welcome to TeX.SX! Please add compilable code and provide a full minimal working example (MWE).
    – Bobyandbob
    Jul 9, 2017 at 19:02
  • You could use \setlist[enumerate, 2]{label =\theenumi \alph*} in the preamble.
    – Bobyandbob
    Jul 9, 2017 at 19:09

2 Answers 2

3

You could use \alph (small letters) and the counter \theenumi with [label=\textbf{\theenumi \alph*}](local) or \setlist[enumerate, 2]{label =\theenumi \alph*} (global) instead of arabic numerals.

Solution 1: (global)

\setlist[enumerate, 1]{label =\textbf{L\arabic*}}
\setlist[enumerate, 2]{label =\textbf{\theenumi \alph*}}

Solution 2: (local)

\begin{enumerate}[label=\textbf{L\arabic*}]
\begin{enumerate}[label=\textbf{\theenumi \alph*}]
\end{enumerate}
\end{enumerate}

Result:

enter image description here

MWE:

\documentclass{article}
\usepackage{enumitem}
%\setlist[enumerate, 1]{label =\textbf{L\arabic*}}
%\setlist[enumerate, 2]{label =\textbf{\theenumi \alph*}}
\begin{document}

\begin{enumerate}[label=\textbf{L\arabic*}]
\item Foo
\begin{enumerate}[label=\textbf{\theenumi \alph*}]
\item Bar
\item FooBar
\item BarFoo \ref{l}
\end{enumerate}
\item \label{l} FooBarBarFoo
\item raBooF \ref{l}
\end{enumerate}
\end{document}
3

I supposed you didn't want the cross-references to the first level lists to be in bold face too, only the label, and the label of the second level should not be boldface either. So here is how it goes:

\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate, 1]{label=L\arabic*, ref = L\arabic*, font =\bfseries}
\setlist[enumerate, 2]{label = \theenumi \alph*}

\begin{document}

\begin{enumerate}
\item Foo
\begin{enumerate}
\item Bar
\item FooBar
\item BarFoo \ref{l}
\end{enumerate}
\item \label{l} FooBarBarFoo
\item raBooF \ref{l}
\end{enumerate}

\end{document} 

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .