Personal Information
Personal Information

Reputation: 581

Rendering math with KaTex

I download the latest katex build release here. I'm trying to integrate it into my electron project. As a beginner developer, I'm having trouble achieving what I want.

The following code renders (one line of code) the string "c = \\pm\\sqrt{a^2 + b^2}" in a div with a class of theorem.

const theorem = document.querySelector('.theorem');

katex.render("c = \\pm\\sqrt{a^2 + b^2}", theorem, {
   throwOnError: false
});

How would I render the following

\begin{Bmatrix}

   a & b \\

   c & d

\end{Bmatrix}

Upvotes: 0

Views: 293

Answers (1)

Vernon
Vernon

Reputation: 26

const matrix = document.querySelector('.matrix');

katex.render("\\begin{Bmatrix}\n\n   a & b \\\\\n\n   c & d\n\n\\end{Bmatrix}", matrix, {
   throwOnError: false
});

Upvotes: 1

Related Questions