fixed some annoying latex syntax bugs (like forgotten $), so it all compiles