pyramation / LaTeX2HTML5

LaTeX and PSTricks rendering for the Web
62 stars 12 forks source link

Latex renders only on first page load on Nuxt.js SPA. Fails to re-render when navigating back and forward. #3

Closed imricardoramos closed 4 years ago

imricardoramos commented 5 years ago

Hi, I'm using Nuxt.js and I've followed the instructions.

Everything seems to work fine when hard-reloading the page where I have the <latex> tags. However, when I navigate the website and go to another page and then back (using <nuxt-link>s), the latex is not rendered and doesn't re-render either.

Is there any way to fix this or force the re-render?

Thanks.

imricardoramos commented 5 years ago

Okay, so I actually made a partial solution using this as a reference. I edited the latex.vue in the node_modules/latex2vue/:

mounted(){
    let MathJax = getMathJax()
    if(MathJax != undefined)
        MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
},

And I also edited the beforeMount() part:

if (getMathJax()) {
    this.loaded = true
    return;
}
pyramation commented 5 years ago

thank you!

Do you have a solution suggestion that would make this work more generally?

imricardoramos commented 5 years ago

The workaround I mentioned was good enough for me (for now) so I stopped searching for a better one 🤷‍♂️.

pyramation commented 4 years ago

looks like this may solve the issue https://github.com/pyramation/LaTeX2JS/pull/10/commits/e16e67066de9b37f68df90561601168814ac7801

pyramation commented 4 years ago

should close with https://github.com/pyramation/LaTeX2JS/pull/19