Issues with randomised <, >, \le, \ge

1 view
Skip to first unread message

joshua...@gmail.com

unread,
Dec 8, 2025, 7:54:35 PM (5 days ago) Dec 8
to Numbas Users
I am working on some material at our institution and noticed that following spacing issues with randomised inequalities (see screenshot for code and output).

Wrapping the inequality symbol in \mathrel gives the spacing I expect, but I didn't think this should be necessary. I was unable to find any discussion of this in the google group or the Numbas documentation so I wanted to start this conversation.

A little part of me is hoping this is a bug that an be fixed for all questions without having to hunt up and add \mathrel to all the questions.

For completeness, the variable {ineq} was generated via the JME code random(latex(">"),latex("\\ge"),latex("<"),latex("\\le"))
issues_with_randomised_inequalities_image.png

Christian Lawson-Perfect

unread,
Dec 9, 2025, 5:21:33 AM (5 days ago) Dec 9
to numbas...@googlegroups.com
This was due to a change I made in August, to always wrap the output of the \var and \simplify commands in curly braces.
The motivation was expressions like e^\var{x}. When x is negative, you need curly braces so that both the minus sign and the digits are rendered in superscript.
The downside is that relations like the inequality symbols don't get the right spacing when they're wrapped in curly braces.

I've made a change so that generated TeX code is only wrapped in curly braces if it starts with a - or + character. It's a fudge, but I hope it'll work well.

--
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 numbas-users...@googlegroups.com.
To view this discussion, visit https://groups.google.com/d/msgid/numbas-users/f4386f84-f516-4562-a410-7bc622df330cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages