[Tugindia] Doubt on MCQ using endnotes package

SIVAKUMAR R skarg_ind at hotmail.com
Tue Jan 21 18:27:42 CET 2014


I want only the choice number is to print in first Answer section and choice number with description in second answer section. Also if the question has two answer i need the display as  1. c) d) 
below is my tex document. 



\documentclass{article}
\usepackage{endnotes}

% Define two new counters for ease of using.
\newcounter{questionnumber}
\newcounter{choicenumber}[questionnumber]
% Formatting the counters, this is where you change how the counters appear.
\renewcommand*\thequestionnumber{\arabic{questionnumber}.}
\renewcommand*\thechoicenumber{\alph{choicenumber})}
% Define the \question and \choice commands to be similar to what is given in the OP
\newcommand*\question{\item}
\newcommand*\choice{\item}
% Here's a bit of a hack: \endnotetext stores the \meaning of the its argument in the endnotetext file, so the macros aren't expanded. I use \edef to fully expand the current \thechoicenumber, and use \expandafter to stuff it into the argument for \endnotetext. Suggestions for improvements are welcome!
\newcommand*\entreplace[1]{\endnotetext[\value{questionnumber}]{#1}}
\newcommand\truechoice[2]{\item #1 \edef\tempchoice{\thechoicenumber} \expandafter\def\expandafter\currentcount\expandafter{\tempchoice \ \ #2} \expandafter\entreplace\expandafter{\currentcount}}
% Define a choices environment, just a list basically. 
\newenvironment{choices}{\begin{list}{\thechoicenumber}{\usecounter{choicenumber}}}{\end{list}}
% These are to set up the endnotes. The first makes the endnote marks look like the question numbering (as opposed to being in superscript). The second sets the endnotes heading to read "Answers". 
\renewcommand*\makeenmark{\theenmark.~~}
\renewcommand*\notesname{Answers:}

\begin{document}
\begin{list}{\thequestionnumber}{\usecounter{questionnumber}}
\question Some question
\begin{choices}
\choice False choice
\choice Bad choice
\truechoice{True choice}{description}
\truechoice{True choice}{description}
\end{choices}
\end{list}

\begingroup
\parindent 1pt
\parskip 1ex
\def\enotesize{\normalsize}
\theendnotes
\endgroup

% Print the "answers"
\theendnotes
\end{document}



இரா.சிவக்குமார் (R.SIVAKUMAR)
கணித விரிவுரையளர் (LECTURER IN MATHEMATICS), 
ஹயக்ரிவா தொழில் நுட்பக் கல்லூரி (HAYAGRIVA POLYTECHNIC COLLEGE),
புதுச்சேரி (PUDUCHERRY).
www.rasivakumar.blogspot.in 		 	   		  


More information about the tugindia mailing list