Skip to content
\n

The MathML is contained in the span with class \"katex-mathml\" and the original LaTeX is in the <annotation> node, with encoding \"application/x-tex\".

\n

You could extract either of them with javascript.

\n

Hope it helps
\nRegards
\nMurray

","upvoteCount":3,"url":"https://github.com/KaTeX/KaTeX/discussions/3729#discussioncomment-3769724"}}}
Discussion options

You must be logged in to vote

@arth17singh Any KaTeX output contains (1) MathML and (2) the original LaTeX, so you can get both.

Here's some typical KaTeX output:

   <span class="katex-mathml">
      <math>
         <semantics>
            <mrow>
             ...
            </mrow>
            <annotation encoding="application/x-tex">
              \displaystyle{b}_{n} = \frac{1}{L}{\int_{-{L}}^{L}} f{{\left({t}\right)}}\  \sin{{\left.\frac{{{n}\pi{t}}}{L}\right.}}{\left.{d}{t}\right.}
            </annotation>
         </semantics>
      </math>
   </span>
   <span class="katex-html" aria-hidden="true">
     ...
   </span>
  </span>

The MathML is contained in the span with class "katex-mathml" and the original LaTe…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@arth17singh
Comment options

@edemaine
Comment options

@arth17singh
Comment options

@xiangshu233
Comment options

@edemaine
Comment options

Answer selected by edemaine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants