> I've tried to do as you suggest, so that I have the lines
>
> <script type="text/x-mathjax-config">
> MathJax.Hub.Queue(function () {Print()});
> </script>
> <script type="text/javascript" src="/MathJax/MathJax.js?config=TeX-
> AMS_HTML-full,local/midefault"></script>
>
> I'm not sure what this is supposed to do, if it is supposed to make a
> print happen automatically or make sure that a user initiated print
> doesn't happen until Mathjax is finished. I assume the latter.
Unfortunately, it is the former. I don't think you can prevent the
user from printing it before MathJax runs. (Maybe you can override
the Print command, but I doubt it.)
This pushes a Print() command onto the MathJax command queue, so as
soon as MathJax finishes processing the page, it will be printed.
> But, sometimes when I print right away, I get the box "Typesetting
> Math:
> 100%" to print on top the text. It seems Mathjax should get rid of
> that box before allowing the printing to go through.
Ah, right, hadn't thought of that. You could do
<script type="text/x-mathjax-config">
MathJax.Hub.Queue(
["Clear",MathJax.Message,0,0],
function () {Print();}
);
</script>
<script type="text/javascript" src="/MathJax/MathJax.js?config=TeX-
AMS_HTML-full,local/midefault"></script>
to clear the message area before printing. I think that should do
what you need. (Not that MathJax can't prevent printing from
occurring, as your comment "before allowing the printing to go
through" suggests. You can only try to coordinate timing with get
MathJax to get the printing to occur properly.)
> Also, at least in Firefox on Ubuntu, the math is bigger than the space
> allowed for it, so that it often overlaps the text following it.
Are you using MathJax v1.1 or v2.0? And are you using MathJax's
NativeMML renderer in Firefox, or MathJax's HTML-CSS output? If it is
NativeMML with v1.1, then the problem may be due to the fact that FF
doesn't report the size of MathML correctly, and usually the size is
too small.
Alternatively, are you using a different font for printing than you
are for the screen? Since the sizes of things in MathJax are given in
em's that is font-dependent, so if you change the font, that will
affect the size of the spaces reserved by MathJax. If you have CSS
for print media, you might try removing that and seeing if that helps.
> Is that not something that can
> be fixed on the Mathjax side of things?
Not very easily, but I'll give it some thought.
Davide
I have not succeeded in getting<script type="text/x-mathjax-config">MathJax.Hub.Queue(function () {Print()});</script><script type="text/x-mathjax-config">MathJax.Hub.Queue(["Clear",MathJax.Message,0,0],function () {Print();});</script>
to automatically get a Print command to occur after loading the
page.
I don't have a separate css file for printing. I have MathJax
configured for HTML-CSS. However, not only does the math overlap with
the text at times, the math when printing looks very different (and
worse) from the math that is displayed on the screen. For example,
the integral signs are small. I changed the MathJax renderer to
MathML, and printing left off half the math symbols, so that made the
print out completely unusable.
MathJax.Hub.Queue({
["Clear",MathJax.Message,0,0],
["Delay",MathJax.Callback,100],
print
});
That should clear the message, delay for a short time, and then do the
print.
Davide
Right. Sorry about that. (I was writing quickly without testing it
out -- never a smart thing to do).
> At least on my system (Firefox 11, Linux), I cannot notice that
>
> ["Clear",MathJax.Message,0,0],
>
> does anything.
OK, how about
["Remove",MathJax.Message]
instead?
> The command
>
> MathJax.Hub.Queue(
> ["Delay",MathJax.Callback,600],
> print
> );
>
> works to clear the message while
>
> MathJax.Hub.Queue(
> ["Clear",MathJax.Message,0,0],
> ["Delay",MathJax.Callback,500],
> print
> );
>
> does not.
The default message delay before it is cleared is 600 milliseconds, so
that is why 600 works but 500 doesn't.
Davide