Numbas v9.0

I’m pleased to announce the release of v9.0 of Numbas. This is a major release with an almost completely rewritten default theme, and some big structural changes inside.

Numbas runtime

I’ve tagged v9.0 of the Numbas runtime on GitHub.

Rewritten default theme

I’ve spent the last year rewriting the default theme from scratch, using newer browser features and removing a lot of old libraries that we don’t need any more.

The default theme now uses MathJax 4, the latest version which has just been released. There are many improvements to rendering and accessibility.

The big motivation to rewrite the theme was to improve accessibility by allowing more customisation options.

The theme now supports light and dark modes, so if your device requests it you’ll get light text on a dark background.

If you need something different, you can now change all of the colours used on the page. The default colour scheme maximises contrast between text and the background. When you choose your own colours, it matches the contrast level between your main text and background colours, so you can easily set up a low contrast colour scheme if that’s what you need.

The Numbas exam interface with customised colours.

There’s now an option to choose the font used for text; you can choose from sans-serif, serif or monospace. We didn’t want to bundle extra fonts in with every exam package, but it’s fairly straightforward to add extra fonts in a custom theme or extension.

There’s also a slider to change the weight of text, to make it lighter or heavier. The built-in fonts in most browsers only support two weights – “normal” and “bold” – but some newer fonts allow a continuous range of weights.

You can change the amount of spacing around elements in the interface.

The navigation controls in explore mode questions have been changed. You’re initially shown just the name of the current part and a button to go back to the previous one, but you can expand this to show the full tree of parts. When using a keyboard to navigate, you can move around the tree view with the arrow keys.

You can now use arrow keys to move between questions in the question list, and the tab key only moves in and out of the list. You can also type the name or number of a question to move to it immediately.

Generic runtime

Prompted by a request from a Numbas user in Africa to reduce the amount of data that students must transfer when accessing Numbas exams, I had a go at making a generic “library” version of the Numbas code that could be used to run any exam, instead of compiling each exam into its own self-contained package.

This was a big success: the generic runtime works so well that I’ve made the editor use it, making previews load much faster and saving us a lot of disk space on the server.

At Newcastle, we’re planning to use this to embed short Numbas questions inside our Chirun notes.

When you download an exam as a standalone .zip file or a SCORM package, it’ll still be completely self-contained. The Numbas LTI provider will continue to use these standalone packages, so you can be confident that an exam used by students will never change.

You can use this: there’s a new page in the documentation on embedding Numbas content in other pages.

I’ve set up a short demo page as an example.

Breaking changes

We’ve updated the list of minimum supported browser versions:

  • Chrome version 112 (released 2023-04-04).
  • Firefox version 117 (released 2023-08-29).
  • Edge version 112 (released 2023-04-06).
  • macOS Safari version 16.5 (released 2023-09-18, with MacOS Sonoma).
  • iOS Safari (iPhone/iPad) version 16.5 (released 2023-09-18).
  • Safe Exam Browser for Windows version 3.6 (released 2023-12-06).

You can always get the most up to date list of supported browsers from the documentation.

We aim for compatibility with at least 95% of browsers in use, as measured by MDN.

Because this is a big leap, we’ve kept the old theme available for exams where you know that some students will use old browsers. It’s called “Pre-2025 Standard (deprecated)”.

Any custom themes on numbas.mathcentre.ac.uk which used to inherit from the default theme have been changed to inherit from the pre-2025 theme. Most of these themes just changed colours or logos, so should be safe to work with the new default theme instead. To do this, change the file inherit.txt to contain the text default instead of old-default-2024.

The default theme no longer loads the jQuery library. Any questions with custom JavaScript expecting to use it will need to be updated. Look for function calls like $(...) or jQuery(...). I only expect this to affect old questions with custom JavaScript to modify elements in the page, which hasn’t been a recommended technique for many years.

There are a few changes to the loading mechanism which the theme must use. The old default theme has been updated, so most themes which build off it should be OK, but if you’ve overridden certain template files, you might need to update your theme too.

In JavaScript, the Numbas.tryInit function is no longer used. It’s still present but does nothing, so code using it doesn’t have to be updated.

While we’ve tried to test the new version as well as possible, I expect that there will be quite a few old questions still in use that need updating. If you encounter a problem with a question or exam that used to work, please tell us about it and we’ll do our best to fix it.

Other enhancements

  • The question list and the results table at the end show score totals for each question group. (issue)
  • “Match choices with answers” parts now have “text before choices” and “text above answers” settings. (docs)
  • The “allow students to print question content?” option has changed to “allow student to print their transcript?”. If it’s turned off, then students can’t print anything. (docs)
  • In “choose one from a list” parts, there is now an option to show a blank choice in drop-down list. (issue, docs)

Bug fixes

  • Custom functions in a scope are aware of all other custom functions. (code)
  • Fixed variable replacements for destructured variables. (code)
  • Fixed a bug to do with clearing the answer to a multiple choice part. (code)
  • The html JME function only tries to set the data-interactive attribute on element nodes. (code)
  • When representing a multiplication, a multiplication symbol is always used when the right-hand side is a negative number. (code)
  • The worksheet theme doesn’t display the instructor-only version of the interface. (code)
  • The mark_part JME function copes with pre-submit tasks. (code)
  • Warnings aren’t automatically shown as soon as they’re made. (code, issue)
  • The displayed pass percentage is rounded to a nice value. (code, issue)
  • Fixed the positioning of warning boxes. (code)
  • The diagnostic mode copes with the question group for a topic not existing. (code)
  • Fixed XSLT transforms in Firefox 137 and removed the Sarissa library. (code)
  • The footer with the copyright notice is now shown inside all info pages and at the end of question content. (code)
  • Rules like “no unknown functions” are applied to the correct answer for mathematical expression parts in JavaScript, as well as in the marking algorithm. (code)
  • The sqrtProduct and sqrtDivision rules use agc flags, so apply to more cases. (code)
  • In the “relative difference” equality checking function, the absolute value of the maximum error is used. (code)
  • When loading, a question isn’t considered ready until all of its parts have finished submitting. (code)
  • The check for whether an HTML element is interactive only checks element nodes, dealing with the case where an HTML variable contains just a text node. (code)
  • Exam storage is only initialised after all of the questions are ready. (code)
  • If math.Fraction is given a non-integer value, the numerator and denominator are scaled up to integers (code)
  • In mathematical expression parts, subscripts in the names of variables in the variable generators dictionary are normalised. (code)
  • Fixed some parsing errors with anonymous functions. (code)
  • The JME isa function evaluates the left argument if it’s not a name. (code)
  • Fixed how anonymous functions are rendered as JME strings. (code)
  • The parser copes with implicit multiplication inside or after anonymous functions. (code)
  • Fixed a bug where a gap-fill part with no pre-submit tasks in its gaps would still behave as if it had pre-submit tasks. (code)
  • When you magnify an image, it’s drawn on a white background so it’s easier to view images with transparent parts. (code, issue)

Extensions

  • GeoGebra: Made a change to the loading routine, following a change in the GeoGebra API. (code)
  • JSXGraph: Gaps with a jxg_output note will auto-submit the parent gapfill part, and auto-submission only happens after the student has interacted with the diagram. (code)
  • JSXGraph: Boards are only linked to parts once the question is ready. (code)
  • Permutations: The cycles() function only returns non-trivial cycles. (code)
  • Spreadsheets: There’s a new range_as_numbers function. (code)
  • Spreadsheets: sheet[ref] correctly returns an empty string for a single empty cell. (code)

Numbas editor

I’ve tagged v9.0 of the Numbas editor on GitHub.

Data export

You can now export your data from the editor. You can ask for a package containing all of your own material, or a package containing everything in a particular project.

"Your data exports". A button labelled "Export all of your data" above a table listing export files.

If you’re running your own server, you now also need to run a huey process to manage data exports. The installation instructions have been updated accordingly.

Enhancements

  • You can change the filenames of resources, and replace them by re-uploading them. (issue)
  • The server allows any domain origin to request editoritem source, so pages using the generic runtime can load exam definitions directly from the editor. (code)
  • The links to download exam packages or source files include the token so they can be accessed without logging in to the editor. (code)
  • Themes are sorted case-insensitively, but the standard theme is always first. (code)
  • The resources tab shows the sizes of resource files and warns if they’re too big. (code)

Bugs fixed

  • Item slugs are truncated to 50 characters, fixing a bug which affected the LTI provider. (issue)
  • Fixed a bug in the folder view when moving items to the top level of a project. (code)
  • Errors when making a custom function are caught and shown. (code)
  • Some database queries are more efficient. (code)
  • Only the preferred locale’s translations are included in the page. (code)

Numbas lockdown browser

  • We’ve removed the “Test” button from the screen that is shown if you launch the app on its own. Students were confused by it. (code)
  • Because of a change to security in Ubuntu, we no longer make AppImage versions. There is still a .deb version. Talk to us if you need a Linux version in a different format. (code)
  • The Windows installer tries to set the reigstry keys needed to associate the app with numbas: URLs. (code)
  • Any surplus whitespace around the password is ignored. (code)

Numbas LTI provider

I’ve tagged v4.3 of the Numbas LTI provider on GitHub.

There are just a few small changes to the LTI provider. We’ve had to update the automatic re-marking page to work with the new Numbas runtime, so I recommend you upgrade as soon as possible.

Enhancements

  • We’ve improved the layout of the replace exam form. (issue)
The "Replace the exam package" form. There are three boxes: "Update existing attempts?", then "Fetch from the editor" next to "Upload a new exam package".
  • The re-mark page sorts attempts by the student’s last name by default. (issue)
  • Students can open completed attempts without seeing scores before full review mode is open. (code)
  • When launching a resource through the lockdown app, the LTI provider checks that you’re using a minimum supported version. (code)

Bugs fixed

  • The lis_person_sourcedid field is stored with the LTI 1.3 user alias record. (code)
  • Attempts with no suspend data report no end time. (code)
  • The routine to fetch available exams from an editor link copes with receiving invalid data. (code)