Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode-Support #16

Open
Syndesi opened this issue Nov 12, 2017 · 8 comments
Open

Unicode-Support #16

Syndesi opened this issue Nov 12, 2017 · 8 comments

Comments

@Syndesi
Copy link

Syndesi commented Nov 12, 2017

Hi,

when I'm using special letters like äöü in \text{}, the while equation will not be rendered :(
But it worked with Katex's demo (added \text{äöü} to the black box) so I think that the bug may be in this package.

@moriyuu
Copy link

moriyuu commented Nov 29, 2017

I want it too!!

@waylonflinn
Copy link
Owner

Thanks for bringing this to my attention. Hopefully I'll get some time in the next few weeks to fix a few of these outstanding items.

@Syndesi
Copy link
Author

Syndesi commented Dec 16, 2017

Actually this bug is more than just "language support": As in the Katex-documentation writen, some symbols must be written in Unicode. Therefore this formula will brake at this moment:

$\frac{a}{b} a, b ∈ ℕ$

@Syndesi
Copy link
Author

Syndesi commented Dec 16, 2017

I now looked into the code and found out that katex don't return a string when the latex-input contains these characters.
Updating the packages led to compatibility issues and even when these were fixed (with webpack instead of watchify), the reported bug still exists. Therefore I think that the issue is more related to katex itself than to this project. And indeed, they have currently some related errors: #895 and #979. At least they are working on a bugfix...

But their demo is working with the expression $\frac{a}{b} a, b ∈ ℕ$. Therefore I'm currently more confused than anything else :/

@kevinbarabash
Copy link

It's possible the version that's on the demo is ahead what got released in the most current published package. My apologies if that's the case.

@Syndesi
Copy link
Author

Syndesi commented Dec 29, 2017

Hey, they completed the bugfix and the current alpha-build (without the new commit) can now render Unicode (yeah! :D ). But there are now other problems, e.g. fractions are now rendered with a huge black element in the background. But because I'm using a alpha version, I think this will be removed soon :P

left part of the website
the 'a' of the fraction is rendered in the center of the black element
and the right part of the website and Unicode characters are now working :D

And this is the source code of the generated expression:

<span class="katex">
  <span class="katex-mathml">
    <math>
      <semantics>
        <mrow>
          <mfrac>
            <mrow>
              <mi>a</mi>
            </mrow>
            <mrow>
              <mi>b</mi>
            </mrow>
          </mfrac>
          <mi>a</mi>
          <mo separator="true">,</mo>
          <mi>b</mi>
          <mo></mo>
          <mrow>
            <mi mathvariant="double-struck">N</mi>
          </mrow>
        </mrow>
        <annotation encoding="application/x-tex">\frac{a}{b} a, b ∈ ℕ</annotation>
      </semantics>
    </math>
  </span>
  <span class="katex-html" aria-hidden="true">
    <span class="strut" style="height:0.695392em;"></span>
    <span class="strut bottom" style="height:1.040392em;vertical-align:-0.345em;"></span>
    <span class="base">
      <span class="mord">
        <span class="mopen nulldelimiter"></span>
        <span class="mfrac">
          <span class="vlist-t vlist-t2">
            <span class="vlist-r">
              <span class="vlist" style="height:0.695392em;">
                <span style="top:-2.6550000000000002em;">
                  <span class="pstrut" style="height:3em;"></span>
                  <span class="sizing reset-size6 size3 mtight">
                    <span class="mord mtight">
                      <span class="mord mathit mtight">b</span>
                    </span>
                  </span>
                </span>
                <span style="top:-3.23em;">
                  <span class="pstrut" style="height:3em;"></span>
                  <span class="frac-line hide-tail" style="height:0.04em;">
                    <svg width="400em" height="400em" viewBox="0 0 400000 400000" preserveAspectRatio="xMinYMin slice">
                      <path d="M0 0 h400000 v400000 h-400000z M0 0 h400000 v400000 h-400000z"></path>
                    </svg>
                  </span>
                </span>
                <span style="top:-3.394em;">
                  <span class="pstrut" style="height:3em;"></span>
                  <span class="sizing reset-size6 size3 mtight">
                    <span class="mord mtight">
                      <span class="mord mathit mtight">a</span>
                    </span>
                  </span>
                </span>
              </span>
              <span class="vlist-s"></span>
            </span>
            <span class="vlist-r">
              <span class="vlist" style="height:0.345em;"></span>
            </span>
          </span>
        </span>
        <span class="mclose nulldelimiter"></span>
      </span>
      <span class="mord mathit">a</span>
      <span class="mpunct">,</span>
      <span class="mord mathit">b</span>
      <span class="mrel"></span>
      <span class="mord">
        <span class="mord mathbb">N</span>
      </span>
    </span>
  </span>
</span>

The black element is created by this line: <path d="M0 0 h400000 v400000 h-400000z M0 0 h400000 v400000 h-400000z"></path>

@kevinbarabash
Copy link

@Syndesi the classes on <span class="frac-line hide-tail" style="height:0.04em;"> should be clipping that rectangle.

@zackw
Copy link

zackw commented Dec 2, 2022

The bad rendering of \text{äöü} appears to be fixed in KaTeX 0.16.x. The rendering of is improved in 0.16.x but still not 100% correct, see KaTeX/KaTeX#3755.

zackw added a commit to zackw/markdown-it-katex that referenced this issue Dec 3, 2022
Notably, katex goes from 0.6.0 to 0.16.0 and (for testing purposes
only) markdown-it from 6.0.0 to 13.0.0.  Several tests had to be
updated as katex’s HTML rendering of many math constructs has changed,
but no code changes are required.

Fixes issues waylonflinn#18, waylonflinn#19, waylonflinn#21, waylonflinn#27. Partially addresses waylonflinn#16.
Test cases added.
wdhongtw pushed a commit to wdhongtw/markdown-it-katex that referenced this issue Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants