TransWikia.com

Aligning enumerate environments

TeX - LaTeX Asked on January 15, 2021

I have two enumerate environments. In the MWE, the numbers in the second environment are seemingly right-aligned with the numbers in the first, I would like to left-align the numbers in the second environment with those in the first.

The third environment should also be left-aligned with the first two environments. The fourth environment should continue to display as expected.

MWE

documentclass{book}
usepackage[inline,shortlabels]{enumitem}
setlist[enumerate]{leftmargin=4em, align=left}
begin{document}
begin{enumerate}
    item Item 1
    item Item 2
    item Item 3
end{enumerate}
begin{enumerate}[label=1.arabic*.]
        item Item 1.1
        item 1.2
    end{enumerate}
begin{itemize}
    item Item 10
    item Item 20
end{itemize}
begin{enumerate*}[label=(roman*)]
    item Item 100
    item item 200
end{enumerate*}
end{document}

2 Answers

See if adding

setlist[enumerate]{leftmargin=4em, align=left}

in your document preamble solve your problem.

enter image description here

Complete MWE:

documentclass{book}
usepackage{enumitem}
setlist[enumerate]{leftmargin=4em, align=left}

usepackage{lipsum}

begin{document}
lipsum[11]
begin{enumerate}
    item Item 1
    item Item 2
    item Item 3
end{enumerate}
begin{enumerate}[label=1.arabic*.]
        item Item 1.1
        item Item 1.2
    end{enumerate}
end{document}

Addendum:

After your editing of question situation is changed a lot. Note: enumitem doesn't allow separate settings for in-line lists (as far as I know), however in such situation it advise to define new list with desired features. For example, as:

newlist{inlinelist}{enumerate*}{1}
setlist*[inlinelist,1]{label=(roman*), 
                        before=unskip{: }, itemjoin={{, }}, itemjoin*={{, and }}}

Considering this in the first version of answer, you can write your document example as follows:

documentclass{book}
usepackage[shortlabels]{enumitem}
setlist[enumerate]{leftmargin=4em, align=left}
newlist{inlinelist}{enumerate*}{1}
setlist*[inlinelist,1]{label=(roman*),
                        before=unskip{: }, itemjoin={{, }}, itemjoin*={{, and }}}
usepackage{lipsum}

begin{document}
lipsum[11]

begin{enumerate}
    item Item 1
    item Item 2
    item Item 3: 
end{enumerate}
begin{enumerate}[label=1.arabic*.]
        item Item 1.1
        item Item 1.2
    end{enumerate}

noindent%   
Some text 
begin{inlinelist}[label=(roman*)]
    item Item 100
    item item 200
    item item 300
end{inlinelist}.
end{document}

which yields to:

enter image description here

Correct answer by Zarko on January 15, 2021

enter image description here

documentclass{book}
usepackage{enumitem}
begin{document}
begin{enumerate}[
                leftmargin=parindent,
                align=left,
                labelwidth=parindent,
                labelsep=10pt]
    item Item 1
    item Item 2
    item Item 3
end{enumerate}
begin{enumerate}[
                label=1.arabic*.,
                leftmargin=parindent,
                align=left,
                labelwidth=parindent,
                labelsep=10pt]
        item Item 1.1
        item Item 1.2
    end{enumerate}
end{document}

Answered by js bibra on January 15, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP