The procedures to create web form exams are very similar to the creation of LaTeX exams, with the followwing differences:
The example can be found in the subdirectory example_web of the distribution tree.
Here is the master file for this example , master.sty:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%
%%%
%%% Master latex file to generate web form 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}{}
%%% The next definitions are specifid for html form exams. They format
%%% different aspects of the form fields.
\newcommand{\mnformheader}{
Fill in your personal data. Please enter the data correctly otherwise
we will not be able to identify your test and it will not be graded:
}
\newcommand{\mnformfooter}{
\smallskip
{\bf \large VERY IMPORTANT: Do not forget to click on ``I finished
at the end of the test.}
}
\newcommand{\mnsubmitheader}{
\bigskip
If you have finished you can send your test for correction, by
clicking on the following button:
}
\newcommand{\mnsubmitfooter}{}
%%% 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: The formaction field specifies a web server where the cgi for processing the form are located. WARNING: be careful with cgi scripts, check security concerns in the Internet.
The test description file for this case is the following:
################################################## ################################################## ################################################## # This is a test description file for "manyex" # # To create the html form exams give the command # # manyex -w -f file-name # # where file-name is the name of this file. # # This will create "exam"N.tex and "answer"N.tex, # where "exam" and "answer" are the prefixes # that you choose below (if not defined the pre- # fixes will be actually "exam" and "answer") and # N is a correlative number from 0 to total exams # being created minus one. # # To create the web form exams (or answers if you # want to show them in the web) pass the LaTeX # code through "tth" (http://hutchinson.belmont.ma.us/tth/). # # It also creates mn-correct, a text file where # each line starts with the exam number (001, 002, # ...) followed by the correct answers for each # question (A,B,C... for # multiplechoice, A=true, # B=false for true/false and just A's for short- # answer), and mn-logfile with information on # the tasks done by manyex. # # Look at mc-logfile after each run for possible # errors. # ################################################## ################################################## # # Base directory for database of exercises # ################################################## directory "../example_base" ################################################## # # 1st part: Options and definitions for latex file # ################################################## # Options for documentclass article documentclassoptions "12pt,a4paper" # Packages to be included - I # configure my preferred document layout in manyex.sty, which # you can find in this same directory usepackage "manyex" # Master tex file with macro definitions (<mastertex>.sty) mastertex "master" # Latex file prefix for the exams (<examtex>.tex) examtex "exam" # Latex file prefix for the answers (<answertex>.tex) answertex "answer" # Prefix for exercise files (all have to start with this) # Be careful not to have some other files in the exercise # database directories starting also with this prefix. For # instance grapchics filenames should start differently. exerprefix "exer" # Options for web form # These options will define the parameters of the html form pagetitle "Final exam" formaction "http://www.examplemanyex/cgi-bin/test.cgi" inifield ( name="firstname" label="First Name: " type="text" size="40") inifield ( name="lastname" label="Last Name: " type="text" size="40") inifield ( name="grup" label="Group: " type="text" size="5") inifield ( name="dni" label="Student ID: " type="text" size="10" text="If you haven't been assigned a Student ID yet enter XXXXXXX:") requirefield "Your have to enter your Student ID" textsubmit "I finished!" ################################################## # # # 2nd part: describe the tests to be created # # # ################################################## # Set random seed # If you change this number the tests created # will be different. With this you can always reproduce # the same sequence of exams, if needed. seed 8726 # Set first serial number (exam numbering). # The serial number used will start with the number below # and will increase by 1. serial 1 # Define exercise types and how many exercises are required # per type. The first argument is an integer expressing # how many exercises of this type are to be included in the # exam. There should be enough exercises of this type in the # corresponding subdir of the exercise database (or subdirs, # more than one can be specified). The second argument # specifies (between quotes) the name of the subdir where # the exercises are contained within the exercise database. # More than one subdir can be speficied: # use 3 from "1num_1", "1num_2" # for instance. # exercise/endexercise lumps all true/false questions together # and puts a header "Exercise 1" in front of them, otherwise each # true/false question would be indexed: "Exercise 1 - Question 1", # "Exercise 2 - Question 2"... and so on. exercise use 5 from "1num_t" use 5 from "Normal_t" endexercise # We now include the rest of exercises use 1 from "1num_m" use 1 from "Normal_m" use 1 from "Normal_s" # Total number of exams to create, you can create as many exams # as you want, they will be all different unless you have very # few exercises in the database and you request a lot of exams create 4 ################################################## ### End test-description file ##################################################
Once you have generated the html forms, you can place them in a web server, and with the appropiate scripts you can use them so that they are opened randomly and the results saved for later processing and grading.