5

(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}
5

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} 

enter image description here

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. – Bernard Feb 2 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. – Moura Feb 3 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? – Bernard Feb 3 at 18:45
  • Bernard the first command was: – Moura Feb 3 at 20:30
  • 1
    @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 – Bernard Feb 3 at 21:12
6

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}

enter image description here

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

This site is temporarily in read only mode and not accepting new answers.

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