fix bug in writing equation tags in latex output; special characters (`& % $ # _ { } ~ ^ \`) were not escaped