LaTeX plugin refactored and tested