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

Katex: 3x3 and above matrices render with a break in the delimiters #2477

Closed
ganeshbelgur opened this issue Feb 8, 2020 · 7 comments · Fixed by #2478
Closed

Katex: 3x3 and above matrices render with a break in the delimiters #2477

ganeshbelgur opened this issue Feb 8, 2020 · 7 comments · Fixed by #2478
Labels
bug It's a bug high High priority issues

Comments

@ganeshbelgur
Copy link

ganeshbelgur commented Feb 8, 2020

Any 3x3 matrix or a higher order square matrix renders with a tiny break in the delimiters. This nit picky detail can be a bother when the matrix is viewed on a huge screen. Can this be fixed?
4x4

Environment

Joplin version: 1.0.179
Platform: Linux
OS specifcs: Ubuntu 18.04.4 LTS

Steps To Reproduce

  1. Enter the following latex code in the markdown editor
$$
\begin{pmatrix}
    a & b & c\\
    a & b & c\\
    a & b & c\\
    a & b & c
\end{pmatrix}
$$
  1. The matrix should appear in the preview pane or you could also try a PDF or an HTML export to view the issue.

Describe what you expected to happen

When the above 4x3 matrix was rendered using the editor at https://katex.org/, the delimiters appear to be fine. So, it seems like the issue is not originating from the Katex engine. If you notice Joplin's render of the matrix above, the tapering of the delimiters towards the top and bottom seems a bit off, too.
4x4_right

Thank you for considering my issue.

@ganeshbelgur ganeshbelgur added the bug It's a bug label Feb 8, 2020
@laurent22 laurent22 added the high High priority issues label Feb 8, 2020
@ganeshbelgur
Copy link
Author

ganeshbelgur commented Feb 9, 2020

@tessus and @laurent22,

Additionally, Katex itself has some issues when rendering a 3x3 matrix. In the example above, I specifically chose a 4x3 matrix to demonstrate the problem in Joplin so that we don't get caught up with the problem in Katex. Take a look at KaTeX/KaTeX#2198.

If the fonts get modified, don't you think storing new font format files into Joplin can soon turn into a burden when the updates roll in each time? :)

@tessus
Copy link
Collaborator

tessus commented Feb 9, 2020

If the fonts get modified, don't you think storing new font format files into Joplin can soon turn into a burden when the updates roll in each time? :)

There's not much we can do, if we want to keep Joplin self contained.

@laurent22
Copy link
Owner

Fonts are auto-copied from node_modules so when we upgrade Katex the fonts are upgraded too.

@tessus
Copy link
Collaborator

tessus commented Feb 10, 2020

@laurent22 copied to where? there are 3 directories for fonts. See my PR for a detailed explanation. Very confusing.

@laurent22
Copy link
Owner

Each app needs its own copy of the fonts, but npm i should take care of that.

The only place where the fonts are in the repo is in joplin-renderer/assets and in theory they could be removed from there too (they are generated by Tools/buildAssets.js), but due to the electron-builder bug we need this folder to have everything pre-built. The way to add a plugin asset is by updating buildAssets.js

@tessus
Copy link
Collaborator

tessus commented Feb 10, 2020

Ah, you removed the directories just now. When I opened the PR, the fonts were all over the place. This means I have to update my PR to only add the file to ReactNativeClient/lib/joplin-renderer/assets/katex/fonts/KaTeX_Size4-Regular.woff2

tessus added a commit to tessus/joplin that referenced this issue Feb 10, 2020
laurent22 pushed a commit that referenced this issue Feb 11, 2020
#2478)

* add katex font KaTeX_Size4-Regular.woff2

fixes #2477

* deleted:    ElectronClient/app/gui/note-viewer/pluginAssets/katex/fonts/KaTeX_Size4-Regular.woff2

* add font to buildAssets.js

* register font in katex.js

* prepare files in case we need other fonts in the future

* use all fonts
@ganeshbelgur
Copy link
Author

Thank you both for the fix, really appreciate it. :)

@lock lock bot locked and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug It's a bug high High priority issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants