Skip to first unread message

David Wishart

Jun 24, 2021, 6:05:18 AMJun 24
to Numbas Users
I've started using the chemistry extensions and wonder if it's possible to include the British spelling of sulphur?

I've written a question that handles it

but it gets unwieldy if I want to test more elements at the same as I need to use the likes of 

"if(element_name1="sulfur","Sulphur",element_name1)" [name1 variable in example]
to convert the display text or

"if(element_name2="sulfur","sulphur|sulfur",element_name2)" [name2 variable in example]
as a pattern to match if I want to accept either spelling.

Alternatively, is there a neater way of doing this?

Christian Lawson-Perfect

Jun 28, 2021, 6:02:12 AMJun 28
If you only want to accept 'sulphur' and not 'sulfur', you could add this line to the question's JavaScript preamble:

Numbas.extensions.chemistry.element_with_name('sulfur').name = 'Sulphur'

If you want to accept both, I suppose you would have to do a special case, like you've got in that question.

I'm not a chemist, but my memory from when I was doing GCSE ~20 years ago was that we in the UK were switching to use 'sulfur' to match the rest of the world. Is that not the case?

You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web, visit

David Wishart

Jul 12, 2021, 5:16:31 AMJul 12
to Numbas Users
Thanks for that, it's for an online course which could include students from outside the UK so I'd prefer to accept both versions. I am also not a chemist but this question came from one of our chemical engineering lecturers so we use sulphur here.
Reply all
Reply to author
0 new messages