Hi all,
On this list on 7/27/2007, there was a discussion of a multiple choice exam
layout using exam.cls (http://www-math.mit.edu/~psh/) or examdesign.cls
(http://tug.ctan.org/pkg/examdesign/).
I couldn't use either of those because I need to place several "exams" (one at
the end of each chapter, at a minimum), so I couldn't use the exam or
examdesign class -- I need to use a book type class or derivative thereof.
Therefore, I need to implement the relevent functionalities of these classes
with a few environments. Naturally that requires a layout, but in order to
develop the layout I started by writing a latex file incorporating and
excercising the environments.
The attached file does this with environments questions, question, choices,
choice and rightchoice. This LaTeX DOES NOT create an answer key at the back,
but I think I could possibly make that happen if needed. Alternatively, I
could run it through a script to produce a separate document for the answer
key.
Hope you like it.
In case the list doesn't allow attachments, I'm also printing it in the body
after my sig.
Thanks
SteveT
Steve Litt
Books written in LyX:
Troubleshooting Techniques of the Successful Technologist
Twenty Eight Tales of Troubleshooting
Troubleshooting: Just the Facts
\documentclass[12]{article}
%%%% PACKAGE FOR SETTING LINE SPACING %%%%
\usepackage{setspace}
%%%% COUNTERS %%%%
\newcounter{qcounter}
\newcounter{acounter}[qcounter]
%%%% ARROW FOR FRONT OF RIGHT ANSWER %%%%
\def\myarrow{init}
%%%% LIST FOR QUESTIONS LIST %%%%
\newenvironment{questions}
{ %begin preliminary environment code
\begin{list}
{\bfseries\upshape\arabic{qcounter}:} %label info
{ %begin list item body code
\usecounter{qcounter}
\setlength{\labelwidth}{2cm}
\setlength{\leftmargin}{0.6cm}
\setlength{\labelsep}{0.3cm}
\setlength{\rightmargin}{1cm}
\setlength{\itemsep}{0.5in}
%\slshape
} %end list item body code
} %end preliminary environment code
{\end{list}}
%%%% ENVIRONMENT FOR A SINGLE QUESTION %%%%
\newenvironment{question}{\item{}}{}
%%%% ENVIRONMENT FOR THE LIST OF CHOICES FOR A QUESTION %%%%
\newenvironment{choices}
{ %begin preliminary environment code
\begin{list}
{\bfseries\upshape \myarrow\alph{acounter}:} %label code
{ %begin list item body code
\usecounter{acounter}
\setlength{\topsep}{-1ex}
\setlength{\labelwidth}{2cm}
\setlength{\leftmargin}{1.6cm}
\setlength{\labelsep}{0.3cm}
\setlength{\rightmargin}{1cm}
\setlength{\itemsep}{1ex}
\setlength{\parsep}{1ex}
\setstretch{0.8}
%\slshape
} %end list item body code
} %end preliminary environment code
{\end{list}}
%%%% ENVIRONMENTS FOR A SINGLE WRONG OR A SINGLE RIGHT CHOICE %%%%
\newenvironment{choice}{\def\myarrow{~~~~}\item{}}{}
\newenvironment{rightchoice}{\def\myarrow{**~~}\item\bfseries\slshape}{~~**}
%%%% THE DOCUMENT ITSELF %%%%
\begin{document}
Hello world
~\\[0.5in]
\begin{questions}
\begin{question}What is LyX?\end{question}
\begin{choices}
\begin{choice}A wordprocessor.\end{choice}
\begin{choice}A text editor.\end{choice}
\begin{choice}A horse is a horse, of course, of course,
and noone can talk to a horse, of course,
unless that horse, of course, of course,
is the famous Mr. Ed.\end{choice}
\begin{rightchoice}A layout and typesetting program.\end{rightchoice}
\begin{choice}A seamless, business rule aware middleware product.\end{choice}
\end{choices}
\begin{question}Why is LyX better?\end{question}
\begin{choices}
\begin{choice}It's a Microsoft program.\end{choice}
\begin{rightchoice}It uses LaTeX to create superior layout.\end{rightchoice}
\begin{choice}A horse is a horse, of course, of course,
and noone can talk to a horse, of course,
unless that horse, of course, of course,
is the famous Mr. Ed.\end{choice}
\begin{choice}It's a fixed sequence, rapid authoring environment.\end{choice}
\begin{choice}You needn't use styles with LyX.\end{choice}
\end{choices}
\begin{question}What is LyX's relationship to LaTeX\end{question}
\begin{choices}
\begin{rightchoice}LyX is a front end to LaTeX.\end{rightchoice}
\begin{choice}LaTeX is a front end to LyX.\end{choice}
\begin{choice}A horse is a horse, of course, of course,
and noone can talk to a horse, of course,
unless that horse, of course, of course,
is the famous Mr. Ed.
Pony boy, pony boy, won't you be my pony boy?
Don't say no, here we go, off across the plains.
Marry me, marry me, ride away with you.
Giddyup giddyup giddyup boy, on pony boy!\end{choice}
\begin{choice}They're dedicated life partners.\end{choice}
\begin{choice}LaTeX is a wordprocessor with Visual Basic for
Applications, Object Embedding and Linking, and TrueType fonts.
LyX is a corporation..\end{choice}
\begin{choice}LyX is a front end to LaTeX.\end{choice}
\end{choices}
\end{questions}
~\\[1in]
\end{document}
\documentclass[12]{article}
%%%% PACKAGE FOR SETTING LINE SPACING %%%%
\usepackage{setspace}
%%%% COUNTERS %%%%
\newcounter{qcounter}
\newcounter{acounter}[qcounter]
%%%% ARROW FOR FRONT OF RIGHT ANSWER %%%%
\def\myarrow{init}
%%%% LIST FOR QUESTIONS LIST %%%%
\newenvironment{questions}
{ %begin preliminary environment code
\begin{list}
{\bfseries\upshape\arabic{qcounter}:} %label info
{ %begin list item body code
\usecounter{qcounter}
\setlength{\labelwidth}{2cm}
\setlength{\leftmargin}{0.6cm}
\setlength{\labelsep}{0.3cm}
\setlength{\rightmargin}{1cm}
\setlength{\itemsep}{0.5in}
%\slshape
} %end list item body code
} %end preliminary environment code
{\end{list}}
%%%% ENVIRONMENT FOR A SINGLE QUESTION %%%%
\newenvironment{question}{\item{}}{}
%%%% ENVIRONMENT FOR THE LIST OF CHOICES FOR A QUESTION %%%%
\newenvironment{choices}
{ %begin preliminary environment code
\begin{list}
{\bfseries\upshape \myarrow\alph{acounter}:} %label code
{ %begin list item body code
\usecounter{acounter}
\setlength{\topsep}{-1ex}
\setlength{\labelwidth}{2cm}
\setlength{\leftmargin}{1.6cm}
\setlength{\labelsep}{0.3cm}
\setlength{\rightmargin}{1cm}
\setlength{\itemsep}{1ex}
\setlength{\parsep}{1ex}
\setstretch{0.8}
%\slshape
} %end list item body code
} %end preliminary environment code
{\end{list}}
%%%% ENVIRONMENTS FOR A SINGLE WRONG OR A SINGLE RIGHT CHOICE %%%%
\newenvironment{choice}{\def\myarrow{~~~~}\item{}}{}
\newenvironment{rightchoice}{\def\myarrow{**~~}\item\bfseries\slshape}{~~**}
%%%% THE DOCUMENT ITSELF %%%%
\begin{document}
Hello world
~\\[0.5in]
\begin{questions}
\begin{question}What is LyX?\end{question}
\begin{choices}
\begin{choice}A wordprocessor.\end{choice}
\begin{choice}A text editor.\end{choice}
\begin{choice}A horse is a horse, of course, of course,
and noone can talk to a horse, of course,
unless that horse, of course, of course,
is the famous Mr. Ed.\end{choice}
\begin{rightchoice}A layout and typesetting program.\end{rightchoice}
\begin{choice}A seamless, business rule aware middleware product.\end{choice}
\end{choices}
\begin{question}Why is LyX better?\end{question}
\begin{choices}
\begin{choice}It's a Microsoft program.\end{choice}
\begin{rightchoice}It uses LaTeX to create superior layout.\end{rightchoice}
\begin{choice}A horse is a horse, of course, of course,
and noone can talk to a horse, of course,
unless that horse, of course, of course,
is the famous Mr. Ed.\end{choice}
\begin{choice}It's a fixed sequence, rapid authoring environment.\end{choice}
\begin{choice}You needn't use styles with LyX.\end{choice}
\end{choices}
\begin{question}What is LyX's relationship to LaTeX\end{question}
\begin{choices}
\begin{rightchoice}LyX is a front end to LaTeX.\end{rightchoice}
\begin{choice}LaTeX is a front end to LyX.\end{choice}
\begin{choice}A horse is a horse, of course, of course,
and noone can talk to a horse, of course,
unless that horse, of course, of course,
is the famous Mr. Ed.
Pony boy, pony boy, won't you be my pony boy?
Don't say no, here we go, off across the plains.
Marry me, marry me, ride away with you.
Giddyup giddyup giddyup boy, on pony boy!\end{choice}
\begin{choice}They're dedicated life partners.\end{choice}
\begin{choice}LaTeX is a wordprocessor with Visual Basic for
Applications, Object Embedding and Linking, and TrueType fonts.
LyX is a corporation..\end{choice}
\begin{choice}LyX is a front end to LaTeX.\end{choice}
\end{choices}
\end{questions}
~\\[1in]
\end{document}