I would like to create a list in LaTeX in which:
1. the longest label is aligned to the left margin,
2. the labels can be composite and look like "(1)(a)",
3. the labels, which can be of varying widths (e.g. one item is numbered "(1)(a)", the next one "(b)") are flush right,
4. the items are justified and are not indented.
Because nothing can beat a picture, here is the effect I would like to achieve:
Well, as you can see, I have managed to make such a list 🙂 The thing is, the solution I used involved a lot of manual setting, e.g. specyfing leftmargin
in points (I used the enumitem
package), which is not the most elegant way of doing things. I was wondering if it is possible to create such a list "automatically".
Since it's always good to give some code to work on, I can offer that:
\documentclass{article}
\usepackage{enumitem}
\newcounter{ex}
\newcounter{ex_alph}
\begin{document}
\section{Lorem ipsum}
\Large
\begin{enumerate}
\item[\refstepcounter{ex}(\theex)\stepcounter{ex_alph}(\alph{ex_alph})]Lorem ipsum\ldots
\item[\stepcounter{ex_alph}(\alph{ex_alph})]Lorem ipsum\ldots
\setcounter{ex_alph}{0}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua\ldots
\end{enumerate}
\begin{enumerate}
\item[\refstepcounter{ex}(\theex)]Lorem ipsum\ldots
\end{enumerate}
\end{document}
Best Answer
Is below code result more or less what you are aiming for?
It's worth to check enumitem documentation (
texdoc enumitem
), because its power is in decent configurability.EDIT
If you change some lines as below
you'll get