3

I have nested enumeration with a long labels. As a result, the text in items becomes very shifted to the right. I want that this text in items won't be moved at all (the same horizontal offset as the text without enumeration).

MWE

\documentclass[a4paper, 10pt, twocolumn]{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage[hmargin=0.1cm,vmargin=2cm]{geometry}
\usepackage{enumitem}

\setlength{\columnsep}{0.2cm}
\setlength{\columnseprule}{0.4pt}

\setlist[enumerate,1]{label=\bfseries\thesubsection.\arabic*}
\setlist[enumerate,2]{label*=\bfseries.\arabic*} 
\setlist[enumerate,3]{label*=\bfseries.\arabic*} 
\setlist[enumerate,3]{label*=\bfseries.\arabic*}
\setlist[enumerate]{leftmargin=*}

\begin{document}
\raggedbottom

\section{Section 1}

\section{Section 2}
Section Line
\subsection{Subsection 1}
\subsection{Subsection 2}

\begin{enumerate}
    \item Item 1 \\
    Line 1
    \item Item 2 \\
    Line 2
\end{enumerate}

\end{document}

Line 1 and Line 2 in my example must have the save horizontal offset as Section Line.

1
  • I updated my answer, providing a better solution. Nov 28, 2012 at 23:17

1 Answer 1

2

To obtain this kind of formatting, it's better to set leftmargin=0pt instead of leftmargin=*, and to set itemindent to the appropriate value

itemindent=\widthof{\bfseries\thesubsection.\theenumi\hspace*{\labelsep}}

A little example:

\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage[hmargin=0.1cm,vmargin=2cm]{geometry}
\usepackage{enumitem}
\usepackage{calc}

\setlength{\columnsep}{0.2cm}
\setlength{\columnseprule}{0.4pt}

\setlist[enumerate,1]{label=\bfseries\thesubsection.\arabic*}
\setlist[enumerate,2]{label*=\bfseries.\arabic*} 
\setlist[enumerate,3]{label*=\bfseries.\arabic*} 
\setlist[enumerate,3]{label*=\bfseries.\arabic*}
\setlist[enumerate]{leftmargin=0pt,itemindent=\widthof{\bfseries\thesubsection.\theenumi\hspace*{\labelsep}}}

\begin{document}
\raggedbottom

\section{Section 1}

\section{Section 2}
Section Line
\subsection{Subsection 1}

\subsection{Subsection 2}
\begin{enumerate}
\item Item 1 \\
Line 1
\item Item 2 \\
Line 2
\end{enumerate}

\setcounter{section}{10}% just for the example
\setcounter{subsection}{12}% just for the example
\begin{enumerate}
\item Item 1 \\
Line 1
\item Item 2 \\
Line 2
\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 .