Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
imricardoramos opened this issue Sep 1, 2019 · 5 comments

Comments

@imricardoramos
Copy link

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
Copy link
Author

imricardoramos commented Sep 1, 2019

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
Copy link
Owner

thank you!

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

@imricardoramos
Copy link
Author

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

@pyramation
Copy link
Owner

looks like this may solve the issue pyramation/LaTeX2JS@e16e670

@pyramation
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants