Search code examples
mathjax

Danish letters are disappearing with MathJax 3


I'd like to use the letters æ, ø and å as text in MathJax 3.

The colors "red", "green" and "blue" are spelled "rød", "grøn" and "blå" so they are hard to avoid...

Example of letters missing

In the image you can see that the danish letters disappear, when I write:

\text{grøn}   \text{blå}    etc

UPDATE

The answer of scraaappy made me try

   src="https://cdn.jsdelivr.net/npm/mathjax@"@"3/es5/tex-mml-chtml.js"

instead of

   src="https://cdn.jsdelivr.net/npm/mathjax@"@"3/es5/tex-svg-full.js"

and now the danish characters appear.

My setup is somewhat involved, so I'll try to make a minimal example that shows the problem using tex-svg-full.js.

I notice that the danish letters look odd when using tex-mml-chtml.js so my theory is that the TeX Font used by MathJax 3 does not contain danish characters - and the fallback solution is coded differently in tex-mml-chtml.js and ``tex-svg-full.js`.

Here is an example that shows danish characters when using tex-mml-chtml.js.

enter image description here

Is there a list of letters in the font used by MathJax 2 available somewhere?

UPDATE 2

A minimal example, which doesn't show missing characters (in the real setup the MathJax is rendered using MathJax.typesetClear() followed by MathJax.typeset(). The example shows that the danish characters aren't in the math font. The output isn't pretty.

Minimal Example in JSFiddle


Solution

  • This is not a MathJax issue. Without any more precision it is difficult to answer but if you attempt to display in HTML check if you're in HTML5 and/or if your charset encoding is set to UTF-8

    <script id="MathJax-script" async
     src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
     
     $$\text{grøn}  $$
     
     \(\text{grøn} \)

    EDIT

    Below a screenshot of the result I obtain from the second snippet (same in your fiddle)

    enter image description here

    Is it what you've got ?

    After reading the doc, the conclusion might be to use the unicode extension which let you choose your own font, or try something with \class (with which I did not obtain much success!)

    .test{
      color: red;
      font-size: 2em;
      letter-spacing: 15px;
      line-height: 15px;
      font-weight: bold;
    }
    <script >
          MathJax = { tex:       {packages:    {'[+]': ['physics','unicode']},
                                  inlineMath:  [ ['$','$'],   ["\\(","\\)"] ],
                                  displayMath: [ ['$$','$$'], ["\\[","\\]"] ]},
                      svg:       {scale: 100},
                      loader:    {load: ['[tex]/physics','[tex]/unicode']},
                      styles:    {".MathJax_SVG_Display":
                                     { "text-align":       "center",
                                       "margin":           "0.25em 0em ! important"}}
                    };
       </script>
        <!-- Title -->
        <title>Testing danish characters in MathJax 3 </title>
    
      <h1> MathJax formula in original page. </h1>
     \[ x aæbøcå y \unicode{0216} \]
    \[ x aæbøcå y \unicode[Garamond]{0216} \]
    
    \[ x aæbøcå y \unicode[Verdana]{0216} \]
    
    \[ aæbøcå \class{test}{Ø} \]
    
    
        <script id="MathJax-script" async
           src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg-full.js">
        </script>