← All installation guides

Vue

LaTeX2JS for Vue

  1. 1. Install the library:

    npm install latex2vue
  2. 2. Register the Vue 3 plugin (or import the latex component directly where you need it):

    import { createApp } from 'vue';
    import LaTeX2Vue from 'latex2vue';
    import 'latex2js/latex2js.css';
    import App from './App.vue';
    
    const app = createApp(App);
    app.use(LaTeX2Vue);
    app.mount('#app');
  3. 3. If you are using Nuxt, register it as a client-side plugin in plugins/latex2vue.js instead:

    import LaTeX2Vue from 'latex2vue';
    
    export default defineNuxtPlugin((nuxtApp) => {
      nuxtApp.vueApp.use(LaTeX2Vue);
    });
  4. 4. Now you have a latex component! Set the content property and have a go:

    <latex :content="someVariable" />