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.

  • I updated my answer, providing a better solution. – Gonzalo Medina Nov 28 '12 at 23:17
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

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.