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 CSS not properly loaded #4191

Open
alexander-schoch-linuxdays opened this issue Feb 10, 2025 · 2 comments
Open

KaTeX CSS not properly loaded #4191

alexander-schoch-linuxdays opened this issue Feb 10, 2025 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@alexander-schoch-linuxdays

Describe the bug A clear and concise description of what the bug is.

In Nextra v4, when using KaTeX using

const withNextra = nextra({
  latex: true,
})

all math will be printed twice, once using MathML and once with HTML.

To Reproduce Steps to reproduce the behavior:

  1. Use KaTeX by setting latex: true in next.config.js
  2. Use some Math expression in a MDX page, e.g. Function definition: $f(x) = x^2$ using KaTeX.
  3. The HTML text is not hidden.

Expected behavior A clear and concise description of what you expected to
happen.

KaTeX's CSS should hide the HTML version, as it is there for accessability reasons, according to KaTeX/KaTeX#2806.

Screenshots If applicable, add screenshots to help explain your problem.

Screenshot of double math expression

Desktop (please complete the following information):

  • OS: Fedora Linux
  • Browser: Firefox / Chromium
  • Nextra Version: 4.2.3
  • TailwindCSS version: 4.0.3
@alexander-schoch-linuxdays alexander-schoch-linuxdays added the bug Something isn't working label Feb 10, 2025
@alexander-schoch-linuxdays
Copy link
Author

alexander-schoch-linuxdays commented Feb 10, 2025

Manually loading the stylesheet using

import 'katex/dist/katex.min.css';

is a workaround, as kind of described in the docs (I dont' want to get CSS from some CDN): https://nextra.site/docs/advanced/latex#apply-katex-styles

Is it not possible to load this CSS from nextra if latex: true? If not, this section in the docs should probably be at the top of the LaTeX page.

@dimaMachina
Copy link
Collaborator

Feel free to contribute to docs improvements 🙏

@dimaMachina dimaMachina added documentation Improvements or additions to documentation and removed bug Something isn't working labels Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants