# How to change exercise numbers?

I am looking for simple code that simply makes me change the exercise numbers instead of the usual ordering "1, 2, 3, 4,....\$

For example, I am doing a homework involving exercises 1, 5 and then 1, 2. I would like it to show

Exercise 1

Exercise 5

Exercise 1

Exercise 2

Exercise 1

Exercise 2

...

-
Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Jubobs Sep 2 '13 at 18:40
Can you provide a little more detail? How do you want to enter the numbers? What do you wish to gain over numbering the exercises manually? – Ian Thompson Sep 2 '13 at 18:40

I suppose you are using exercise package? If so, you can change the numbering manually by using \setcounter command. For example:

\documentclass{article}
\usepackage{exercise}

\begin{document}

\begin{Exercise}
Something
\end{Exercise}

\setcounter{Exercise}{4}

\begin{Exercise}
something else
\end{Exercise}

\setcounter{Exercise}{0}

\begin{Exercise}
some other thing
\end{Exercise}

\begin{Exercise}
and so on.
\end{Exercise}

\end{document}


gives us:

-

Latex numbering is set to automatically increase the counter sequentially, unless you specifically tell it to. So, if you want numbers to occur out of sequential number, you will have to manually reset the counter yourself.

The solution by Francis is the way to do this by using the exercise package. Another way of achieving this is to manually define a command that does this for you.

\documentclass{article}
\newcommand{\exercise}[1]{\noindent {\bf Exercise #1.}}
\begin{document}

\exercise{1} This is the first.

\exercise{3} This is the third.

\exercise{2} This is the second.
\end{document}

-