Move LaTeX stuff to external file.

Remove "always open in tabs" thing, it screws up a lot.