Code de-duplication in the validateMathInLine stuff
Merge branch 'mathvalidation'