There is a line in which a reference is inside a maths environment
(enforced by `\ensuremath`).  As these are references, they are
actually text elements so should be in `\text` commands.