wrap throw exception to get stack traces; parse latex macros