title: Use an escaped percent sign in TeX and MathJax with pandoc markdown
body: <p>It's easy to write TeX equations in Markdown documents and convert them to actual typeset equations <a href="http://pandoc.org/MANUAL.html#math" rel="nofollow noreferrer">using pandoc</a> (version 1.18), either in a PDF document (through LaTeX) or an HTML document (through MathJax): surround math in <code>$...$</code> for inline equations and <code>$$...$$</code> for block equations.</p>
  
  <p>However, there seems to be a discrepancy between MathJax and TeX syntax with special characters like <code>%</code>. For instance, consider this sample document:</p>
  
  <pre><code>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
  
  $$\text{\% change} = \frac{x_2 - x_1}{x_1} \times 100$$
  
  Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </code></pre>
  
  <p>Converting this to PDF via LaTeX using the command</p>
  
  <pre><code>pandoc test.md -o test.pdf
  </code></pre>
  
  <p>correctly produces an unescaped percent sign:</p>
  
  <p><a href="https://i.stack.imgur.com/b91ck.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b91ck.png" alt="tex output"></a></p>
  
  <p>However, converting the same document to HTML with MathJax, using the command</p>
  
  <pre><code>pandoc test.md -s --mathjax -o test.html
  </code></pre>
  
  <p>incorrectly produces an escaped percent sign:</p>
  
  <p><a href="https://i.stack.imgur.com/WGGyu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WGGyu.png" alt="html output"></a></p>
  
  <p>For now, I've been manually escaping/unescaping percent signs before converting my documents to PDF/HTML, which seems to defeat the purpose of having a master Markdown document that can convert to any format. </p>
  
  <p>What is the correct way to handle escaped percent signs in both TeX and MathJax? Is there a setting in MathJax that allows special characters to be escaped? Do I need to tell LaTeX to accept unescaped percent signs in math mode?</p>