Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

Instead of

Exercise 1

Exercise 2

...

share|improve this question
    
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
2  
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

2 Answers 2

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:

enter image description here

share|improve this answer

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}


share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.