# Detecting the mode of the exercise package [closed]

I am trying to detect whether the exercise package's option noanswer is on, with the intention of not displaying parts in either mode.

Here is my mwe:

\documentclass{minimal}
\usepackage[noaswer]{exercise}

\newif\ifpaper
\newif\ifmemo
\paperfalse
\memofalse

\makeatletter%
\papertrue%
}{%
\memotrue%
}%
\makeatother%

\begin{document}
\ifpaper
paper
\fi

\ifmemo
memo
\fi

\end{document}


With this I always get memo, whether noanswer is provided or not.

1. Is there something I'm missing?
2. Or there another approach to ensure the correct detection?
-

## closed as too localized by Matthew Leingang, Kurt, Claudio Fiandrino, Torbjørn T., XavierMay 15 '13 at 14:12

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

Does changing \@ifpackagewith{excercise}{noanswer} to \@ifpackagewith{exercise}{noanswer} help? –  Matthew Leingang May 15 '13 at 12:50
Yes it does! I don't know why I did not check for something as simple as that! –  Louis May 15 '13 at 12:53
Glad it helps. I'm voting to close the question as Too Localized since it's not likely to come up again. –  Matthew Leingang May 15 '13 at 12:56

Package exercise knows several options that disable the answers: noanswer, exerciseonly; and outputnothing also disables exercise output. Internally the packages uses switches: \if@AnswerOutput for answers and \if@ExerciseOutput for exercises. Thus the first switch provides an alternative to checking the option using \@ifpackagewith:

\documentclass{minimal}

\newif\ifpaper
\newif\ifmemo
\paperfalse
\memofalse

\makeatletter
\memotrue
\else
\papertrue
\fi
\makeatother

\begin{document}
\ifpaper
paper
\fi

\ifmemo
memo
\fi

\end{document}

-
Thanks for your answer, I will definitely use it. The original problem was as @Matthew Leingang pointed out a simple typo! –  Louis May 15 '13 at 14:16