Fixed/simplified diff output for tests.
Escape `|` as `\vert` in LaTeX math.

This avoids a clash with highlighting-kate's macros, which
redefine | as a short verbatim delimiter.  Thanks to
Björn Peemöller for raising this issue.