       ).join('') +
     '</table>'
   .replace /\\(BY|YEAR)\s*{([^{}]*)}/g, '<span style="border: thin solid; margin-left: 0.5em; padding: 0px 4px; font-variant:small-caps">$2</span>'
-  .replace /\\protect\b\s*/g, ''
-  .replace /\\par\b\s*/g, '<p>'
+  .replace /\\protect(?![a-zA-Z])\s*/g, ''
+  .replace /\\par(?![a-zA-Z])\s*/g, '<p>'
   .replace /\\sout\s*{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}/g, '<s>$1</s>'
   .replace /\\emph\s*{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}/g, '<em>$1</em>'
   .replace /\\textit\s*{((?:[^{}]|{(?:[^{}]|{[^{}]*})*})*)}/g, '<span style="font-style: italic">$1</span>'

replaceMathBlocks = (text, replacer) ->
  #console.log text
  blocks = []
  re = /[{}]|\$\$?|\\(begin|end)\s*{(equation|eqnarray|align)\*?}|(\\par\b|\n[ \f\r\t\v]*\n\s*)|\\./g
  block = null
  startBlock = (b) ->
    block = b

    \\begin\s*{(itemize)}
   |\\begin\s*{enumerate}(?:\s*\[((?:[^\[\]]|{[^{}]*})*)\])?
   |\\end\s*{(itemize|enumerate)}
   |\\item(?![a-zA-Z])\s*(?:\[([^\[\]]*)\]\s*)?
  )///g, (match, space, beginItemize, enumArg, end, itemArg) ->
    space.replace(/\n\s*\n|<p>/g, '\n') +  ## eat paragraphs
    switch match[space.length + 1]
