2

I am creating a custom macro for enumerated lists, but with this attempt, I haven't been able to eliminate the indentation of the item numbers. Every time I use \myitemize, the lists still indents.

What am I doing wrong here?

\newenvironment{myitemize}
{ \noindent\begin{enumerate}
    \setlength{\itemsep}{0pt}
    \setlength{\parskip}{0pt}
    \setlength{\parsep}{0pt}     }
{ \end{enumerate}                  } 
7

For jobs like this, use enumitem that provides flexible options. Here is an example.

\documentclass{article}

\usepackage{enumitem}

\newlist{myitemize}{enumerate}{10}
\setlist[myitemize]{label*=\arabic*.,nosep,leftmargin=*}
\begin{document}
Here is some text
\begin{myitemize}
  \item some text
  \item some text
\end{myitemize}
And again some more...
\end{document}

enter image description here

You can adjust the labels for second level by

\setlist[myitemize,2]{label=\alph*),nosep,leftmargin=*}

If label* is used instead of label, we will get 1.a), 1.b) etc.

\documentclass{article}

\usepackage{enumitem}

\newlist{myitemize}{enumerate}{10}
\setlist[myitemize]{label*=\arabic*.,nosep,leftmargin=*}
\setlist[myitemize,2]{label=\alph*),nosep,leftmargin=*}
\begin{document}
Here is some text
\begin{myitemize}
  \item some text
  \begin{myitemize}
  \item some text
  \item some text
\end{myitemize}
  \item some text
\end{myitemize}
And again some more...
\end{document}

enter image description here

  • A couple of questions: (1) Why didn't my macro work? It seems like a simple solution. (2) What do all those things in your commands do ? the 10, \arabic*, nosep, leftmargin=*... – WeCanLearnAnything Aug 16 '15 at 6:04
  • @WeCanLearnAnything: You didn't change leftmargin in your macro. To change it you need to do more work. So it didn't work. Second, \arabic* is the label, nosep means all those spaces (like itemsep, parsep...) are 0pt and leftmargin=* means start from the left most end. See enumitem manual for these details. – user11232 Aug 16 '15 at 6:57
  • @WeCanLearnAnything: BTW, Your macro is not the simple solution, but my method is :) – user11232 Aug 16 '15 at 6:58
  • How might I change this macro so that embedding a myitemize list within a myitemize list results in getting a list of, say, 2. a), b), c), etc.? – WeCanLearnAnything Oct 3 '15 at 20:10
  • @WeCanLearnAnything Please see the update. – user11232 Oct 4 '15 at 0:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.