Cleaning up some of the latex code. moved to latex.js