Escape characters from supplied text so they are suitable for passing to LaTeX.