4

Hi I use enumerate to number items but second item starts before the first one. Because i add more than one number in item, I didnt figure out how to make a space at the begining of an item. Do you know anything that i can fix this?

Here is my code:

\begin{enumerate}
\item[$1)$] First item,
\item[$2-5)$] 2 through 5 items,
\item[$6)$] 6th item. 
\end{enumerate}

enter image description here

2
  • So you want 2 - 5) to be left justified with others?
    – hola
    Jun 30, 2014 at 3:50
  • yes or at least it can be justified with paragraph
    – tevzia
    Jun 30, 2014 at 4:02

3 Answers 3

4

Here abox with a length is defined.

\def\abox#1{\leavevmode\hbox to 1cm{#1 \hfill}}         % left aligned
\def\abox#1{\leavevmode\hbox to 1cm{\hfill #1 \hfill}}  % center ligned

enter image description here

Code

\documentclass{article}

\begin{document}

----- Left aligned

\def\abox#1{\leavevmode\hbox to 1cm{#1 \hfill}}

\begin{enumerate}
\item[\abox{$1)$}] First item,
\item[\abox{$2-5)$}] 2 through 5 items,
\item[\abox{$6)$}] 6th item. 
\end{enumerate}


----- Center aligned


\def\abox#1{\leavevmode\hbox to 1cm{\hfill #1 \hfill}}

\begin{enumerate}
\item[\abox{$1)$}] First item,
\item[\abox{$2-5)$}] 2 through 5 items,
\item[\abox{$6)$}] 6th item. 
\end{enumerate}


\end{document}
4

I'd recommend using the enumitem package the option align=left does the job:

enter image description here

Notes:

  • The border is from the showframe package and shows the page margins. It is not needed in your actual use case.

Code:

\documentclass{article}
\usepackage{showframe}
\usepackage{enumitem}

\begin{document}
\begin{enumerate}[align=left]
    \item[1)] First item,
    \item[2--5)] 2 through 5 items,
    \item[6)] 6th item. 
\end{enumerate}
\end{document}
2
  • Your value makes the label begin in the left margin of the text (very slightly: ~ 2pt) as one may check with GSView or the latest versions of SumatraPDF. 2.28em would be a better value, but then the text of the items is not well aligned.
    – Bernard
    Jun 30, 2014 at 8:20
  • @Bernard: Thanks for pointing that out. I have revised the solution so that the text does not go into the page margins. Jul 28, 2014 at 16:12
1

A variant of the preceding solution that ensures both text of the items being aligned, and labels being left aligned on the ambient left margin (or at a \parindent distance if you wish), and a minimally computed label width:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier}
\usepackage[shortlabels]{enumitem}

\parindent = 1em

\begin{document}

Text text text text text text text text text text text text text text text text text text text text text text text text text text text.
\begin{enumerate}[ $ 1) $,align=left, widest = $ 2--5) $,labelsep* = 0.5em, leftmargin = *]
    \item First item,
    \item[$2-5)$] \setcounter{enumi}{5} $ 2 $ through $ 5 $ items,
    \item 6th item.
\end{enumerate}

\textbf{With a label indent:}

Text text text text text text text text text text text text text text text text text text text text text text text text text text text.
\begin{enumerate}[ $ 1) $,align=left, widest = $ 2--5) $,labelindent = \parindent, labelsep* = 0.5em, leftmargin = *]
    \item First item,
    \item[$2-5)$] \setcounter{enumi}{5} $ 2 $ through $ 5 $ items,
    \item 6th item.
\end{enumerate}

\end{document} 

enter image description here

You must log in to answer this question.

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