1

I want to achieve this simple list via overleaf.

1. xxx
2. xxx
3. xxx
  (a) First line,
  (b) xxxxx
  (c) xxxx
4. xxx

And below is my code now, I am new in latex. I stuck here and don't know how to fix the problem.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}

\title{Computer Security HW1}
\author{Student Name: Chen-I Chang }
\date{09/13 2018}

\begin{document}

\maketitle

\section{}
\section{}
\section{}
\begin{enumerate}[(a)]
\item an apple
\item a banana
\item a carrot
\item a durian
\end{enumerate}
\section{}
\end{document}

The console threw the error.

something wrong perhaps missing item

4
  • The optional argument in \begin{enumerate}[(a)] is not defined in standard LaTeX.
    – Bernard
    Commented Sep 9, 2018 at 19:40
  • I got the same error if I replace it into \begin{enumerate}[label=(\Alph*)], refer to this answer tex.stackexchange.com/questions/129951/…
    – rj487
    Commented Sep 9, 2018 at 19:46
  • You need to load \usepackage{enumitem}. This is what @Bernard says
    – koleygr
    Commented Sep 9, 2018 at 19:54
  • I understand! You can answer that, I will choose it as the answer!
    – rj487
    Commented Sep 9, 2018 at 19:57

1 Answer 1

5

As Bernard mentioned, \begin{enumerate}[(a)] is not a standard \LaTeX environment. Optional arguments about the label of enumeration is offered by enumitem package.

So this will do the job:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{enumitem}

\title{Computer Security HW1}
\author{Student Name: Chen-I Chang }
\date{09/13 2018}

\begin{document}

\maketitle

\section{}
\section{}
\section{}
\begin{enumerate}[label={(\alph*)}]
\item an apple
\item a banana
\item a carrot
\item a durian
\end{enumerate}
\section{}
\end{document}

enter image description here

Note that loading enumitem with the shortlabels option allows for the same syntax as the enumerate package, i.e.

\begin{enumerate[(a)]
4
  • @Bernard Please write an answer as a better in knowledge member because I don't really know so much (and so doesn't know how to write about it). I will delete my answer and read yours to learn something new
    – koleygr
    Commented Sep 9, 2018 at 20:23
  • Not at all, keep your answer. I can complete it (it is fine anyway) – just to give as much information as possible, t and delete my comment, if you want to.
    – Bernard
    Commented Sep 9, 2018 at 20:32
  • No, Please keep your comment and add your name in the edit
    – koleygr
    Commented Sep 9, 2018 at 20:35
  • @Bernard I am pinging you
    – koleygr
    Commented Sep 9, 2018 at 20:42

You must log in to answer this question.

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