4

I'm using the exam class with the probsoln package to make quizzes with a random subset of the material students should know. If I do something like this:

\documentclass[12pt,addpoints]{exam}
\usepackage{probsoln}

\begin{document}


        \header{English 213}{Quiz on vocab lists 1--2}{Fall 2017}


    \loadrandomproblems{5}{prob_set_1.tex}
    \loadrandomproblems{5}{prob_set_2.tex}


    \begin{questions}
    \foreachproblem{\question[1]\thisproblem\dotfill}
    \end{questions}

\end{document}

I get five random problems from problem set 1, followed by five random problems from problem set 2. Is there a way to randomize the question order for both sets of problems, so the problems from lists 1 and 2 are all mixed together?

I did try

\loadrandomproblems{10}{prob_set_1.tex,prob_set_2.tex}

but that produced an error.

  • You might try globbing (such as prob_set_*.tex). If that doesn't work, you will probably have to merge the files. On Linux/Unix, you could do this using a shell command: \immediatewrite18 cat prob_set_*.tex > /tmp/problems.tex and then \loadrandomproblems{10}{/tmp/problems.tex}. You need to run Tex with the --shell-escape option for this to work. – Michael Palmer Jul 9 '17 at 13:55
  • @MichaelPalmer What if I had three problem sets and only wanted to use two of them? That's just a merging situation, right? – crmdgn Jul 9 '17 at 14:00
  • In that case, you would have name both files explicitly: cat a.tex b.tex > merged.tex. The idea is simply that cat can merge any number of files into a single one, which gets you around the limitation of the \loadrandomproblems command. But it might be good to ask the package author, Nicola Talbot, whether the capacity to load multiple files could be built into the package itself. – Michael Palmer Jul 9 '17 at 14:23
  • This could be adapted, possibly: tex.stackexchange.com/questions/296125/… – John Kormylo Jul 9 '17 at 15:30
  • I'll see if I can modify the code to allow a comma-separated list. Another possibility you might want to consider is to convert from probsoln to datatool (via datatooltk). That will give you more flexibility. See Using the datatool Package for Exams or Assignment Sheets – Nicola Talbot Jul 10 '17 at 9:52
4

As from v3.05 (2017-07-10) you can supply a comma-separated list of file names:

\loadrandomproblems{10}{prob_set_1.tex,prob_set_2.tex}

Here's a temporary fix until the new version becomes available:

\documentclass[12pt,addpoints]{exam}
\usepackage{probsoln}

\begin{document}


        \header{English 213}{Quiz on vocab lists 1--2}{Fall 2017}


    \let\orginput\input
    \makeatletter
    \renewcommand*{\input}[1]{\@for\thisfile:=#1\do{\orginput{\thisfile}}}
    \loadrandomproblems{10}{prob_set_1.tex,prob_set_2.tex}
    \makeatother
    \let\input\orginput

    \begin{questions}
    \foreachproblem{\question[1]\thisproblem\dotfill}
    \end{questions}

\end{document}

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.