Method: String#escape_to_latex

Defined in:
lib/maruku/output/to_latex_strings.rb

#escape_to_latex(s) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/maruku/output/to_latex_strings.rb', line 31

def escape_to_latex(s)
	s2 = ""
	s.each_byte do |b|
		if LATEX_TO_CHARCODE.include? b
			s2 += "{\\tt \\char#{b}}" 
		elsif LATEX_ADD_SLASH.include? b
			s2 << ?\\ << b
		elsif b == ?\\
		# there is no backslash in cmr10 fonts
			s2 += "$\\backslash$"
		else
			s2 << b
		end
	end
	s2
end