public Method

ToLaTeX.escape(str)

Escape a LaTeX string

Source Code

# File rdoc/markup/simple_markup/to_latex.rb, line 64
def escape(str)
# $stderr.print "FE: ", str
  s = str.
#        sub(/\s+$/, '').
    gsub(/([_\${}&%#])/, "#{BS}\\1").
    gsub(/\\/, BACKSLASH).
    gsub(/\^/, HAT).
    gsub(/~/,  TILDE).
    gsub(/</,  LESSTHAN).
    gsub(/>/,  GREATERTHAN).
    gsub(/,,/, ",{},").
    gsub(/\`/,  BACKQUOTE)
# $stderr.print "-> ", s, "\n"
  s
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.