LaTeX parser code organization and improvement