6

I've read similar questions, but my problem seems to require a little more sophisticated solution.

I have some notes that I want as my lecture notes and as handouts. These two versions will have a different set of questions and answers. I'm using ExSheets package and tried to change the value of question/print option. (I don't really understand the differences between an option and a property. So at first I assumed that the option is just same as property.)

\documentclass {tufte-book}
\usepackage{exsheets}
\usepackage{ifthen}

\DeclareQuestionClass{user}{users}
\SetupExSheets{use-users={b,t}}
\def \forHandouts {true}

\begin{document}

\ifthenelse{\equal{\forHandouts}{true}} {
  \ForEachQuestion {
    \ifthenelse{\equal {\GetQuestionClass{user}}{t}}{
       \SetQuestionProperties{question/print = false}
       % \SetupExSheets{question/print = false} %this or the above
     }}}
\begin{question}[user=b] blah, blah...
\end{question}
\end{document}
  • If you don't want to print the user class t why don't you change the line \SetupExSheets{use-users={b,t}} into SetupExSheets{use-users={b}}? That's actually the main reason why the “question class” concept exists... – clemens Aug 8 '14 at 21:18
8

You don't need any complicated conditionals. The “question class” concept and the option use-<classes>=... should actually suffice.

If I understand correctly in the handout version you only want to print questions with user=b while in the other version both user=b and user=t may be printed?

Then you can use \SetupExSheets{use-users={b}} in the handout version and \SetupExSheets{use-users={b,t}} in the other one. If you prefer a switch I'd use a simple \newif\ifhandout and make the setup dependent on it's setting:

\documentclass {tufte-book}

\usepackage{exsheets}
\DeclareQuestionClass{user}{users}

% new switch:
\newif\ifhandout

% set the switch:
\handoutfalse
% \handouttrue

\ifhandout
  \SetupExSheets{use-users={b}}
\else
  \SetupExSheets{use-users={b,t}}
\fi

\begin{document}

\begin{question}[user=b]
  I'm in both versions
\end{question}
\begin{question}[user=t]
  I'm not in the handout version
\end{question}

\end{document}

Reading the comments you probably want something else. The following defines a new question/solution pair lecture/lecturesol which has the default option print=false if the handout switch is set to true so the corresponding exercises only are printed in the lecture notes:

\documentclass {tufte-book}

\usepackage{exsheets}
% new switch:
\newif\ifhandout

% set the switch:
\handoutfalse % this is set by default but doesn't hurt to be set explicitly either
% \handouttrue

\ifhandout
  \NewQuSolPair{lecture}[print=false]{lecturesol}
\else
  \NewQuSolPair{lecture}{lecturesol}
\fi

\begin{document}

\section{Exercises}
\begin{question}
  I'm both in the lecture \emph{and} the handout version.
\end{question}
\begin{solution}
  Solution to exercise one.
\end{solution}

\begin{lecture}
  I'm only in the lecture version but not in the handout version.
\end{lecture}
\begin{lecturesol}
  Solution to exercise two.
\end{lecturesol}

\begin{question}
  I'm both in the lecture \emph{and} the handout version.
\end{question}
\begin{solution}
  Solution to exercise three.
\end{solution}

\begin{lecture}
  I'm only in the lecture version but not in the handout version.
\end{lecture}
\begin{lecturesol}
  Solution to exercise four.
\end{lecturesol}

\section{Solutions}
\printsolutions

\end{document}

With \handoutfalse:

enter image description here

With \handouttrue:

enter image description here


Trying to clear up the confusion: »properties« are not the same as options! Options usually are set up with \SetupExSheets or if necessary with the optional argument.

Properties either are set up automatically -- this is only true for some predefined properties like counter, subtitle or question-body -- or must be set explicitly with \SetQuestionProperties in the question body of the corresponding question.

  • That's a good idea. It's simple and works great. And I am sorry now that I didn't explain everything I needed. What I need is to have two or more sets of differently numbered questions (mainly to maintain the same numbers for the both-version questions) and to have questions formatted differently based on the question class. So it's not just discarding some of the questions. – user150246 Aug 9 '14 at 6:18
  • I'm not completely sure: does that mean your question is answered or not? What you need is definitely doable. I can add something to my answer if you want... – clemens Aug 9 '14 at 7:36
  • Actually (now that I've had coffee) differently numbered kinds of questions are not possible with exsheets, sadly... Maybe I can implement that but I'm not sure... – clemens Aug 9 '14 at 8:08
  • it doesn't have to be differently numbered if that's not viable. I just need the questions that are only in the lecture notes and not in the handouts to be not discarded so that the numbers of the problems printed both in handouts and in lecture notes match. Of course, then the problem numbers in handouts will sometimes skip, but that's something I can work with. If you could add this to your answer, that'll be terrific. Sorry for the confusion. – user150246 Aug 9 '14 at 9:24
  • I've edited my answer. – clemens Aug 9 '14 at 9:45

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.