2

There are a multitude of options to specify the alignment and spacing with the enumerate package however I am unable to find the combination which yields the formatting I want.

The \lipsum package is used to illustrate the formatting.


Using the options below, each item in enumerate (1st and 2nd levels) has the same indentation (left margin) for every line in each 1st level of enumerate. This is what I want. However I would also like the section and 1st level enumerate numbers to be left aligned.

I have included the 2nd level of enumerate which is appearing as desired with the (a) at the same alignment as the text in the 1st level.

\setenumerate[1]{label=\thesection.\arabic*,labelwidth=1.5cm,labelindent=10pt,leftmargin=1.2cm}

enter image description here


In order to make the section numbering and first level enumerate numbering aligned on the left, I changed to using the following options;

\setenumerate[1]{label=\thesection.\arabic*,labelsep*=12pt, align=left, leftmargin=*}

enter image description here

However now the indentation of the paragraph is not constant.


Below I have taken a screen shot and moved text around in paint to illustrate what I'm trying to achieve. I am less/not particularly concerned about the section heading text and paragraph text having the same alignment as each other.

This is what I want it to look like


Here is MWE.

\documentclass{article}

\usepackage{lipsum}
\usepackage{enumitem}

% Section numbers and enumerate numbers are not left aligned, however the indentation of text is constant (how I want it)
% \setenumerate[1]{label=\thesection.\arabic*,labelwidth=1.5cm,labelindent=10pt,leftmargin=1.2cm}

% Section numbers and enumerate numbers are left aligned, however the indentation of the text is not constant
\setenumerate[1]{label=\thesection.\arabic*,labelsep*=12pt, align=left, leftmargin=*}

\setenumerate[2]{label=(\alph*), ref=\theenumi{} (\alph*), align=left}

\begin{document}
\section{Test}
\begin{enumerate}
    \item \lipsum[2]
\end{enumerate}

\setcounter{section}{22}
\section{Double digits}
\begin{enumerate}
    \item \lipsum[2]
    \setcounter{enumi}{21}
    \item \lipsum[2]
    \begin{enumerate}
        \item \lipsum[2] % The (a) should be aligned with the text in the item above
    \end{enumerate}
\end{enumerate}
\end{document}
1

Use the widestkey for that:

\documentclass{article}

\usepackage{lipsum}
\usepackage{enumitem}

% Section numbers and enumerate numbers are not left aligned, however the indentation of text is constant (how I want it)
% \setenumerate[1]{label=\thesection.\arabic*,labelwidth=1.5cm,labelindent=10pt,leftmargin=1.2cm}

% Section numbers and enumerate numbers are left aligned, however the indentation of the text is not constant
\setenumerate[1]{label=\thesection.\arabic*,labelsep*=12pt, widest=00.00, align=left, leftmargin=*}

\setenumerate[2]{label=(\alph*), ref=\theenumi{} (\alph*), align=left}

\begin{document}
\section{Test}
\begin{enumerate}
    \item \lipsum[2]
\end{enumerate}

\setcounter{section}{22}
\section{Double digits}
\begin{enumerate}
    \item \lipsum[2]
    \setcounter{enumi}{21}
    \item \lipsum[2]
    \begin{enumerate}
        \item \lipsum[2] % The (a) should be aligned with the text in the item above
    \end{enumerate}
\end{enumerate}

\end{document} 

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.