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've using the examdesign class to create exams and it can do almost everything I want. But I find that I've been repeating myself as I reuse old exams as practice exams and quiz problems. I'd like to create a bank of test problems and it seems that this can almost be accomplished using the \InsertChunk function provided by the examdesign class, but there seems to be a small bug.

I can almost accomplish my goal if I put the following in the main LaTeX file:

\documentclass{examdesign}

\IncludeFromFile{foo.tex}

\begin{examtop}
    Exam Instructions
\end{examtop}

\begin{document}

\begin{multiplechoice}

  \begin{question}
    Question text goes here.
    \choice[!]{0.31}
  \end{question}

  \InsertChunk{chunk name}

\end{multiplechoice}

\end{document}

And the following in a file named foo.tex:

\begin{chunk}{chunk name}
  \begin{question}
    Question 2 text goes here.
    \choice[!]{0.31}
  \end{question}
\end{chunk}

However, this setup breaks if I remove the first question.

I was wondering if anybody knew enough about the examdesign class to propose a modification or a workaround so that I could keep all my questions in foo.tex.

share|improve this question
    
Your code will produce errors as it is now (apparently you need to provide some value for \class in the preamble). –  Gonzalo Medina Apr 19 '12 at 4:00
1  
I am getting ! LaTeX Error: There's no line here to end. as of now. –  Harish Kumar Apr 19 '12 at 4:06
    
I've edited the code to define the examtop environment which I believe fixes the compilation errors. –  Guillermo Garza Apr 19 '12 at 4:21
add comment

1 Answer

examdesign uses an odd (to me) method of finding the "stuff before the questions". It literally gathers up everything before the first \begin and marks that as the instructions.

% \begin{macro}{\get@instructions}
% This macro collects everything between it and the next |\begin| token.  It then
% calls the |\find@instructions@end| macro to check whether the |\begin| token
% belongs to the \textsf{question} environment or some other environment.
%    \begin{macrocode}
\long\def\get@instructions#1\begin{\@toklist=\expandafter{\the\@toklist#1}%
  \find@instructions@end}
%    \end{macrocode}
% \end{macro}

I think one could rewrite this to define an instructions environment, but maybe that makes the questions unnecessarily wordy.

The \find@instructions@end is pretty particular, and will only stop gobbling when it finds \begin{question} or \begin{block}. The \begin{block} just delays the problem, as it uses a similar method to find the instructions for the block.

In other words, I don't see a simple way to do this without changing the syntax expected by the package. Certainly, to me this looks like a question for the package author.

share|improve this answer
add comment

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.