org-roam-ui icon indicating copy to clipboard operation
org-roam-ui copied to clipboard

[BUG] KaTeX fonts cannot be downloaded

Open splintersuidman opened this issue 2 years ago • 8 comments

Describe the bug The KaTeX fonts cannot be downloaded which causes the preview not to follow the KaTeX font commands correctly. It seems the font files, hosted in _next/static/media are cut short to 51 characters. Whereas the font at /_next/static/media/KaTeX_Script-Regular.c81d1b2a4b75d3eded6059a210910a6b.woff2 cannot be downloaded, there is a font at /_next/static/media/KaTeX_Script-Regular.c81d1b2a4b75d3eded6059a210910a.

To Reproduce Preview a node which contains a KaTeX font command like \mathscr{C} or \mathbb{Z}.

Expected behavior \mathscr{C} creates a script C, \mathbb{Z} creates a blackboard bold Z.

Screenshots Here is an example of what the preview looks like: Screenshot_20230222_101251

And this is how the \mathscr{C} and \mathscr{J} should look: Screenshot_20230222_101226

The following screenshot shows the font download errors in the browser’s console: Screenshot_20230222_101329

The directory listing for _next/static/media reveals that the file names are cut short (sometimes they contain no file extension, sometimes only part of it, e.g., .wo instead of .woff): Screenshot_20230222_101416

What browser were you using? Firefox

splintersuidman avatar Feb 22 '23 09:02 splintersuidman

hmmmm weird. for me $\mathscr{C}$ and $\mathbb{B}$ show up as shown here (Firefox and chromium)

image

all the fonts are listed correctly for me as well image

Is this maybe an issue of your OS? Maybe your .emacs is nested so deeply that it is cutting of these characters when org-roam-ui is downloaded?

tefkah avatar Feb 23 '23 13:02 tefkah

Is this maybe an issue of your OS?

Hm, that could pretty well be the case. I use NixOS to install org-roam-ui, and the font file lives at /nix/store/4lc2xz9jz6vnlpg57wdyq2lqg9yba0qq-emacs-org-roam-ui-20221105.1040/share/emacs/site-lisp/elpa/org-roam-ui-20221105.1040/out/_next/static/media/KaTeX_Script-Regular.c81d1b2a4b75d3eded6059a210910a (which is 203 characters, which seems to be shorter than the default maximum filename length?). Maybe this is rather a NixOS/Nixpkgs issue than an org-roam-ui one. I will investigate further.

splintersuidman avatar Feb 23 '23 13:02 splintersuidman

I have the same issue on Mac OS X.

Files are present, but the extensions seem to be cut-off. Mac OS supports upto 255 characters for file name, and I verified that the path is 131 chars.

├── KaTeX_AMS-Regular.73ea273a72f4aca30ca528cf9117470a.
├── KaTeX_AMS-Regular.853be92419a6c3766b9afe7a7c3e32fa.
├── KaTeX_AMS-Regular.d562e886c52f12660a41eea8d05af757.
├── KaTeX_Caligraphic-Bold.7489a2fbfb9bfe70442031a27fb5
├── KaTeX_Caligraphic-Bold.a1abf90dfd72792a577a5a43382b
├── KaTeX_Caligraphic-Bold.d757c535a2e5902f1325192d99e0
├── KaTeX_Caligraphic-Regular.7e873d3833eb108a0758be45c
├── KaTeX_Caligraphic-Regular.d6484fce1ef428d5bd94a903d
├── KaTeX_Caligraphic-Regular.db074fa22cf224af93d7b2122
├── KaTeX_Fraktur-Bold.354501bac435c3264834b80301089bad
├── KaTeX_Fraktur-Bold.4c761b3711973ab04edf7ea6f1fbacdc
├── KaTeX_Fraktur-Bold.931d67ea207ab37ee693ff155ff4d7a6
├── KaTeX_Fraktur-Regular.172d3529b26f8cedef6b5ddef7546
├── KaTeX_Fraktur-Regular.6fdf0ac577be0ba82a4c9a89b8eef
├── KaTeX_Fraktur-Regular.ed305b5434865e06ffde7da0d2810
├── KaTeX_Main-Bold.0c3b8929d377c0e9b2f3a9c872e3337b.wo
├── KaTeX_Main-Bold.39890742bc957b368704509bb2f4163c.wo
├── KaTeX_Main-Bold.8169508bf58f8bd92ad8a768ede68a18.tt

Not sure when this bug showed up (I auto-update my packages on a weekly basis), but I am currently using 20221105.1040

skittishdev avatar Apr 03 '23 13:04 skittishdev

hmmm very strange. @skittishdev do you use any non-emacs package managing solution to install org-roam-ui?

tefkah avatar Apr 05 '23 09:04 tefkah

one other thing to check is that this might be a Melpa problem, could you try pulling org-roam-ui directly from the github repo?

tefkah avatar Apr 05 '23 10:04 tefkah

do you use any non-emacs package managing solution to install org-roam-ui?

No, I use MELPA and use-package with package.el.

could you try pulling org-roam-ui directly from the github repo?

No change in behavior. Used straight.el

(use-package org-roam-ui
  :straight (org-roam-ui :type git :host github :repo "org-roam/org-roam-ui")
  :after org-roam
  :bind (
         ("C-c n u" . org-roam-ui-open)
         ("C-c n n" . org-roam-ui-node-local)
         )
  :custom
  (org-roam-ui-sync-theme t)
  (org-roam-ui-follow t)
  (org-roam-ui-update-on-save t)
  (org-roam-ui-open-on-start nil))

Some additional context

  • I'm using emacs-29, but I tried reverting to emacs-28, and still see the same issue by pulling in org-roam-ui from MELPA and from Github
  • org-roam-ui has trouble processing #+BEGIN_EXPORT latex blocks, but for latex embedded within the org file, it seems to be able to display LaTeX correctly (but see the original report for problems with Katex directives). Also, the Katex font errors still show up even with latex embedded in the org file

skittishdev avatar Apr 06 '23 21:04 skittishdev