Feature Tracker
I’m currently working on a major new version of the datatool package. This may take a while. Please be patient. (Experimental version available for testing.)
ID | 51🔗 |
---|---|
Date: | 2021-03-03 17:46:33 |
Status | Open Sign in if you want to like this report. |
Category | probsoln |
Summary | Provisions for a default problem |
Sign in to subscribe to notifications about this report.
Description
Modification to make\useproblem
fallback on a default label if the supplied one isn't defined.
\documentclass{article} \usepackage{probsoln} \usepackage{substr} %% modify probsoln to allow the use of a default problem label \makeatletter \newcommand*{\defproblabel}{} \renewcommand{\useproblem}[2][default]{% \def\@prob@currentlabel{#2}% \def\prob@currentdb{#1}% \prob@showdraftlabel{#1}{#2}% \@add@used@problem{#2}{#1}% \let\@useprob@next=\relax %% undefined label? \@ifundefined{prob@data@#1@#2}% {% %% is a default problem label defined? %% if so, use it, otherwise throw an error message \@ifundefined{prob@data@#1@\defproblabel}% {\PackageError{probsoln}% {Problem \defproblabel and Problem ‘#2’ are not defined in data set ‘#1’}{}% }% {% \def\@useprob@next{\csname prob@data@#1@\defproblabel\endcsname}% }% }% {% \def\@useprob@next{\csname prob@data@#1@#2\endcsname}% }% \@useprob@next } \makeatother %% exercises \begin{defproblem}{exercises} \item This is exercise 1 on the topic. \item This is exercise 2 on the topic. \end{defproblem} %% exam questions \begin{defproblem}{exam-topic1-default} This is the default question for topic 1 on any exam. \end{defproblem} \begin{defproblem}{exam-topic1-A} This is the question for topic 1 for exam A. \end{defproblem} \begin{defproblem}{exam-topic1-B} This is the question for topic 1 on exam B. \end{defproblem} %% document \begin{document} Show the exercises for this topic here. \begin{enumerate} \foreachproblem{% \IfSubStringInString{exercises}{\thisproblemlabel} {\thisproblem} {\relax} } \end{enumerate} Show how this topic is tested across four different exams. \renewcommand*{\defproblabel}{exam-topic1-default} \begin{enumerate} \item Exam A \useproblem{exam-topic1-A} \item Exam B \useproblem{exam-topic1-B} \item Exam C \useproblem{exam-topic1-C} \item Exam D \useproblem{exam-topic1-D} \end{enumerate} \end{document}I use a command
\newcommand{\theSet}{A}
in the preamble. I can substitute \useproblem{exam-topic1-\theSet}
to make different versions of the exam. In this way, I need to only make a DEFAULT problem. It will be used automatically regardless of the letter designation for \theSet
.
MWE
No mwe.tex
Evaluation
Comments
0 comments.
Add Comment
Page permalink: https://www.dickimaw-books.com/featuretracker.php?key=51