Next: , Previous: The database of exercises, Up: A complete example


8.2 LaTeX Master file

Tha LaTeX Master file has to define the macros that manyex will include in the LaTeX file to control the numberring of the exercises and various other things. In this case the LaTeX Master file looks as follows:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%
%%% Master file for normal LaTeX exams
%%%
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%% Global header. This macro is called once at the beginning of the
%%% batch of exams.

\def\tthdump#1{#1} % Do nothing. The following are not done for TtH.
                   % Useful to put LaTeX code that will not be used
                   % by tth. 
% This counter will be used for a hack for correct numbering of 
% questions, usually it is not needed except when lumping true/false
% exercises together
\newcounter{question}\setcounter{question}{1}

\newcommand{\mnglobalheader}{}

%%% This will be used in the answer output
\newcommand{\mnanswerpaperheader}{
\smallskip

\centerline{\Large Answers for the exam:}

\smallskip
}

%%% Print this on each exam, before the exercises
\newcommand{\mnpaperheader}{

{\bf\Large Universitat Pompeu Fabra}

{\bf\Large Group: 01}

{\bf\Large Permutation Number: \mnserialnumber}

\centerline{\Large Final Exam}

\bigskip

}

%%% Print this on each exam, after the questions. 
%%% Questions are numbered correlatively by default, extending over 
%%% different exercises. With the definitions here the numbering 
%%% will restart at each exercise. Usually just \mnquestionnumber is
%%% used. 
\newcommand{\mnpaperfooter}{}

%%% Print this before each exercise
\newcommand{\mnexerciseheader}{
\setcounter{question}{1}
{\noindent \bf \large Exercise \mnexercisenumber}: }

%%% This will be used by the group of true/false questions. This macro
%%% is put in front of an exercise/enexercise group of exercises.
\newcommand{\mnexercisestartheader}
{Say if the following statement are true or false:

\smallskip

}

%%% Print this after each exercise - The ``question'' counter is a
%%% hack to allow for correct numbering of questions within exercises
\newcommand{\mnexercisefooter}{}

%%% Print this before each question
\newcommand{\mnquestionheader}{
{\noindent \bf Question \arabic{question}: 
\addtocounter{question}{1}}}

%%% Print this after each question
\newcommand{\mnquestionfooter}{}

%%% Print this in answer files before the answers
\newcommand{\mnanswerheader}{
\smallskip

Answer:

\smallskip}


%%% Print this in answer files after the answers
\newcommand{\mnanswerfooter}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%
%%% End of master file
%%%
%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

COMMENT: All necessary macros are defined in this file. In order to process the LaTeX file correctly, they have to be defined even if empty, for instance:

     \newcommand{\mnanswerfooter}{}

Some of them are not necessary, for instance if the answer LaTeX file is not processed. In this example a hack is used to override the standard procedure to number exercises and questions used by manyex. The standard procedure just numbers exercises and questions within exercises, but if you only include one exercise, or if you have exercises with just one question, the result is ackward (ex.1 q.1, ex.2 q.2, ...). With the macros \mnexerciseheader and \mnquestionheader, and the construct exercise/endexerxise in the test definition file, the standard numbering of exercises and questions can be modified.