Fixed code formatting and legacy LaTeX macro calls.