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 seems like not work #3623

Closed
RaidOpe opened this issue May 8, 2024 · 1 comment
Closed

KaTeX seems like not work #3623

RaidOpe opened this issue May 8, 2024 · 1 comment

Comments

@RaidOpe
Copy link

RaidOpe commented May 8, 2024

I set config by https://revealjs.com/math/, MathJax2 could work but not KaTeX

Here the Minimal Config

<html>

<head>
  <link rel="stylesheet" href="dist/reveal.css">
  <link rel="stylesheet" href="dist/theme/white.css">
</head>

<body>
  <div class="reveal">
    <div class="slides">

      <section>
        <h2>The Lorenz Equations</h2>
        \begin{aligned}
        \dot{x} &amp; = \sigma(y-x) \\
        \dot{y} &amp; = \rho x - y - xz \\
        \dot{z} &amp; = -\beta z + xy
        \end{aligned}
      </section>

    </div>
  </div>

  <script src="dist/reveal.js"></script>
  <script src="plugin/math/math.js"></script>
  <script>
    Reveal.initialize({
      plugins: [RevealMath.KaTeX]
    });
  </script>
</body>
</html>

RevealMath.MathJax2 could work,In Examples files there is only Mathjax2 , So I have no diea to figure it out which part get wrong.

@hakimel
Copy link
Owner

hakimel commented May 15, 2024

Hey! Two issues;

  1. KaTeX requires a doctype, so you'll need <!DOCTYPE html> at the top.
  2. You'll need to wrap your math with a start/end delimiter (\[ math_here \] or $$ math_here $$). These are listed under the KaTeX config in the docs.

Here's a working example with the above changes;

<!DOCTYPE html>
<html>

<head>
  <link rel="stylesheet" href="dist/reveal.css">
  <link rel="stylesheet" href="dist/theme/white.css">
</head>

<body>
  <div class="reveal">
    <div class="slides">

      <section>
        <h2>The Lorenz Equations</h2>
        $$
        \begin{aligned}
        \dot{x} &amp; = \sigma(y-x) \\
        \dot{y} &amp; = \rho x - y - xz \\
        \dot{z} &amp; = -\beta z + xy
        \end{aligned}
        $$
      </section>

    </div>
  </div>

  <script src="dist/reveal.js"></script>
  <script src="plugin/math/math.js"></script>
  <script>
    Reveal.initialize({
      plugins: [RevealMath.KaTeX]
    });
  </script>
</body>
</html>

@hakimel hakimel closed this as completed May 15, 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

2 participants