class String SPECIAL_TEX_CHAR_TABLE = { "'" => "\\textquotesingle ", "\"" => "\\textquotedbl " # TODO: see which one works.. "\textquotedbl " }.freeze def tex_safe safe_string = self.dup SPECIAL_TEX_CHAR_TABLE.each_pair do |key, replacement| safe_string.gsub!(key,replacement) end safe_string end end