Add output type to reader and formatter
Refactor formatter to two separate classes one for html and other for latex