Can't escape LaTeX dollar sign `$` in blogdown

后端 未结 2 441
攒了一身酷
攒了一身酷 2021-01-22 21:17
1. An amount between $5 and $10.  
2. An amount between \\$5 and \\$10.  
3. An amount between \\\\$5 and \\\\$10.  

Please include the code chunk abov

相关标签:
2条回答
  • 2021-01-22 21:45

    A simple trick is to put in a space between the $ and the number.

    4. An amount between $ 5 and $ 10. 
    

    MathJax should only triggered and activate math mode when it is (first) followed by a non-whitespace character and should end at a $ preceded by something that isn't white space.

    It doesn't always work quite right but I tried it on my blogdown setup and that seemed okay.

    Also ... (and I have no idea if this could be the reason) ... but which version of MathJax are you loading? I'm including the following code in my pages, and that renders your third example okay too.

      <script type="text/x-mathjax-config">
        MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"] ],
          displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
          processEscapes: true
        }
        });
      </script>
      <script type="text/javascript"
          src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
      </script>
    
    0 讨论(0)
  • 2021-01-22 21:47

    In MathJax.Hub.Config set processEscapes: true

    Then, use \\\$ to display the dollar sign - triple backslash....

    0 讨论(0)
提交回复
热议问题