Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I've created my environment, and modified the enumerate command:

\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}
\renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}

\newenvironment{packed_enum}{
\begin{enumerate}
\setlength{\itemsep}{1pt}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
}{\end{enumerate}}

And this is what i get:

Latex Problem

The first two levels align properly (I've marked it with blue line), but the third level starts too much on the left (red line). Can You help me fix this? I've tried something like this (also with changing labelsep to \leftmargin):

\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}
\renewcommand{\labelenumiii}{\setlength{\labelsep{5ex}\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}

or this:

\renewcommand{\labelenumi}{\arabic{enumi}.}
\renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}
\renewcommand{\labelenumiii}{\hbox{\hspace{5ex}\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}}

but neither helped.

share|improve this question
    
Welcome to TeX.SX! –  karlkoeller Jan 18 at 10:41

2 Answers 2

up vote 14 down vote accepted

With the help of enumitem

\newenvironment{packed_enum}{%
  \renewcommand{\labelenumi}{\arabic{enumi}.}%
  \renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}%
  \renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}%
  \begin{enumerate}[itemsep=1pt,parsep=0pt,leftmargin=*]%
  }{\end{enumerate}}

The option leftmargin=* ensures that the label is aligned with the surrounding text. Note that I also inserted all \renewcommands inside the \newenvironment to make the changes only locally.

MWE:

\documentclass{article}
\usepackage{enumitem}

\newenvironment{packed_enum}{%
  \renewcommand{\labelenumi}{\arabic{enumi}.}%
  \renewcommand{\labelenumii}{\arabic{enumi}.\arabic{enumii}.}%
  \renewcommand{\labelenumiii}{\arabic{enumi}.\arabic{enumii}.\arabic{enumiii}.}%
  \begin{enumerate}[itemsep=1pt,parsep=0pt,leftmargin=*]%
  }{\end{enumerate}}

\begin{document}

\begin{packed_enum}
  \item First level
  \begin{packed_enum}
    \item Second level
    \begin{packed_enum}
      \item Third level
    \end{packed_enum}
  \end{packed_enum}
\end{packed_enum}

\end{document} 

Output:

enter image description here

share|improve this answer

If you're loading the enumitem package, you might as well use the commands it provides for making list-type environments, namely

\newlist{packed_enum}{enumerate}{5}
\setlist[packed_enum]{label*=\arabic*.,leftmargin=*}

Here's a complete MWE that produces the same output as the other answer.

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{enumitem}

\newlist{packed_enum}{enumerate}{5}
\setlist[packed_enum]{label*=\arabic*.,leftmargin=*}

\begin{document}

\begin{packed_enum}
    \item First level
    \begin{packed_enum}
        \item Second level
        \begin{packed_enum}
            \item Third level
        \end{packed_enum}
    \end{packed_enum}
\end{packed_enum}

\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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