Fix dollar literals interpreted as LaTeX formulas
This merge request adds escaping to some dollar literals which were missing it, which would cause some lines to be interpreted as LaTeX formulas. Also fixes a space issue around formulas in one file.