improve latex mode