Like
\begin{enumerate}[random]
\item .....
\item ....
\end{enumerate} [random]
This should come in handy for teachers making up multiple choice
exams.
you can combine the list environment with the package lcg.
regards
Marco
schrieb TCL:
I installed the package. But what is the command? The command I show
above \begin{enumerate}[random]
does not work.
Thank you very much.
>>> This should come in handy for teachers making up multiple choice
>>> exams.- Hide quoted text -
>>
There are multiple packages for creating exams on ctan
http://www.ctan.org/pkg/examdesign
http://www.ctan.org/pkg/exam
http://www.ctan.org/pkg/exams
http://www.ctan.org/pkg/exerquiz
the latter is part of the AcroTeX education bundle
http://ctan.org/pkg/acrotex
that allows you to make interactive tests, games and quizzes.
> I installed the package. But what is the command? The command I show
> above \begin{enumerate}[random]
> does not work.
>
> Thank you very much.
I think you need to do something along the lines of:
\documentclass{article}
\usepackage{lcg}
\begin{document}
\reinitrand[first=1, last=3, counter=die]
\begin{itemize}
\item[\rand\arabic{die}.] Foo.
\item[\rand\arabic{die}.] Bar.
\item[\rand\arabic{die}.] Baz.
\end{itemize}
\end{document}
> I installed the package. But what is the command? The command I show
> above \begin{enumerate}[random]
> does not work.
Try this:
\documentclass{article}
\usepackage[first=1,last=6]{lcg}
\begin{document}
\begin{enumerate}
\item[\rand\arabic{rand}.] Something
\item[\rand\arabic{rand}.] Something else
\item[\rand\arabic{rand}.] And still something else
\end{enumerate}
\end{document}
Best regards,
Jose Carlos Santos
This does not work. The result it produces is a random order of the
number but not the content of the number: e.g. 3. Foo 1. Bar 2.
Baz
What one intended should be e.g. 1. Bar 2. Baz 3. Foo
This does not work. The result it produces is a random order of the
number but not the content of the number: e.g. 5. Something 1.
Something else 2. And still something else
What one intended should be e.g. 1. Something else 2. And still
something else 3. Something
AcroTeX education bundle has also forpaper option and allowrandomize -
this option makes what you want. Just try it.
If you do not want to use this bundle, you need something like this
(use lualatex to compile):
\documentclass{article}
\begin{document}
\def\saveitem#1#2{\expandafter\def\csname option#1\endcsname{#2}}
\def\useitem{\item \def\temp{\directlua{tex.print(math.random(1,3))}}
\csname option\temp \endcsname}
\begin{itemize}
\saveitem1{first}
\saveitem2{second}
\saveitem3{third}
\useitem
\useitem
\useitem
\end{itemize}
\end{document}
Far from perfect, since the same answer may appear multiple times -
you need a random permuation rather than random numbers. I have seen a
similar example with luatex, but cannot find it just now. Needs
programming, but generaly this is the way.
Robert
Hi,
I just think of a possible solution which helps you randomize the
/order/ of your items rather than their enumeration.
The following code is untested and certainly contains errors, but
perhaps you get the idea.
You should separate answers and numbering. Store the answers in a
structure separate from your itemized list.
\documentclass{article}
\usepackage[first=1,last=5]{lcg}
\newcommand{\MyChoice}[1]{\ifcase #1
\or Some item
\or Another item
\or Yet another item
\or Again another item
\or A fifth item
\fi}
\begin{document}
\begin{enumerate}
\item \MyChoice{\rand\arabic{rand}}
\item \MyChoice{\rand\arabic{rand}}
\item \MyChoice{\rand\arabic{rand}}
\item \MyChoice{\rand\arabic{rand}}
\item \MyChoice{\rand\arabic{rand}}
\end{enumerate}
\end{document}
For more multiple-choice questions, you can \renewcommand{\MyChoice}.
Hth,
Oliver.
--
Dr. Oliver Corff e-mail: co...@zedat.fu-berlin.de
No. That does not work. It produces the following:
1. =5532
2.
3.
4.
5.
The 5532 changes every time I run it -- that is due to randomness. But
of course this does not help.
For solution to your problem look at http://www.math.uakron.edu/~dpstory/acrotex/aeb_man.pdf
page 115 (randomizing the multiple choices). Does this help.
Robert
As I said:
: > The following code is untested and certainly contains errors, but
: > perhaps you get the idea.
: >
: > You should separate answers and numbering. Store the answers in a
: > structure separate from your itemized list.
: >
: > \documentclass{article}
: > \usepackage[first=1,last=5]{lcg}
: > \newcommand{\MyChoice}[1]{\ifcase #1
: > � � � � \or Some item
: > � � � � \or Another item
: > � � � � \or Yet another item
: > � � � � \or Again another item
: > � � � � \or A fifth item
: > � � \fi}
: >
: > \begin{document}
: > \begin{enumerate}
: > � � \item \MyChoice{\rand\arabic{rand}}
: > � � \item \MyChoice{\rand\arabic{rand}}
: > � � \item \MyChoice{\rand\arabic{rand}}
: > � � \item \MyChoice{\rand\arabic{rand}}
: > � � \item \MyChoice{\rand\arabic{rand}}
: > \end{enumerate}
: > \end{document}
: >
: No. That does not work. It produces the following:
: 1. =5532
: 2.
: 3.
: 4.
: 5.
: The 5532 changes every time I run it -- that is due to randomness. But
: of course this does not help.
As I said, the code is untested. Change it as follows:
: > � � \item \MyChoice{\rand\arabic{rand}}
becomes:
\item \rand\MyChoice{\arabic{rand}}
The argument to \MyChoice must be a plain digit, it was my mistake
to put the \rand call into the argument, too. If you call \rand before
invoking \MyChoice, the example works.
Hi, it compiles but does not work properly - some items are listed two
times and some are missing.
Robert
btw: I tested this:
\documentclass{article}
\usepackage[first=1,last=5]{lcg}
\newcommand{\MyChoice}[1]{\ifcase #1
\or Some item
\or Another item
\or Yet another item
\or Again another item
\or A fifth item
\fi}
\begin{document}
\begin{enumerate}
\item \rand\MyChoice{\arabic{rand}}
\item \rand\MyChoice{\arabic{rand}}
\item \rand\MyChoice{\arabic{rand}}
\item \rand\MyChoice{\arabic{rand}}
\item \rand\MyChoice{\arabic{rand}}
\end{enumerate}
\end{document}
: Hi, it compiles but does not work properly - some items are listed two
: times and some are missing.
Sure. The example lacks a mechanism to check which numbers have been called
before, and it doesn't check which ones it failed to call. The example
was solely intended to demonstrate how to separate item numbering from
the order of items. Same with the luatex example.
So it is perhaps best not to re-invent the wheel but to use proven
solutions as in the packages you recommended.