%TEX TEMPLATE FILE FOR UPLOAD OF QUESTIONS TO MOODLE LMS
%University of Vienna, based upon the work of (c) 2016 Anders O. F. Hendrickson, 2019–2021 Matthieu Guerquin-Kern



% STEP 1: CREATE YOUR QUESTIONS IN TEX FORMAT
% 1. Download the package for writing Moodle questions in LaTeX format (https://ctan.org/pkg/moodle).
% 2. Write a LaTeX document using \usepackage{moodle} as described below.
% 3. Use the syntax for different question types as written in this template (or available at https://ctan.org/pkg/moodle) to prepare your data for the upload.

% ===========================================================================================================
% STEP 2: EXPORT IN MOODLE XML FORMAT
% 1. Compile the document to/ Save the document in "Moodle XML" format.

%    Further information:
%    When you use Overleaf, go to the section "Logs and output files" (next to "Recompile") and choose the "output-moodle.xml" format, available in "Other logs and files".

% ===========================================================================================================
% STEP 3: UPLOAD IN MOODLE

% 1. Open Moodle, navigate to the desired course and switch to the "Question bank > Import".
% 2. Select the "Moodle XML format" and choose the XML file to upload, and press "Import".
% 3. After Moodle verified that the questions have been imported correctly, you may add them to your activity in your course (e.g. quiz).


% ===========================================================================================================
% ===========================================================================================================
% General data of the file

\documentclass[12pt]{article}
\usepackage{moodle}

% General syntax for questions in Moodle:
% 1. Question name = Name of the question, used internally for administration only (not available for students)
% 2. Question text = Text which is shown to students as a question
% 3. Answer item = Answer(s) to this question

% 4. General options for questions
%    -> 'points' OR 'default grade' = number of points a question is worth/ default mark (by default it is set to 1),
%       e.g. [points=2], [default grade=10.0000000]
%    -> 'penalty' (any value from 0 to 1) = fraction of points that is taken for each wrong attempt (by default there is set a penalty of 0.10 points),
%       e.g. [penalty=0.3333333]
%    -> 'feedback' = text that will appear to the student, with details to the question (general feedback),
%       e.g. [{feedback={Lorem ipsum dolor...}]

% 5. General options for answer items
%    -> 'fraction' (any value from -100 OR 0=entirely wrong to 100=entirely correct) = option to designate some answers as being worth partial, positive fractions should sum up to exactly 100 (with multiple choice question this is required) and negative fractions for wrong choices are possible too (from -100 to 0); alternative you can use an asterisk (*) to mark the correct answer(s),
%       e.g. [fraction=0], [fraction=33.3333333], [fraction=100], \item * Lorem ipsum
%    -> 'feedback' = text that will appear to the student, with details to the specific answer item,
%       e.g. [{feedback={Lorem ipsum dolor...}]
%    -> 'tags' =  sets a list of keywords for the question that will be taken into account by Moodle for filtering purposes or classification of questions inside the question bank,
%       e.g. [tags={Lorem,ipsum,dolor}]

% 6. Further options for question type - for questions and answer items (see below with the question type)


% ===========================================================================================================
% Begin of the document

\begin{document}
\begin{quiz}{Questions overview} % Here you can add a specific header to your group of questions (it automatically can be used as category name when you check the option "Get category from file" within the import in Moodle)

% ===========================================================================================================
% QUESTIONS - Please add here your questions and replace the template questions below:
% -> Multiple-choice question / All-or-nothing question
% -> True-false question
% -> Numeric question
% -> Short-answer question
% -> Essay question
% -> Description


% Multiple-choice question / All-or-nothing question
\begin{multi}
[]  % Options for question (general options see above, further options see below)
{Multiple choice question name} % Question name
Multiple choice question text% Question text
\item * Answer 1 % Answer item
\item Answer 2 % Answer item
\item Answer 3 % Answer item
\end{multi}

  %  Further options for question:
  %  -> 'shuffle' (true/ false) = determines whether Moodle will order answers randomly or not (by default, shuffling is active),
  %     e.g. [shuffle=true]
  %  -> 'numbering' (none/ abc/ ABCD/ 123/ iii/ III OR alph/ Alph/ arabic/ roman/ Roman) = type of numbering which is used for the list of answers (by default, abc is set),
  %     e.g. [numbering=abc], [numbering=123], [numbering=arabic]
  %  -> 'single' (true/ false) OR 'multiple' OR 'allornothing' = allows one or more than one correct answer (by default, Moodle operates with one correct answer only); using 'allornothing'  points are given only if the student selects all correct answers - for this there is a separate question type plugin in Moodle available
  %     e.g. [single=true], [single= false], [multiple]


  % EXAMPLE (with complex syntax)

    \begin{multi}
    [default grade=10.0000000,penalty=0.3333333,feedback={General feedback...},shuffle=false,numbering=123,single=true,tags={Lorem,ipsum,dolor}]  % General and further options for question
    {Multiple choice question name (example with complex syntax)} % Question name
    Multiple choice question text (example with complex syntax)% Question text
    \item[fraction=0,feedback=Wrong!] Answer 1 % Answer item
    \item[fraction=50,feedback=Wrong!] Answer 2 % Answer item
    \item[fraction=50,feedback=Correct!] Answer 3 % Answer item
    \item[fraction=-100,feedback=Totally wrong!] Answer 4 % Answer item
    \end{multi}


%-------------


% True-false question
\begin{truefalse}
[]  % Options for question (general options see above, further information see below)
{True-false question} % Question name
True-false question % Question text
\item * % Answer item
\item  % Answer item
\end{truefalse}

  %  Further information:
  %  -> only two answer items are allowed
  %  -> no further text is needed, the first item is automatically "True", the second item "False"
  %  -> if the answer items have further text, it would be used for feedback to the response
  %  -> the correct answer is declared by an asterisk (*), no fraction is needed
  %     e.g. \item * Lorem ipsum


%-------------


% Numeric question
\begin{numerical}
[] % Options for question (general options see above, further options and information see below)
{Numeric question name} % Question name
Numeric question text: What is $1+1$?  % Question text
\item 2 % Answer item
\end{numerical}

  %  Further options for question:
  %  -> 'tolerance' = can be used to specify the validity of anwsers within some margin,
  %     e.g. [tolerance=0.1]

  %  Further options for answer items:
  %  -> 'tolerance' = can be used to specify an individual validity of answers within some margin (deviating from the generel tolerance, defined in the question options),
  %     e.g. [tolerance=0.1]
  
  %  Further information:
  %  -> only one answer item is allowed
  %  -> to be able to give partial points and/or feedback to some given answers, you can add further lines with '\item[...],
  %     e.g. \item[fraction=50,feedback={Almost correct!}] 1.8, \item[fraction=0,feedback={Wrong!}] *

  
%-------------


% Short-answer question
\begin{shortanswer}
[]  % Options for question (general options see above, further options see below)
{Short answer question name} % Question name
Short answer question text % Question text
\item Answer 1 % Answer item
\item Answer 1.0 % Answer item
\item Answer 2 % Answer item
\end{shortanswer}

  %  Further options for question:
  %  -> at least one answer item is needed, further answer items can be used to offer different correct answers or different spellings of an answer
  %  -> 'case sensitive' OR 'usecase' = makes a question case-sensitive (by default Moodle ignores the distinction between upper- and lower-case letters),
  %     e.g. [case sensitive], [usecase]
  %  -> '\blank' = make the text box appear as part of the question within the text,
  %     e.g. Lorem ipsum dolor sit \blank, consetetur sadipscing elitr, ...


%-------------


% Essay question
\begin{essay}
[] % Options for question (general options see above, further options and information see below)
{Essay question name} % Question name
Essay question text% Question text
\item Notes for grader: Lorem ipsum dolor sit amet, consetetur sadipscing elitr, ...  % Answer item (here: Notes for grader)
\end{essay}

  %  Further options for question:
  %  -> 'response required' = determines whether students are required to answer the question,
  %     e.g. [response required]
  %  -> 'response format' (html/ file/ html+file/ text/ monospaced) =  the way, how students have to give an answer - enter any specific type of text (with or without html editor or plain text) and/or upload a file (by default, html is set),
  %     e.g. [response format=html+file], [response format=text]
  %  -> 'response field lines' (any integer from 5 to 40)= controls the height of the input box for text (by default it is set to 15 lines),
  %     e.g. [response field lines=30]
  %  -> 'attachments allowed' (0/ 1/ 2/ 3/ unlimited) = controls how many attachments can be uploaded,
  %     e.g. [attachments allowed=0], [attachments allowed=2], [attachments allowed=unlimited]
  %  -> 'attachments required' (0/ 1/ 2/ 3) = controls how many attachments are required,
  %     e.g. [attachments required=0], [attachments required=3], 
  %  -> 'template' = option to preload a template text that should be edited from students,
  %     e.g. [template={Lorem ipsum dolor...}]

  %  Further information:
  %  -> Notes for grader can be added by \item ...,
  %     e.g. \item Lorem ipsum dolor...


%-------------


% Description
\begin{description}
[] % Options for question (general options see above, further information see below)
{Description name} % Question name
Descripton text % Question text
\end{description}

  %  Further information:
  %  -> only the general options 'feedback' and 'tags' can be used with this type,
  %     e.g. [{feedback={Lorem ipsum dolor...}], [tags={Lorem,ipsum,dolor}]


%===========================================================================================================
% End of the document

\end{quiz}
\end{document}