Skip to content

Delay rendering until button click

Davide P. Cervone edited this page May 28, 2013 · 3 revisions

From https://groups.google.com/d/msg/mathjax-users/ojLrNYfb130/d45k8BTQ84AJ

If you are trying to prevent the initial typesetting, then

<script type="text/x-mathjax-config">
MathJax.Hub.Config({
  skipStartupTypeset: true
});
</script>

should do that for you. In this case, nothing will be typeset until you call Typeset() yourself. Your button click could then use

MathJax.Hub.Queue(["Typeset",MathJax.Hub]);

as part of its onclick handler.

If you want other stuff on the page to be typeset but not this one div, then you could either use the elements array in your configuration to specify the sections that you do want to be typeset, or you can use the tex2jax_ignore class to prevent sections from being typeset, and then remove that class after the initial typeset is complete.

Davide

Clone this wiki locally