preview: support for writing gen. tex file to disk

Signed-off-by: Thomas Hisch <t.hisch@gmail.com>