1

I want to re-number the exercises below by changing the number 1. by 9., the number 2. by 12. and the number 3. by 15. How should I proceed?

\documentclass{article}

\usepackage[brazil]{babel}
\usepackage[utf8]{inputenc}
%\UseRawInputEncoding
\usepackage[T1]{fontenc}
\usepackage{Sweave}
\usepackage[fixlanguage]{babelbib}
%\usepackage[pdftex]{color}
\usepackage{dsfont}
\usepackage{esvect}
\usepackage[labelfont=bf]{caption}
\usepackage{float}
\usepackage{tasks}
\usepackage{color, colortbl}
\usepackage{xcolor}
\colorlet{lightcyan}{cyan!40!white}
\usepackage{chngcntr}
\usepackage{stackengine}
\usepackage{ragged2e}%para justificar o texto dentro de algum ambiente
\definecolor{Gray}{gray}{0.9}
\definecolor{LightCyan}{rgb}{0.88,1,1}

\newlength{\longestlabel}
\settowidth{\longestlabel}{\bfseries viii.}

\setcounter{secnumdepth}{0} \setlength{\topmargin}{0cm}
\setlength{\headsep}{-0.3cm} \setlength{\textwidth}{17.5cm}
\setlength{\textheight}{23cm} \setlength{\oddsidemargin}{-0.8cm}
\setlength{\evensidemargin}{0cm} \setlength{\footskip}{-1.5cm}

\usepackage[lastexercise,answerdelayed]{exercise}
\renewcommand{\ExerciseName}{Exercícios}
\renewcommand{\ExerciseHeader}{\noindent\def\stackalignment{l}% code from https://tex.stackexchange.com/a/195118/101651
    \stackunder[0pt]{\colorbox{cyan}{\textcolor{white}{\textbf{\large\ExerciseName}}}}{\textcolor{lightcyan}{\rule{\linewidth}{2pt}}}\medskip}

\begin{document}



\vspace*{-2cm}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\medskip

\begin{center}

\underline{\underline{{\large{\sc Soluções da Lista}}}}

\bigskip

{\large {\bf Prof. xxxxxx}}
%\bigskip
%
%%{\sc Data: $19/06/2018$}
\end{center}

\begin{Exercise}

\Question O fabricante de certa...

\Question A duração das lâmpadas produzidas por...

\Question O custo de produção de certo artigo...

\end{Exercise}

\end{document}
3
2

You can create the own ManualExercise enviroment:

enter image description here

\documentclass{article}

\usepackage[lastexercise,answerdelayed]{exercise}
\renewcommand{\ExerciseName}{Exercises}
\renewcommand{\ExerciseHeader}{Exercises}

% Partial code taken from http://mirrors.ctan.org/macros/latex/contrib/exercise/exercise.dtx
\newenvironment{ManualExercise}
  {\begin{list}{}{\leftmargin \QuestionIndent
    \partopsep0pt \parsep\parskip \topsep\QuestionBefore
    \itemsep\QuestionBefore \labelwidth2em
    \labelsep.33em
    \usecounter{Question}}}
  {\end{list}}

\begin{document}

\begin{Exercise}
  \Question Lorem ipsum \ldots
  \Question Lorem ipsum \ldots
  \Question Lorem ipsum \ldots
\end{Exercise}

\begin{Exercise}
  \begin{ManualExercise}
    \item[9.~] Lorem ipsum \ldots
    \item[12.~] Lorem ipsum \ldots
    \item[15.~] Lorem ipsum \ldots
  \end{ManualExercise}
\end{Exercise}

\end{document}

The reason for this is that the Exercise environment created by exercise sets up a regular list but checks whether it's the first \Question or a subsequent \Question in the list. Based on this conditioning, it's far easier to create your own rather than update the list to accommodate your requirement.

The list parameters is the same as that of the Exercise environment, taken from exercise.dtx.

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.