Skip to content

Event when typesetting is done? Rescaling after rendering...

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

Hi, I am rescaling my webpage based on the size of the browser window. The problem is that the rescaling happens before the MathJax has rendered the equations so that they don't take any space at the point of rescaling. Does MathJax fires an event, which I could use to run the rescaling after MathJax is done with the initialization and the typesetting? How can I capture the event? Any alternative approaches to solve my problem?

Thanks, Greg


There are two possible ways to do this. First, you could push you action onto the MathJax command queue so that it will be performed after the initial typesetting is complete:

MathJax.Hub.Queue(function () {
  ... your actions here ...
});

The second way is to use MathJax's signals to trigger an action after the typesetting. For example, you could attach a handler to the startup's "End" signal (indicating that the startup process has completed, including the initial typesetting pass) by using

MathJax.Hub.Register.StartupHook("End",function () {
  ... your actions here ...
});

See the startup documentation for the details of the signals issued during startup, and signal example page for a live demo showing the signals generated, and examples of linking to them (view the source).

Davide

Clone this wiki locally