Skip to content
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

Using it with NextJs #24

Open
danielx-art opened this issue Oct 18, 2023 · 4 comments
Open

Using it with NextJs #24

danielx-art opened this issue Oct 18, 2023 · 4 comments

Comments

@danielx-art
Copy link

I'm trying to use TikZJax with Next. In the Next docs, they have a Script component to handle importing external scripts, which I use to import TikZJax; and also to write inline scripts, which I use to write the tikzcode itself. However, it seems that the code is not executing and the tikzpicture is not rendering.
Idealy, I want to make it interactive, where the user can chance the tikz picture properties and it will be re-rendered.
Does anyone know how to achieve this?

@kisonecat
Copy link
Owner

The version here doesn't have a nice method for handling this. If you edit this, in the window.onload you can add something like window.process_tikz = process after the definition of process so you can then call process_tikz to re-run TeX. This is what the live demo at https://tikzjax-demo.glitch.me/ build by @christianp does.

@danielx-art
Copy link
Author

Hm... I see, If this is not too incovenient, can you please explain it to me how this is done with a little bit more detail so I can replicate it? Regardless, thanks very much for the response.

@igloo1505
Copy link

The version here doesn't have a nice method for handling this. If you edit this, in the window.onload you can add something like window.process_tikz = process after the definition of process so you can then call process_tikz to re-run TeX. This is what the live demo at tikzjax-demo.glitch.me build by @christianp does.

I assume you're busy, but would it be possible to add something to the docs about cloning this into an existing project? Like not so much the implementation, but as a way of building the repo (I believe there's some missing files not hosted on Github), and maybe exposing just the main function? I've been a developer for almost 10 years and I still don't know a thing about web assembly.

I'm trying to do something fairly similar to @danielx-art. Not so much re-rendering things, but just running some functions after the svg is initially rendered to change some css around, also in a Next app. I managed to get things working with a MutationObserver, but being able to run things locally would open up the door to some tinkering and maybe doing something more interactive.

Thanks! And awesome repo regardless.

@Meetcpatel
Copy link

Hi @danielx-art Are you looking something similar like this https://github.com/Meetcpatel/tikz-code-render-next-js

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

4 participants