Make enumeration label and text both flush left

enumitem

Using the enumitem package, I'd like to get list formatting that looks like this:
enter image description here
That is, I want top-level enumeration items as well as top-level text to be at the left margin along with the top-level enumeration label, and no newline if the item starts with a second-level enumeration. The closest I've managed to come is this:

\setlist[enumerate]{left=0pt .. \parindent}
\setlist[enumerate,1]{label={\bfseries{\arabic{section}.\arabic{enumi}.}}}
\setlist[enumerate,2]{label=(\alph{enumii})}
\setlist[enumerate,3]{label=(\roman{enumiii})}

which still sets the text of the item to the right of the label. Is there an easy way to do this?

Best Answer

enumitem's wide=0pt is what you're looking for here, together with a second-level enumerate set to align=left:

enter image description here

\documentclass{article}

\usepackage{enumitem,amsmath}

\setlist[enumerate,1]{label={\bfseries\arabic{section}.\arabic*.},wide=0pt}
\setlist[enumerate,2]{label=(\alph*),align=left}
\setlist[enumerate,3]{label=(\roman*)}

\begin{document}

\section{A section}

\begin{enumerate}
  \item
  \begin{enumerate}
    \item
    We compute as follows:
    \begin{align*}
      (xz \pm nyw)^2 + n (xw \mp yz)^2 &= x^2 z^2 \pm 2 nxyzw + n^2 y^2 w^2 + n x^2 w^2 \mp 2 nxwyz + n y^2 z^2 \\
                                       &= x^2 z^2 + n^2 y^2 w^2 + n x^2 w^2 + n y^2 z^2                         \\
           (x^2 + n y^2) (z^2 + n w^2) &= x^2 z^2 + n x^2 w^2 + n y^2 z^2 + n^2 y^2 w^2
    \end{align*}
    Hence, the right-hand sides are equal, proving (1.6).
    
    \item
    $(a x^2 + c y^2) (a z^2 + c w^2) = (axz \pm cyw)^2 + ac (xw \mp yz)^2$.
  \end{enumerate}
  
  \item This exercise forms part of an \verb|enumerate| and wraps around to the second line of text.
  \begin{enumerate}
    \item
    Item~1
    
    \item
    Item~2
    \begin{enumerate}
      \item
      What is the indentation?
    \end{enumerate}
  \end{enumerate}
\end{enumerate}

\end{document}