[OS X TeX] Multiple choice tests

Alain Schremmer Schremmer.Alain at gmail.com
Fri Jan 6 15:10:53 EST 2006


Alain Schremmer wrote:

> Talbot's probsoln package uses his generator to modify/pick the 
> problems and I would like to use it to pick n and i randomely in the 
> main file.
>
> The trouble is that I cannot read his code and, even less, if need be, 
> extract his pseudo-random number generator to modify it for my own 
> purpose.

I have made some progress by cutting Talbot's sample example down to 
something I could graft on a pared-down version of my own main file.

I have enclosed this main file below for reference. Should anyone wish, 
I will send her/him all the ancillary files for the example to work.

Note that I am also using Sneep's \includeExercise.

When I typeset the main file, the pdf is:

    1.
    2. random one of a, b, c, d, e, say d
    3. random one of a, b, c, d, e, say b

        (this is because, as probsoln says: "Each problem is preceeded
        by a \item, so the command \selectrandomly should occur within
        one of the list-like environments, such as enumerate.")

    Contents of file 016-Exam-1-Question-1-a
    Contents of file 016-Exam-33-Question-1-a


(1) My immediate question, is whether I can use variables so that, 
instead of the above, I get just

    Contents of file 016-Exam-1-Question-1-d
    Contents of file 016-Exam-33-Question-1-b

(2) My less immediate question is how to shuffle the 33 questions. I 
think that the solution is in Talbot's probsoln but …

Regards
--schremmer

\documentclass[11pt]{book}

% begin PREAMBLE

% begin use packages
\usepackage{graphicx}
\usepackage{pdfsync}
\usepackage{paralist}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{relsize}
\usepackage{ifthen}
\usepackage{probsoln}
% end use packages
%begin IncludeExercises/IncludeFileName

\PSNrandseed{\time}

\newboolean{FinalVersionWithExercises} % defaults to false
\setboolean{FinalVersionWithExercises}{true} % uncomment this line to 
actually include the exercises

\newcommand{\includeExercises}[1]{%
\ifthenelse{\boolean{FinalVersionWithExercises}}% if true, do the first 
thing, otherwise the second.
{%
\input{#1}% true part
}{%
{\url{#1}}% else part
}%
}
%end IncludeExercises/IncludeFileName

\DeclareMathAlphabet{\denom}{OT1}{cmss}{sbc}{n}

\theoremstyle{remark}
\newtheorem{question}{Question}

%end PREAMBLE
%========================================================
\begin{document}



\begin{enumerate}
\item
\selectrandomly{variants.tex}{2}
\end{enumerate}

%-------------------------------------------------------------------------------------1
\includeExercises{016-Exam-1-Question-1-a}
%-------------------------------------------------------------------------------------1
\includeExercises{016-Exam-1-Question-33-a}
\noindent 
--------------------------------------------------------------------------------------------------- 
%Bottom one.
%=====================================================
\end{document}

------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the MacOSX-TeX mailing list