Numbas v1.6: template questions, custom marking, and more!

We’ve just released some major new features for Numbas, which means we’ve bumped the version number up to v1.6.

The two big changes are template questions and custom marking scripts.

Template questions

For a long time, we’ve wanted a way to set up generic questions on concepts that are used across many subjects, such as hypothesis testing or numeracy, and make it easy for teachers from different fields to copy them and make subject-appropriate changes without having to worry too much about how the rest of the question is set up. Our solution was to rejig the variable definitions tab in the question editor, so it now looks like this:

variable list smallFirst of all, variables can now be grouped, so you can separate out all the variables you want teachers to edit. Next, you can specify the data type of a variable, so the editor provides a nicer interface instead of JME code. Each variable now has a description field, so you can give some hints about how to use it. Finally, there are lists of which variables the current variable depends on and is used by, to make it easier to backtrack a complicated calculation.

With all these changes, it’s now possible to set up a question where a teacher just needs to modify a few clearly labelled variables, and maybe reword the question prompts, without writing any LaTeX or JME code. I’ve written an example template question about a two-factor ANOVA test. The calculations involved in setting up and marking the question are really complex, but you can just change the names of the factors and parameters of the distributions they’re generated from, to get a customised version of the question with a full worked solution.

Custom marking

A while ago, we added JavaScript and CSS preambles to questions. This lets you add custom code to change the look of the question, or set up dynamic elements such as interactive graphs. Eventually we started using it to override the built-in marking algorithms. That was very powerful but a bit awkward, so I decided we needed a nicer interface to set up custom marking scripts. As a result, each part now has fields to define custom marking and validation scripts:

custom marking small


The marking script is run whenever the student clicks the “Submit answer” button. You can get their answer, do whatever you like with it, and then give the appropriate amount of credit, along with feedback messages.

The validation script runs after the marking script, and should be used to give warning messages when the student’s answer can’t be marked.

The marking scripts open up loads of new possibilities for question types. I’ve put together a few examples in an exam on the mathcentre editor; they do the following:

These are just a few examples of what you can do with marking scripts. Our next step is to work out which patterns come up most often, and provide convenience functions to make them easier to reuse, instead of writing lots of boilerplate code each time.

Other changes

It’s been a while since I last posted about new Numbas releases, so here’s a list of other things that have changed since v1.5:

  • Questions and exams are now saved in JSON format instead of the custom format developed before we had the web-based editor. This removes an intermediate step which caused a few bugs over the years. Files also have a version string attached to them, which means we can automatically update old files when the format changes.
  • I’ve documented all the APIs used in the Numbas runtime. This should be useful for anyone writing extensions, or using the new preamble and marking script features. The documentation is published at
  • Numbas supports the SCORM “review” entry mode, for looking at an attempt after it’s finished. If you’re using Moodle, our fork of the SCORM module tailored for Numbas allows use of the review mode.
  • There’s an “allow pausing” option in the exam timing settings, which can be useful if you’re running an invigilated, timed session.
  • We found that students were often failing to submit their answers, for one reason or another. It’s now impossible to leave a question with unsubmitted answers.unsibmitted changes
  • Students taking Numbas tests at home often suffer from unstable internet connections. The SCORM save method now blocks progress until it succeeds, so students know when their data has been saved. (This is mainly for Moodle – note that Blackboard’s SCORM module saves asynchronously, so it handles this stuff on its own, and Numbas always thinks saving has succeeded)
  • It’s now possible to ask a student to give an answer to a numberentry part to a specific number of decimal places or significant figures. By default it requires trailing zeroes when necessary to make up the correct precision, but you can disable that. This was much-requested by engineers!precision restriction
  • When you press Print from the default theme, it now prints every question instead of just the one you’re currently looking at – useful for producing proof you’ve attempted the test, or for taking a copy to your teacher.
  • Copied questions and exams show a link to the original version.
  • There’s now a link in your profile page in the editor to download backups of all your questions and links
  • Pretty much every field in the editor has a link to the relevant section of the documentation next to it.
  • There’s a “Copy this part” button on each part – useful when you’re setting up a big gapfill with many similar gaps.copy this part
  • The exam question search now has a tab showing a list of your most recently edited questions. Finding questions on that page has never really worked, and most of the time you want to add a question you’ve just been editing, so we decided to add this simpler route.recent questions
  • The installation instructions for the editor have moved to
  • Themes and languages have more descriptive names in the editor dropdowns instead of their codenames.locale names
  • The editing pages in the editor show a “Loading” message when you open them instead of just hanging your browser for a few seconds.

Gosh, what a lot of new stuff! And this isn’t the end: here’s a picture of Bill and me negotiating how many more features I need to implement this Summer.

cit workshop(Actually, that’s just the funniest photo of us taken by Darragh Kane at the workshop we delivered in Cork Institute of Technology last month)

As always, you can try out these new features on the free publicly-available editor hosted at mathcentre, or download the source code from our GitHub repositories.