Themoodlepackage:
generatingMoodlequizzesviaL
A
T
E
X
AndersHendrickson
St.NorbertCollege,DePere,WI,USA
anders.hendrickson@snc.edu
January11,2016
1 Motivation
The acronym Moodle stands for \Modular Object-Oriented d Dynamic c Learn-
ing Environment." " It t is an n open n source learning management system em-
ployed by many y universities, , colleges, , and high h schools to o provide e digital ac-
cess tocoursematerials, , suchas s notes,videolectures,forums,andthe like;see
https://moodle.com/moodle-lms/formoreinformation. Oneofthemanyuse-
fulfeaturesofMoodleisthatmathematicalandscienticnotationcanbeentered
inL
A
T
E
XorT
E
Xcode,whichwillbetypeseteitherthroughabuilt-inT
E
Xlter
orbyinvokingMathJax.
For instructors who o want t to o give e students s frequent feedback, , but lack the
timetodoso,aparticularly valuable moduleinMoodleis the quiz. . AMoodle
quizcanconsistofseveraldierenttypesof questions|not onlymultiplechoice
ortrue/falsequestions,butalsoquestionsrequiringashortphraseor numerical
answer,andevenessayquestions. Allbuttheessayquestionsareautomatically
gradedbythesystem,andtheinstructorhasfullcontroloverhowoftenthequiz
maybeattempted,itsduration,andsoforth.Feedbackcanbetailoredtospecic
mistakesthestudentmakes.
Allthesefeatures makeMoodlequizzes veryusefultoolsforinstructorswho
haveaccesstothem. Unfortunately,theprimarywaytocreateoreditaMoodle
quiz is s through a a web-based d interface that can be e slow to operate. . To o users
ofLAT
E
X,accustomedto the speedoftypingsource code onakeyboardalone,
the agonizingslowness of switchingbetweenmouse andkeyboardtonavigatea
webform with h its s myriaddropdownboxes, , radio buttons, compoundedwitha
perceptible time lag as s one’s Moodle e server responds to requests, can n produce
a very frustrating experience. . Moreover, , editingis s entirely impossible without
networkaccess.
Thisdocumentcorrespondstomoodle.sty v0.5,dated2016/01/11.
1
Add pdf files together - Merge, append PDF files in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Provide C# Demo Codes for Merging and Appending PDF Document
merge pdf files; reader create pdf multiple files
Add pdf files together - VB.NET PDF File Merge Library: Merge, append PDF files in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET Guide and Sample Codes to Merge PDF Documents in .NET Project
add pdf files together reader; pdf combine pages
Once thequiziswritten,thereisnoeasywaytoviewandproofreadallthe
informationofwhichitismade. Eachquestioniseditedonaseparatewebpage,
whichissofullofoptionsthatitcannotbeviewedonasinglescreen. Aninstructor
has to spend much time e checking over the newly created d quiz in order to be
condenttherearenoerrors.
Addedtoallthisisthefrustrationofmanaginggraphics.Ifaquestionrequires
animage|say,askingacalculusstudenttointerpretthegraphofafunction|the
imagemustrstbeproducedasastandalonele(e.g.,inJPGorPNGformat),
uploadedtoMoodle,andthenchoseninaweb-basedHTMLeditor. Greatisthe
vexationoftheinstructorwhodecidedtoalteraquestion,astherearemoreand
morepossibilitiesoferrorwhenevermultiplelesmustbekeptsynchronized.
Users of LAT
E
X are also accustomed d tothe e speedand exibility that comes
fromdeningtheir ownmacros,whichmaybeasbrief as writing g \Rinsteadof
\mathbb{R}orascomplexasmacrosthatgenerateentireparagraphsoftext.The
Moodleeditor,bycontrast,requiresyoutotype\mathbb{R}everysingletimeyou
wantR.
Finally,thereisthequestionofarchivingandreusingone’swork.Much,much
work goes s into creatingMoodlequizzes, which thenreside e ona Moodle server
somewhereinthecloudinaformatneithereasilybrowsablenoreasilymodiable.
LAT
E
Xitselfhasthepowertosolveallthesediculties: itisswifttoeditand
swiftertocompileaL
A
T
E
X document,andthePDFmaybepreviewedonscreen
orprintedoutforeaseofproofreading. Mathematicalgraphicscanbeintegrated
withinthemainlethroughTikZ,andofcourseL
A
T
E
Xmacroscanbecustomized.
Usingthepresentmoodle.stypackage,aquizauthorcantypeaquizusingfamiliar
L
A
T
E
X syntax anddocument structure. . Uponcompilation, , L
A
T
E
X will generate
bothawell-organizedPDFthatiseasytoproofreadandanXMLlethatcanbe
uploadeddirectlytoMoodle.TheentireprocessisfarfasterthanusingMoodle’s
ownweb-basededitor,makesiteasier tocatchone’smistakes,andtheultimate
source code of one’s work is a human-readable .tex le that can n be e archived,
browsed,andeditedoine.
2 Work ow
TheprocessofcreatingaquizinMoodleusingthispackageisasfollows:
1. WriteaLAT
E
Xdocumentusing\usepackage{moodle}asdescribedbelow.
2. CompilethedocumenttoPDFusingpdfL
A
T
E
X. Thiswillalsoproducethe
lehjobnamei-moodle.xml.
3. OpenMoodle,navigatetothedesiredcourse, andunder r \Questionbank"
select\Import."
4. Select \Moodle XML L format," " choose the XML L le to o upload, andpress
\Import."
5. AfterMoodleveriesthatthequestionshavebeenimportedcorrectly,you
mayaddthemtoyourquizzes.
2
C# Word - Merge Word Documents in C#.NET
empowers C# programmers to easily merge and append Word files with mature input Word documents can be merged and appended together according to Add references:
c# merge pdf pages; attach pdf to mail merge in word
C# PowerPoint - Merge PowerPoint Documents in C#.NET
together according to its loading sequence, and then saved and output as a single PowerPoint with user-defined location. C# DLLs: Merge PowerPoint Files. Add
.net merge pdf files; batch combine pdf
3 Usage
3.1 ExampleDocument
Thefollowingpagespresumethereaderalreadyhassomefamiliaritywithcreating
andeditingMoodlequizzesthroughthewebinterface. Thexkeyvalpackage e is
usedtoprovideakey-valueinterface. Hereisasimpleexampledocument:
\documentclass[12pt]{article}
\usepackage{moodle}
\begin{document}
\begin{quiz}{My first t quiz}
\begin{numerical}[points=2]{Basic addition}
What is $8+3$?
\item 11
\end{numerical}
\begin{shortanswer}[case sensitive=true]{Newton’s name}
What was Newton’s s first t name?
\item Isaac
\item[fraction=0, feedback={No, silly!}] ] Fig
\item{fraction=0} Sir
\end{shortanswer}
\begin{multi}[points=3]{A first derivative}
What is the first t derivative of $x^3$?
\item $\frac{1}{4} } x^4+C$
\item* $3x^2$
\item $51$
\end{multi}
\end{quiz}
\end{document}
Keyfeatures tonoteinthis rst examplearethat aquizenvironment contains
severalquestionenvironments. Eachquestiontakesanameas s amandatoryar-
gument,anditmayalsotakeoptionalkey-valueargumentswithinbrackets. The
questionenvironmentsresemblelistenvironmentssuchasitemizeorenumerate,
inthatanswersaresetoby\item’s,butthequestionitselfisthetextthatoccurs
beforetherst\item.
Ifthepackageoptiondraftisinvoked,bycalling\usepackage[draft]{moodle},
draft
thennoXMLlewillbegenerated. Thisisespeciallyusefulwhileeditingaquiz
containinggraphics,soastoavoidthetimespentconvertingimageles.
3
C# PDF Convert to Text SDK: Convert PDF to txt files in C#.net
can be copied and pasted to .txt files by keeping text by a method loses the original PDF document layout and all the paragraphs are joining together, our C#
add pdf files together; pdf combine
VB.NET Word: How to Process MS Word in VB.NET Library in .NET
Imaging.MSWordDocx.dll", which, when used together with other online tutorial on how to add & insert controls, PDF document, image to pdf files and components
acrobat combine pdf; pdf merge files
3.2 QuizandQuestionEnvironments
A .tex document togenerateMoodlequizzes contains one or more quizenvi-
quiz
ronments,withinwhichvariousquestionenvironmentsarenested. Therequired
argumenttothequizenvironmentnamesthe\questionbank"towhichtheques-
tionsinsidewillbelongafterbeinguploadedtomoodle.
\begin{quiz}[hoptionsi]{hquestionbanknamei}
Therearenoquiz-specicoptions,butanyhoptionsisetwith\begin{quiz}will
beinheritedbyallquestionscontainedwithinthatquizenvironment.
Options may also be e set t at any y time with h \moodleset{hoptionsi}; ; these
\moodleset
changesarelocaltoT
E
X-groups.
Thesyntaxforeachquestionenvironmentis
\begin{hquestiontypei}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\itemhitemi
.
.
.
\itemhitemi
\end{hquestiontypei}
Themeaningofthehitemisvariesdependingonthequestiontype,buttheyusually
areanswerstothequestion.Detailswillbegivenbelow.
Thefollowingkey-valueoptionsmaybesetforallquestions:
Bydefault,eachquestionisworth1pointonthequiz. Thismaybechanged
points
default grade
with the e points s key or its synonym, default grade; for r example, , points=2
makesthatquestionworthtwopoints.
Thepenaltyisthefractionofpointsthatistakenoforeachwrongattempt;
penalty
itmaybesettoanyvaluebetween0and1. Thedefaultispenalty=0.10.
In most question types, , it is s possible e to designate e some e answers s as being
fraction
worthpartialcredit|thatis,somefractionofacompletelycorrect answer. . The
fractionkeymaybesettoanyintegerfrom0(entirelywrong)to100(entirely
correct).
Thefeedbackkeysets textthatwillappeartothestudentafter completing
feedback
thequiz.Forexample,onemightset
feedback={A question like this will l appear r on the exam.}
Thedesiredfeedbackshouldbeincludedinbraces.
Twokindsoffeedbackcanbegiven.Ifthefeedbackkeyissetforaquestion,
thenthatfeedbackwillappeartoeachstudentregardlessofthestudent’sanswer.
Answer-specic feedback (perhaps explaining a commonmistake) may y also o be
givenbysettingthefeedbackkeyattheindividualanswer.
4
C# Excel - Merge Excel Documents in C#.NET
and appended together according to its loading sequence, and then saved and output as a single Excel with user-defined location. C# DLLs: Merge Excel Files. Add
c# combine pdf; append pdf
C# TIFF: TIFF Editor SDK to Read & Manipulate TIFF File Using C#.
Support converting other files to Tiff, like Word, Excel, PowerPoint, PDF, and images. Enable to add XImage.OCR for .NET into C# Tiff imaging application
batch pdf merger; reader merge pdf
3.3 QuestionTypes
Wenext discussthevarious questiontypessupportedby moodle.styandtheop-
tionsthatmaybeset.
3.3.1 MultipleChoice
Thesyntaxforaclassicmultiplechoicequestion,withonlyonecorrectanswer,is
multi
asfollows:
\begin{multi}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item*hcorrectansweri
\item[hoptionsi]hwrongansweri
.
.
.
\item[hoptionsi]hwrongansweri
\end{multi}
Thecorrect answer is designatedbytheasterisk *after the\item; itneednot
appearrstinthelist.
ThebooleankeyshuffledetermineswhetherMoodlewillrearrangethepos-
shuffle
sibleanswersinarandomorder. Settingshuffle=falsewillguaranteethatthe
answerappearintheordertheyweretyped;thedefaultisshuffle=true.
Moodleoersdierentoptionsfornumberingthepossibleanswers. Youmay
numbering
setthenumberingkeytoanyofthefollowingvalues,whichmirrortheusualL
A
T
E
X
syntax: alph,Alph,arabic,roman,Roman,andnone. Callingnumbering=none
produces anunnumberedlist of answers. . TheMoodle e syntaxof abc,ABC,123,
iii, and IIII is s also o acceptable, , but note e that t it t requires s four r I’s s to o obtain
upper-caseRomannumeralsthisway.
Thefractionkeycanbeusedtodesignatesomewronganswersasbeingworth
fraction
partialcredit.Forexample,aquestionmightreadthus:
\begin{multi}{my question}
Compute $\int t 4x^3\,dx$.
\item* $x^4+C$
\item[fraction=50] $x^4$
\item $12x^2$
\end{multi}
Thus the asterisk *is shorthandforfraction=100, , whereas s a a bare\item sets
fraction=0.
Bydefault,themultienvironmentproducesamultiplechoicequestionoper-
single
multiple
ateswithonlyonecorrectanswer;thisiscalledsinglemode,andonMoodleit
appearswithradiobuttons. Itisalsopossibletowritequestionswithmorethan
onecorrect answer,askingtheusertocheckallcorrectanswers. Todothis,use
thekeymultipleorsingle=false.
5
C# Image: C# Code to Encode & Decode JBIG2 Images in RasterEdge .
Easy to add C# JBIG2 codec controls to your image and codec into PDF documents for a better PDF compression; text to the new project folder, together with .NET
acrobat reader merge pdf files; pdf combine two pages into one
VB.NET PDF Text Search Library: search text inside PDF file in vb.
and find text content in multiple page adobe PDF files in .NET Our VB.NET PDF Document Add-On enables you to search for text in target PDF document by using
c# merge pdf files into one; combine pdf online
Theworthofeachcorrectanswersinmultiplemodemaybesetbyfraction,
butMoodlewillrequirethatallthefractionsadduptoatleast100. Ifyousimply
designateeachcorrectanswerwith\item*,thenmoodle.stywilldividethe100%
equallyamongthoseanswers. Forexample,thefollowingtwoexamplesproduce
equivalentresults:
\begin{multi}[multiple]{my question}
Which numbers s are prime?
\item* 5
\item 6
\item* 7
\item 8
\end{multi}
\begin{multi}[multiple]{my question}
Which numbers s are prime?
\item[fraction=50] 5
\item 6
\item[fraction=50] 7
\item 8
\end{multi}
3.3.2 Numerical
AnumericalquestioninMoodle requiresthestudent toinputarealnumber in
decimalform.Itstypicalformatis
\begin{numerical}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item[hoptionsi]hcorrectansweri
\end{numerical}
If there is more than n one e correct answer, , additional l \item’s s may be included.
Becausethisisnotamultiplechoicequestion,thereisnoneedtoprovideincorrect
answers. Theremay y nevertheless bereasons toinclude incorrect answers. . For
example,partiallycorrectanswersmaybespeciedbysettingthefractionkey.
Feedbackforacommonmistakemaybegivenbyincludingtheincorrectanswer
likethis:
\item[fraction=0,feedback={You forgot t to o antidifferentiate!}]hincorrectansweri
6
3.3.3 ShortAnswer
Ashortanswerquestionresemblesanumericalquestion: thestudentistollina
textboxwithamissingwordorphrase.
\begin{shortanswer}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item[hoptionsi]hcorrectansweri
.
.
.
\item[hoptionsi]hcorrectansweri
\end{shortanswer}
Youcanmakethetextboxappearaspartofthequestionwiththecontrolsequence
\blank.Forexample,yourquestionmightread
\begin{shortanswer}{Leibniz}
Newton’s rival l was s Gottfried d Wilhelm m \blank.
\item Leibniz
\item Leibniz.
\end{shortanswer}
Notethatastheblankoccurredattheendofasentence,weincludedtwoanswers,
leststudentsgetthequestionwrongmerelybyincludingoromittingaperiod.
Bydefault,Moodleignoresthedistinctionbetweenupper-andlower-caselet-
case sensitive
usecase
terswhengradingashortanswerquestion.Youcanmakeaquestioncase-sensitive
withthekeycase sensitiveoritsshortersynonymusecase.
3.3.4 EssayQuestions
InstructorsmayaskessayquestionsonaMoodlequiz,althoughMoodle’ssoftware
isnotuptothetaskofgradingthem! Insteadeachessayquestionanswer r must
begradedmanuallybytheinstructororateachingassistant.
\begin{essay}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item[hoptionsi]hnotesforgraderi
.
.
.
\item[hoptionsi]hnotesforgraderi
\end{essay}
Insteadofcontaininganswers,the\itemtagsfortheessayquestioncontainnotes
thatwillappeartowhoeverisgradingthequestionmanually.
AlthoughMoodlecannotgradethecontentofanessayquestion,itcanatleast
response required
determinewhetherthequestionhasbeenleftblank. Iftheresponse e required
keyisset,Moodlewillinsistthatthestudententersomethingintheblankbefore
acceptingthequizascompleted.
7
Moodle oers ve e dierent t ways for r students s to o enter r and/or r upload d their
response format
answerstoanessayquestion. Youmaychooseoneoftheseveoptions:
html AneditorwiththeabilitytoformatHTMLresponsesincludingmarkupfor
italics,boldface,etc. Thisisthedefault.
file Alepicker allowingthestudent touploadale,suchasaPDForDOC
le,containingtheessay.
html+file ThesameHTMLeditorasabove,butwiththeabilitytouploadles
aswell. Thispermitssomestudentstotypeanswers s directly intotheweb
form,andotherstocomposetheiressaysinanotherprogramrst.
text Thiseditorallowsonlyforenteringplaintextwithoutanymarkup.
monospaced Thisyieldsaplaintexteditor,withoutanymarkup,andwithaxed-
widthfont.Thiscouldbeusefulforenteringcodesnippets,forexample.
The key response e field d lines controls the height of the input box. . The
response field d lines
defaultisresponse field lines=15.
Theattachments allowedkeycontrols s how manyattachmentsastudentis
attachments allowed
allowedtoupload. Permissiblevaluesare0,1,2,3,orunlimited.
Youmayalsorequirethestudenttouploadacertainnumberofattachments
attachments required
bysettingattachments requiredto0,1,2,or3.
Finally,youmaypreloadtheessayquestionwithatemplatethatthestudent
response template
willeditand/ortypeover,withthekeyresponse template={htemplatei}. The
htemplateishouldbeenclosedinbraces.
3.4 MatchingQuestions
Amatchingquestionoersaseriesofsubquestionsandasetofpossibleanswers
fromwhichtochoose.Iftherearemquestionsandnpossibleanswers,amatching
questionwilllooklikethis:
\begin{matching}[hquestionoptionsi]{hquestionnamei}
hquestiontexti
\item[hoptionsi]hquestion1i\answerhanswer1i
\item[hoptionsi]hquestion2i\answerhanswer2i
.
.
.
\item[hoptionsi]hquestionmi\answerhanswermi
\item[hoptionsi]\answerhanswerm+1i
.
.
.
\item[hoptionsi]\answerhanswerni
\end{matching}
Answers1throughmcorrespondtoquestions1throughm;answersm+1through
nare\decoy"answers.Ifmultiplequestionsshouldhavethesameanswer,besure
8
yourtypedanswermatchexactly,sothatMoodlewillnotcreateduplicatecopies
ofthesameanswer!
Thematchingquestionacceptstheoptionofshuffletorandomlypermute
shuffle
thequestionsandanswers;bydefaultshuffle=true.
Moodlehastwoformatsformatchingquestions. Theoldermatchingquestion
drag and drop
dd
oeredadropdownboxforchoosingtheanswertoeachquestion;thenewer\drag
anddropmatching"formatshowsallquestions inonecolumn, , allanswers s ina
secondcolumn, andallowsstudentstodragthecorrect answer r to o the question
usingamouse. Toenabledrag-and-dropmatching,usethekey‘drag g and drop’
or‘dd’forshort. Thedefaultis s dd=false. . Ifyouchoosetheolderformat,then
duetothelimitationsofdropdownboxes,noLAT
E
XorHTMLcodecanbeused
intheanswers.
3.5 ClozeQuestions
A \cloze e question" " has one e or more e subquestions s embedded within a passage
of text. . For r example, , you might ask students to ll in several missing words
within asentence, or r calculate several l coecients of a polynomial. . To o encode
clozequestionsinL
A
T
E
Xusingthispackageiseasy: yousimplynestoneormore
multi,shortanswer,ornumericalenvironmentswithinaclozeenvironment,as
inthefollowingexample:
\begin{cloze}{my cloze question} } \\
Thanks to calculus, , invented d by Isaac
\begin{shortanswer}
\item Newton
\end{shortanswer},
we know w that the derivative of $x^2$ is
\begin{multi}[horizontal]
\item $2x$
\item* $\frac{1}{3} } x^3 + + C$
\item $0$
\end{multi}
and that t $\int_0^2 x^2\,dx$ equals
\begin{numerical}
\item[tolerance=0.0004] 2.667
\end{numerical}.
Thanks, Isaac!
\end{cloze}
Notethat whenusedas asubquestionwithinacloze question, \begin{multi}
is not t followedby y name in n braces; ; the e same is true for the shortanswer and
numericalenvironments.
Withinaclozequestion,bydefaultamultiplechoicequestionisimplemented
vertical
horizontal
as an n inline e dropdownbox. . This s is s visually y compact, but it alsoprevents s the
useofmathematicalorHTMLformatting. Addingtheoptionverticaldisplays
thesubquestionasaverticalcolumnofradiobuttonsinstead;likewisetheoption
horizontalcreatesahorizontalrowofradiobuttons.
9
4 ConversiontoHTML
QuestionsshouldbetypedasusualforLAT
E
X,including\$toobtaindollarsigns,
$’s for r mathshifts, , $$’s s for r display math, , et t cetera. . The e package e moodle.sty
automaticallyconvertsthisLAT
E
XcodeintoHTMLforwebdisplay.
ThefollowingtablelistsLAT
E
Xcommandsandenvironmentsthatwillbecon-
vertedtoHTML:
~
\#
\$
\&
\\
\S
\{
\}
\emph
\textbf
\par
\ldots
\dots
\relax
\euro
\texteuro
\begin{center}
\begin{enumerate}
\begin{itemize}
\begin{tikzpicture}
Singleanddoublequotationmarksandthediacriticalcommands \^,\’,\‘,\",
\~,and\Harealsohandled,asarethecharacters\aa,\ae,\o,\ss,\l,andtheir
capitalizations.
Inaddition,< and>willbe convertedto &lt; and&gt;withinmath mode
only. Iftheyshouldbetypedoutsideofmathmode,theywillbepassedastyped
totheHTML,andprobablyinterpretedbystudents’browsersasHTMLtagsor
otherunpredicatedresults.
Beawarethatmoodle.stydoesnotknowhowtoconvertanyotherT
E
XorLAT
E
X
commandstoHTML.Ifothersequencesareused,theymaybepassedverbatim
totheXMLleormaycauseunpredictedresults.
IfyouthinkofanotherLAT
E
XcommandthatshouldbechangedtoanHTML
equivalent,pleasecontacttheauthoratanders.hendrickson@snc.edusothatit
maybeaddedtoafuturerevisionofthepackage.
5 Graphics
The moodle.sty y packagecanhandletwo o kinds s of graphics seamlessly. . External
graphics les may be includedwiththe \includegraphics commandfrom the
graphicxpackage,andgraphicsmaybegeneratedinternallyusingTikZ.Inei-
thercase,thegraphicswillbeembeddedinbase-64encodingdirectlywithinthe
MoodleXMLproduced. Thisprevents s thehassleofmanagingseparategraphics
lesontheMoodleserver,asMoodlewillstorethepicturewithinthequestionin
thequestionbank.
When using g \includegraphics, , the e only options s currently y supported are
\includegraphics
height
width
heightandwidth. Attemptsto o use other r \includegraphics options,suchas
scaleorangle,willaectthePDFbutnottheXMLoutput.Thedimensionsset
byheightandwidthareT
E
Xdimensionssuchas4inor2.3cm.Inordertopre-
paretheimageforwebviewing,thispackageconvertsthosedimensionstopixels
10
Documents you may be interested
Documents you may be interested