Added support for own documentclass

and complete LaTeX header replacement.
This closes #54.