# Using \ExerciseSelect (and friends) command of the exercise package

In the documentation says:

"The purpose of these commands is to select exercises within a long list stored on an auxiliary file."

But I don't know how to tell the package which is the external file to look in. Can you please post a MWE to see hot to use this feature?

-
The auxiliary file is to be included with standard latex commands like \input, as I understand it. –  T. Verron Nov 25 '12 at 18:51
@T.Verron But input causes the auxiliary file to be typeset. Doesn't? –  leo Nov 25 '12 at 18:53
Yes, and these \ExerciseSelect-like commands are designed to filter which exercises are to be typeset, and which are to be left out. –  T. Verron Nov 25 '12 at 18:56
@T.Verron I understand. Can you post your comments as an answer in order to move out this to the unanswered list? –  leo Nov 25 '12 at 18:58
I can't at the moment, but I'll do that in about an hour (if nobody does it before). –  T. Verron Nov 25 '12 at 18:59

These commands select which exercises are to be printed, amongst those that are provided later in the file. I think what the author of the package meant with this sentence is that they can prove useful if you want to have all your exercises in one external file, and select which you want to print from that chapter. I tried to build an example below.

## Example : the main file

\documentclass{article}

\usepackage{exercise}

\begin{document}

Here are some short exercises :

\ExerciseSelect[type={short}]

\begin{Exercise}[type={short}]
Prove that $1+1=2$.
\end{Exercise}

\input{exos.tex}

\ExerciseStopSelect

\vspace{1cm}\hrule\vspace{1cm}

And now a longer exercise :

\ExerciseSelect[type={long}]
\input{exos.tex}
\ExerciseStopSelect

\end{document}


## Example : the file exos.tex

\begin{Exercise}[type={short}]
Prove that if $a=b$ and $b=c$ then $a=c$.
\end{Exercise}

\begin{Exercise}[type={long}]
Prove that $P \neq NP$.
\end{Exercise}


-