Refactors Latex.