Fix occasional untypesetting of formulas at start of line.
Better functions to compare positions/ranges (TODO: tests).