added fileopt as passable param.
fixed titles so that if latex is present it defaults to 'untitled'