lucpotage/vue-katex

Problems while using mhchem

Closed this issue · 1 comments

Hello Community,

I am using vue-cli as my develop tool. I was trying to use mhchem extension to enter the chemical formulas for my webapp, like the README said: "This extension isn't part of core KaTeX, so the script should be separately included. Place it after the line that calls katex.js." I was trying to include it in index.html but failed ( I think the problem is because index.html is alive before the components in vue). I am willing to know how/where to include this extension in my webapp? Thanks for replying

Thanks for reaching out! I suspect that you're including the mchem extension from a CDN. This is likely the root cause of your issue. Instead of including the script through a CDN try importing the mchem extension where you installed vue-katex.

Try the following:

import Vue from "vue";
import VueKatex from "vue-katex";
import "katex/contrib/mhchem/mhchem";
import "katex/dist/katex.min.css";

Vue.use(VueKatex);

I hope this helps!

Cheers,

Jake