# Start enumerating an item in the same line after a exercise number

(I´m sorry my English mistakes) I have been using a good command for enumerate exercises. It was suggest here for someone (thanks again).

Is it possible to use this command to enumerate exercises together with the \begin{enumerate][??] command´s but that the item starts immediately after the enumeration in the same line? Because the item stars in another line.

For example, I would like this:

1. (a)

(b)

(c)

Thank you.

Here is my Latex commands

\documentclass[a4paper,brazil, 12pt]{report}%{\article}
\usepackage{amsmath,amsfonts,amscd,bezier}
\usepackage{amssymb}
\usepackage{babel}
\usepackage[latin1]{inputenc}
\usepackage[dvips]{graphicx}
\usepackage{color}
\usepackage{hyperref}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\usepackage{tasks}

\newcounter{theeq} \setcounter{theeq}{0}
\newcommand{\eq}[1]{\noindent%
\refstepcounter{theeq}\textbf{\arabic{theeq}} {\hspace{-0.1cm{{.}}}} }
\newcommand{\eqz}{{\setcounter{eq}{1}} {{\arabic{eq}}} \refstepcounter{eq}\hspace{-0.1cm{{.}}}}

\begin{document}

\eq. \begin{enumerate}[$(a)$]
\item Prove that...
\item Next ...
\end{enumerate}

\end{document}

• take a look to the exam class Feb 2 '19 at 15:31

## 2 Answers

Hereis a solution which plays with leftmargin= and before= keys:

\documentclass[a4paper,brazil, 12pt]{report}%
\usepackage{amsmath, amsfonts, amscd, bezier}%
\usepackage{amssymb}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{color}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\usepackage{tasks}
\usepackage{hyperref}
\newcounter{theeq} \setcounter{theeq}{0}
\newcommand{\eq}[1]{\noindent%
\refstepcounter{theeq}\textbf{\arabic{theeq}} {\hspace{-0.1cm{{.}}}} }
\newcommand{\eqz}{{\setcounter{eq}{1}} {{\arabic{eq}}} \refstepcounter{eq}\hspace{-0.1cm{{.}}}}

\begin{document}

\eq. \begin{enumerate}[$(a)$, leftmargin=3.2em, before=\vspace*{-\glueexpr\topsep + \baselineskip}]
\item Prove that...
\item Next ...
\end{enumerate}

\end{document}


Edit:

Another possibility would be to define your own enumerate-like list, like this:

\newlist{enumexp}{enumerate}{1}
\setlist[enumexp,1]{$(a)$, leftmargin=3.2em, before=\vspace*{-\glueexpr\topsep + \baselineskip}}


and code in the document body:

\eq. =\begin{enumexp}
\item ...
.........
\end{enumpexp}

• @Circumscribe: I'm not very familiar with glue expressions, so I didn't even think of it. Thanks for the tip! I've changed the code accordingly. Feb 2 '19 at 22:03
• for me your last command does´t work. When I was trying use it the following message appeared: File ended while scanning use of \@argdef. Feb 3 '19 at 18:38
• Which last command? before= ... in the optional arguments of enumerate? Maybe you've forgotten a closing delimiter. Could you post a minimal code reproducing the prob!em? Feb 3 '19 at 18:45
• Bernard the first command was: Feb 3 '19 at 20:30
• @Moura: The error comes from using a number in the command name. If you call it \BegEnumExpii, it works. However I suggest defining a new enumerate-like list. Please see the edit in my answer Feb 3 '19 at 21:12

You can create a new list, say eq, with the resume option for doing this.

\documentclass[a4paper,brazil, 12pt]{report}%{\article}
\usepackage{amsmath,amsfonts,amscd,bezier}
\usepackage{amssymb}
\usepackage{babel}
\usepackage[latin1]{inputenc}
\usepackage[dvips]{graphicx}
\usepackage{color}
\usepackage{hyperref}
\usepackage[shortlabels]{enumitem}
\usepackage{multicol}
\usepackage{tasks}

\newlist{eq}{enumerate}{1}
\setlist[eq]{resume,label={\arabic*.}}%

\begin{document}

\begin{eq}\item
\begin{enumerate}[$(a)$]
\item Prove that...
\item Next ...
\item
\end{enumerate}
\end{eq}

\begin{eq}\item
\begin{enumerate}[$(a)$]
\item Prove that...
\item Next ...
\item
\end{enumerate}
\end{eq}

\end{document}


• Very nice answer! We can also put the two enumerate lists within the same eq list. Feb 2 '19 at 15:47
• I agree with the indication given in the previous comment. Feb 2 '19 at 16:49
• @AboAmmar is it possible to use the \noindent command together? Thaks for your beautiful answer Feb 2 '19 at 16:50
• Yes, just add leftmargin=* to the options in \setlist[eq]{resume, label={\arabic*.}, leftmargin=*}. Feb 2 '19 at 17:00