Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mathjax how to do

Tags:

mathjax


I have set my MathJax script to have its font larger. It works all ok. But now it doesn't display when i put the code between $.
It does only when the code is between $$. I want both $ and $$ to render MathJax.

Here is my code:

<!-- MathJax CDN -->
<script type="text/x-mathjax-config">
    MathJax.Hub.Config{
    CommonHTML: {
      scale: 120
  }
  });
</script>

<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_CHTML">
</script>
like image 713
ROMARIO Avatar asked Jul 14 '26 08:07

ROMARIO


1 Answers

Add the text2jax.js extension in your config to set inline delimiter.

See here for details : http://docs.mathjax.org/en/latest/configuration.html#using-in-line-configuration-options

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  extensions: ["tex2jax.js"],
  tex2jax: {inlineMath: [["$","$"]]},
  CommonHTML: {
    scale: 120
  }
});
</script>
<script type="text/javascript" async src=
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=
TeX-MML-AM_CHTML"></script>
$x^y$

(note that you have a typo in config - parenthesis is missing)

note also this warning from mathjax doc :

By default, the tex2jax preprocessor defines the LaTeX math delimiters, which are \(...\) for in-line math, and \[...\] for displayed equations. It also defines the TeX delimiters $$...$$ for displayed equations, but it does not define $...$ as in-line math delimiters. That is because dollar signs appear too often in non-mathematical settings, which could cause some text to be treated as mathematics unexpectedly. For example, with single-dollar delimiters, “… the cost is $2.50 for the first one, and $2.00 for each additional one …” would cause the phrase “2.50 for the first one, and” to be treated as mathematics since it falls between dollar signs. For this reason, if you want to use single-dollars for in-line math mode, you must enable that explicitly in your configuration

like image 178
scraaappy Avatar answered Jul 28 '26 19:07

scraaappy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!