How do you type the dollar sign when you have mathjax installed?
Asked Answered
N

4

13

So in Jekyll and Markdown, I can't type $ or its HTML equivalent code, and not \$ nor $\$$. How should I type the dollar sign?

Nam answered 16/3, 2016 at 8:11 Comment(0)
C
16

To prevent MathJax from using the dollar sign as a delimiter, you can put it in a span, like so:

<span>$</span>

Alternatively, you can enable processEscapes and then you can use the backslash escape \$ for the dollar sign.

Cuthbertson answered 16/3, 2016 at 8:20 Comment(2)
what is processEscapes? please!Testudo
The span trick isn't working for me--the end tag is interpreted as text in math mode. :-(Dissever
B
7

Enable processEscapes:

MathJax.Hub.Config({
  tex2jax: {
    inlineMath: [['$','$'], ['\\(','\\)']],
    processEscapes: true
  }
});

Then you can simply use \$ to get a plain $.

Burkhardt answered 5/6, 2019 at 6:55 Comment(1)
If using Jekyll, you will need to escape the \\, too, so \\$ will produce a plain $.Goldfinch
A
1

I used mathjax's dollar symbol in that paragraph. It works.

enter image description here

enter image description here

Ashleyashli answered 15/10, 2019 at 15:1 Comment(0)
H
1

I disable dollar signs completely: my settings (in a script tag) are:

MathJax = {
  tex: {
    inlineMath: [['\\\\(', '\\\\)']],
    displayMath: [['\\\\[', '\\\\]']]
  },
  svg: {
    fontCache: 'global'
  }
};

so that I have to use \(...\) or \[...\] rather than $x$ and $$y$$.

Horning answered 29/9, 2022 at 9:1 Comment(1)
View the source of w.allsup.co/sandbox/MathJax as an example -- note that dollar signs appear as is, but \(...\) and \[...\] are handled by MathJax. (That site is my personal wiki that I use as a note-taking system ala Obsidian.)Horning

© 2022 - 2025 — McMap. All rights reserved.