4

I have been using a good command to enumerate my exercise list's. But now I would like the exercise number appeared in the enumeration list in addition with hyperref command. How could to do this? Is it possible? Thanks a lot.

enter image description here

Here is a minimum example.

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


\newcounter{theeq} \setcounter{theeq}{0}
\newcommand{\eq}{ 
    \

    \noindent 
    \refstepcounter{theeq}\textbf{\arabic{theeq}}. }


\begin{document}

\eq {\label{eq1}} Let $f: \mathbb{R} \to \mathbb{R}$ a function
\begin{enumerate}[$(\ref{eq1}. \ a)$, leftmargin=3.0em]
    \item {\label{eq1a}} Prove that...
    \item Next ...
\end{enumerate}

\eq XXXX
\begin{enumerate}[$(a)$, leftmargin=3.0em]
    \item Prove that...
    \item Next ...
\end{enumerate}

\eq Consider in exercise \ref{eq1a} bla bla bla.

\end{document}
3

Nesting levels is what lists do best. (Not just a crutch for the counting impaired.)

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

\setlist[enumerate,2]{label = (\theenumi.\alph*),ref = (\theenumi.\alph*)}

\begin{document}

\begin{enumerate}
\item Let $f: \mathbb{R} \to \mathbb{R}$ a function
\begin{enumerate}
    \item \label{eq1a}Prove that...
    \item Next ...
\end{enumerate}

\item XXXX
\begin{enumerate}
    \item Prove that...
    \item Next ...
\end{enumerate}

\item Consider in exercise \ref{eq1a} bla bla bla.
\end{enumerate}

\end{document}

demo


This version creates a new list for exercises.

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

\newlist{exercise}{enumerate}{2}
\setlist[exercise,1]{label = \arabic*.,ref = \arabic*)}
\setlist[exercise,2]{label = (\arabic{exercisei}.\alph*),ref = (\arabic{exercisei}.\alph*)}

\begin{document}

\begin{exercise}
\item Let $f: \mathbb{R} \to \mathbb{R}$ a function
\begin{exercise}
    \item \label{eq1a}Prove that...
    \item Next ...
\end{exercise}

\item XXXX
\begin{exercise}
    \item Prove that...
    \item Next ...
\end{exercise}

\item Consider in exercise \ref{eq1a} bla bla bla.
\end{exercise}

\begin{enumerate}
\item Normal enumerate
\begin{enumerate}
\item Second level
\end{enumerate}
\end{enumerate}

\end{document}

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.