Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I want to type multiple choice question (which may have two or more answer) book using exercise package such as

\begin{questions}
\question This is the first question
\choice Wrong answer
\correctchoice This is a correct answer
\correctchoice This is another answer
\choice Wrong answer

\question
....
\end{questions}

I want to type the answer at the end of the book with chapter name and exercise number or page number of the book. The choices in the questions must be in a single row or in two rows to save the space.

In the answer sheet, I like to give explanation to select the answer.

share|improve this question
    
Do the answers here help you? –  Thruston Oct 12 '12 at 14:23
    
Does it have to be the exercise package? –  cgnieder Oct 14 '12 at 8:43
    
As two correct answers are in my question, answer must be as Qn.No. B &C .It is possible to add comments in answer to explain why i choose the answer by using exercise package –  S.G. Sekaran Oct 15 '12 at 5:55
    
@S.G.Sekaran you can always edit your question to add more details. I was asking because I have an idea how to do this with another package. –  cgnieder Oct 17 '12 at 22:11

1 Answer 1

Your question is a bit confusing: you refer to the exercise package but are using commands in your code snippets that are defined by the exam class... Then you're talking about a book with a separate answers section but also say

In the answer sheet, I like to [...]

Since I now don't know what package/class you want to use and you never really answered my comment if you're bound to a specific package, and since it is also not really clear if you want to design a book or a exercise sheet/answer sheet combination (or maybe both?) I'll give a solution for the exam class creating sheets and one for the exsheets package for use in a textbook.

Using the exam class

The exam class obviously is not meant to create a textbook. But exercise/answer sheets can be created with it. Remove or add the class option answers to see the difference:

\documentclass[answers]{exam}
\begin{document}

\begin{questions}
 \question This is the first question.
 \ifprintanswers\emph{Info:} Correct choices are marked bold.\fi
 \begin{checkboxes}
  \choice Wrong answer
  \correctchoice This is a correct answer
  \correctchoice This is another answer
  \choice Wrong answer
 \end{checkboxes}
 \question This is the second question.
 \ifprintanswers\emph{Info:} Correct choices are marked bold.\fi

 \begin{oneparcheckboxes}
  \correctchoice True
  \choice False
  \correctchoice True
  \choice false
 \end{oneparcheckboxes}
\end{questions}

\end{document}

enter image description here

Using the exsheets package

The exsheets package can be used to create exams, exercise/answer sheets or exercises in textbooks. The following example will show how to add exercises and solutions and print the solutions in a separate section or chapter.

Using enumitem

\documentclass{article}
\usepackage{exsheets}
\SetupExSheets{counter-format=se.qu}

% due to a bug in versions >0.3a:
\providecommand*\checkedchoicebox{\ckeckedchoicebox}

\usepackage[inline]{enumitem}
\newlist{choices}{itemize}{1}
\newlist{choices*}{itemize*}{1}
\setlist[choices*]{itemjoin=\qquad}
\newcommand*\choice{\item[\choicebox]}
\newcommand*\correctchoice{\PrintSolutionsTF{\item[\checkedchoicebox]}{\item[\choicebox]}}

\begin{document}
\section{Exercises}
\begin{question}\label{qu:one}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \correctchoice This is a correct answer
  \correctchoice This is another answer
  \choice Wrong answer
 \end{choices}
\end{question}
\begin{solution}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \correctchoice This is a correct answer
  \correctchoice This is another answer
  \choice Wrong answer
 \end{choices}
 You find the question on page~\pageref{qu:one}.
\end{solution}
\begin{question}\label{qu:two}
 This is the second question.

 \begin{choices*}
  \correctchoice True
  \choice False
  \correctchoice True
  \choice false
 \end{choices*}
\end{question}
\begin{solution}
 This is the second question.

 \begin{choices*}
  \correctchoice True
  \choice False
  \correctchoice True
  \choice false
 \end{choices*}

 \noindent You find the question on page~\pageref{qu:two}.
\end{solution}

\section{Solutions}
\printsolutions

\end{document}

enter image description here

With >v0.3a of exsheets

The next update of exsheets will not only fix a few issues such as the \ckeckedchoicebox but also provide a possibility without enumitem. A working version can be downloaded here, the update to CTAN will have to wait a few days, though.

\documentclass{article}
\usepackage{exsheets}
\SetupExSheets{counter-format=se.qu}

\NewTasks[style=multiplechoice]{choices}[\choice]
\newcommand*\correct{\checkedchoicebox}

\begin{document}
\section{Exercises}
\begin{question}\label{qu:one}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \choice This is a correct answer
  \choice This is another answer
  \choice Wrong answer
 \end{choices}
\end{question}
\begin{solution}
 This is the first question.
 \begin{choices}
  \choice Wrong answer
  \choice[\correct] This is a correct answer
  \choice[\correct] This is another answer
  \choice Wrong answer
 \end{choices}
 You find the question on page~\pageref{qu:one}.
\end{solution}
\begin{question}\label{qu:two}
 This is the second question.
 \begin{choices}{4}
  \choice True
  \choice False
  \choice True
  \choice false
 \end{choices}
\end{question}
\begin{solution}
 This is the second question.
 \begin{choices}{4}
  \choice[\correct] True
  \choice False
  \choice[\correct] True
  \choice false
 \end{choices}
 \noindent You find the question on page~\pageref{qu:two}.
\end{solution}

\section{Solutions}
\printsolutions

\end{document}
share|improve this answer
    
TeX Live does not have exsheets package. –  stalking is prohibited Oct 26 '12 at 16:56
    
You mean TL 2012? Mine has it (v0.3 since today)... –  cgnieder Oct 26 '12 at 17:07
    
TL 2012 has no the package. –  stalking is prohibited Oct 26 '12 at 17:08
    
Yes, it does! Maybe the mirror you're updating from does not have it, though... –  cgnieder Oct 26 '12 at 17:10
    
OK. I will update again. Thanks. –  stalking is prohibited Oct 26 '12 at 17:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.