[Tex/LaTex] Left-aligning nested labels in enumerate

#enumerateenumitemhorizontal alignment

I'm trying to tweak the way nested lists appear for enumerate. Right now, using enumitem package, I've got something like this:

\documentclass{article}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}[label*=\arabic*.,leftmargin=0pt]
  \item First
  \begin{enumerate}[label*=\arabic*.,leftmargin=0pt]
    \item Second
    \begin{enumerate}[label*=\arabic*.,leftmargin=0pt]
      \item Third
    \end{enumerate}
  \end{enumerate}
  \item Fourth
\end{enumerate}

\end{document}

The above creates a list like:

    1. First
  1.1. Second
1.1.1. Third
    2. Fourth

And I'd like it to look like:

1.     First
1.1.   Second
1.1.1. Third
2.     Fourth

This will be an extremely long 'list,' as it is actually a procedure, and could contain hundreds of steps with varying substeps. This is really the one thing I can't seem to figure out for my needs. I believe I can do it with trial/error by customizing varying alignments using \SetLabelAlign, but if there's an easier/simpler way – that would be wonderful.

Also, if there's a better way in general to do what I want, (step numbering with nested steps from # to #.#.#.) I'm all ears.

Best Answer

Try setting your own alignment to something that contains the enumeration in a fixed-width box. This way you can specify the location to suit your needs:

enter image description here

\documentclass{article}
\usepackage{enumitem}
\SetLabelAlign{fixedwidth}{\hss\llap{\makebox[2.5em][l]{#1}}}
\setlist[enumerate]{label*=\arabic*.,leftmargin=0pt,align=fixedwidth}

\begin{document}

\noindent Some text before.

\begin{enumerate}
  \item First
  \begin{enumerate}
    \item Second
    \begin{enumerate}
      \item Third
    \end{enumerate}
  \end{enumerate}
  \item Fourth
\end{enumerate}

\noindent Some text after.

\end{document}