   mapping = (if Translator.unicode then @toLaTeX.unicode else @toLaTeX.ascii)
 
   @latex = ''
-  @acc = { prefix: '', text: '', postfix: ''}
+  @acc = { math: false, text: ''}
 
   while text.length > 0
     switch

}

LaTeX.emit = ->
  @latex += @acc.prefix + @acc.text + @acc.postfix if @acc.text != ''
  @acc = { prefix: '', text: '', postfix: ''}
  return

LaTeX.html2latex = (text) ->

        text = m[3]

      when mapping.math[text[0]]
        @emit() unless @acc.math
        @acc.math = true
        @acc.text += mapping.math[text[0]]
        text = text.substring(1)

      else
        @emit() if @acc.math
        @acc.math = false
        @acc.text += mapping.text[text[0]] || text[0]
        text = text.substring(1)

