3

I have a document full of lists which I need to refer to later in the document. Therefore I number my lists (enumerate) by subsections. I have chosen to specify this globally by this line in the preamble:

\renewcommand*{\theenumi}{\thesubsection.\arabic{enumi}}

This gives me the result I want, but because each item now consists of 4 digits (chapter.section.subsection.item), some of the numbers end up in the left margin:

Misalignment of enumerate and chapter/section/subsection numbers and text.

I would like the numbers of enumerate to (left) align with the rest of the document text (including subsection numbers as seen in the picture above). How is this done globally, since I have a massive amount of lists?

If relevant: I am using memoir.

4

Similar to Harish's answer, but there's no need for

\renewcommand*{\theenumi}{\thesubsection.\arabic{enumi}}

You can simply define

\setlist[enumerate]{leftmargin=*,align=left,label=\thesubsection.\arabic*.}

MWE:

\documentclass{memoir}

\setcounter{secnumdepth}{3}

\usepackage{enumitem}
\setlist[enumerate]{leftmargin=*,align=left,label=\thesubsection.\arabic*.}

\begin{document}

\chapter{A chapter}
\section{A section}
\subsection{A subsection}
\begin{enumerate}
  \item aaa
  \item bbb
  \item ccc
\end{enumerate}
\end{document} 

enter image description here

If you need it only for a few enumerate environments, instead of setting globally

\setlist[enumerate]{leftmargin=*,align=left,label=\thesubsection.\arabic*.}

use these settings locally by issuing

\begin{enumerate}[leftmargin=*,align=left,label=\thesubsection.\arabic*.]

Note that you may need to load enumitem with the shortlabels option

\usepackage[shortlabels]{enumitem}

if you have already customized enumerate lists.

  • This seems to work, although I get several errors from other numbered lists where I don't want the chapter.section.subsection.item style. In this case I have used: \begin{enumerate}[1] to make a list with only one number (no reference needed). How do I implement "your" code while still being able to use the simpler version of numbered list? – Thomas Feb 7 '15 at 12:08
  • I have several lists (as in way too many, but all necessary), some of which need to be numbered by subsection numbering and some which need to be numbered 1. item, 2. item, etc. I think the subsection numbering works smoothly, but the simpler versions result in errors. How do I make these simpler numbered lists locally, while still globally defining the subsection numbered lists? (Is my point clear?) – Thomas Feb 7 '15 at 12:24
  • 1
    @Thomas See the edit. Using \usepackage[shortlabels]{enumitem} should solve the problem. – karlkoeller Feb 7 '15 at 12:25
  • Sorry, you are correct and it works perfectly. I saw another of your edits right before my previous comment. This really works, I can't believe it! :) – Thomas Feb 7 '15 at 12:26
3

You can use enumitem and its align=left

\documentclass{memoir}
\usepackage{enumitem} 
\renewcommand*{\theenumi}{\thesubsection.\arabic{enumi}}
\begin{document}
\chapter{A chapter}
\section{A section}
\subsection{A sub section}
\begin{enumerate}[align=left,leftmargin=*]
  \item Some item Some item Some item Some item Some item Some item Some item Some item Some item Some item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
\end{enumerate}
Some text here
\end{document}

Remember that memoir class emulates the functions of only enumerate package and for more control, enumitem is recommended. Here is an example of more control with a customized alignment.

\documentclass{memoir}
\usepackage{enumitem} % for \midrule macro
\renewcommand*{\theenumi}{\thesubsection.\arabic{enumi}}
\SetLabelAlign{myleft}{\strut\smash{\parbox[t]{\labelwidth}{\raggedright#1}}}
\begin{document}
\chapter{A chapter}
\section{A section}
\subsection{A sub section}
\begin{enumerate}[align=myleft,labelwidth=1.25cm,leftmargin=\dimexpr\labelwidth+\labelsep,
        itemindent=!]
  \item Some item Some item Some item Some item Some item Some item Some item Some item Some item Some item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
  \item Some item
\end{enumerate}
Some text here
\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.