4

How can I align the left hand side of both the enumerate and the itemize environments to be the same?

That is, I want to set the lengths such that the blue vertical line and the red vertical line in the pic below will be the same.

enter image description here

MWE:

% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode

\documentclass{article}

\usepackage[utf8]{inputenc}
\setlength{\parindent}{0pt}

\usepackage{enumitem}
  \setlist[itemize]{wide,labelindent=0pt,listparindent=0pt,leftmargin=*}
  \setlist[enumerate]{wide,labelindent=0pt,listparindent=0pt,label = \alph*.,leftmargin=*}

\begin{document}

\section{First section}

Your text goes here.

\begin{itemize}
\item Nisl pretium fusce id velit ut tortor pretium. Sodales neque sodales ut etiam sit amet nisl purus. Odio ut enim blandit volutpat maecenas volutpat. Malesuada fames ac turpis egestas integer eget aliquet nibh praesent.

Ornare aenean euismod elementum nisi quis. At volutpat diam ut venenatis tellus.
\item Blandit turpis cursus in hac habitasse platea. Dolor sit amet consectetur adipiscing elit duis tristique sollicitudin nibh. Non sodales neque sodales ut etiam sit amet nisl.
\end{itemize}

\begin{enumerate}
\item Phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet.
\item Elit duis tristique sollicitudin nibh sit amet.

Aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque. Id diam maecenas ultricies mi eget mauris. Faucibus scelerisque eleifend donec pretium vulputate sapien.
\end{enumerate}

\end{document}
4
  • Is there a reason why you used additional options in the enumerate list? Any solution would break down if you do that.
    – schtandard
    Sep 18, 2022 at 14:46
  • @schtandard Sorry, I don't understand what you mean by "additional options". Do you mean that I "over defined" some settings?
    – tush
    Sep 19, 2022 at 8:24
  • I mean the options after \begin{enumerate}.
    – schtandard
    Sep 19, 2022 at 10:01
  • Thats right, I didn't notice it.
    – tush
    Sep 19, 2022 at 13:20

2 Answers 2

5

Here's a way to do it:

    \documentclass{article}

    \setlength{\parindent}{0pt}

    \usepackage{enumitem}
      \setlist[itemize]{wide=0pt, labelsep=1.6em, listparindent=0pt,leftmargin=*}%,labelindent
      \setlist[enumerate]{wide=0pt, labelsep=-0.5em ,listparindent=0pt,label = \alph*.,leftmargin=*}%,labelindent

    \begin{document}

    \section{First section}

    Your text goes here.

    \begin{itemize}
    \item Nisl pretium fusce id velit ut tortor pretium. Sodales neque sodales ut etiam sit amet nisl purus. Odio ut enim blandit volutpat maecenas volutpat. Malesuada fames ac turpis egestas integer eget aliquet nibh praesent.

    Ornare aenean euismod elementum nisi quis. At volutpat diam ut venenatis tellus.
    \item Blandit turpis cursus in hac habitasse platea. Dolor sit amet consectetur adipiscing elit duis tristique sollicitudin nibh. Non sodales neque sodales ut etiam sit amet nisl.
    \end{itemize}

    \begin{enumerate}[align=left,labelwidth=\parindent,labelsep=10pt]
    \item Phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet.
    \item Elit duis tristique sollicitudin nibh sit amet.

    Aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque. Id diam maecenas ultricies mi eget mauris. Faucibus scelerisque eleifend donec pretium vulputate sapien.
    \end{enumerate}

    \end{document} 

enter image description here

5

I believe you should set the parameter leftmargin to the same width -- e.g., 15pt -- for both envrironments.

enter image description here

% !TEX TS-program = pdflatex
% !TEX encoding = UTF-8 Unicode

\documentclass{article}
%% \usepackage[utf8]{inputenc} % that's the default nowadays
\setlength{\parindent}{0pt}

\usepackage{enumitem}
\setlist[itemize]{leftmargin=15pt}
\setlist[enumerate]{leftmargin=15pt, label=\alph*.}

\begin{document}

\section{First section}

Your text goes here.

\begin{itemize}
\item Nisl pretium fusce id velit ut tortor pretium. Sodales neque sodales ut etiam sit amet nisl purus. Odio ut enim blandit volutpat maecenas volutpat. Malesuada fames ac turpis egestas integer eget aliquet nibh praesent.

Ornare aenean euismod elementum nisi quis. At volutpat diam ut venenatis tellus.
\item Blandit turpis cursus in hac habitasse platea. Dolor sit amet consectetur adipiscing elit duis tristique sollicitudin nibh. Non sodales neque sodales ut etiam sit amet nisl.
\end{itemize}

\begin{enumerate}
\item Phasellus vestibulum lorem sed risus ultricies tristique nulla aliquet.
\item Elit duis tristique sollicitudin nibh sit amet.

Aenean vel elit scelerisque mauris pellentesque pulvinar pellentesque. Id diam maecenas ultricies mi eget mauris. Faucibus scelerisque eleifend donec pretium vulputate sapien.
\end{enumerate}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .