1
/*************************************************************
3
* MathJax/extensions/HTML-CSS/handle-floats.js
5
* This extension allows HTML-CSS output to deal with floating elements
6
* better. In particular, when there are tags or equation numbers, these
7
* would overlap floating elements, but with this extension, the width of
8
* the line should properly correspond to the amount of space remaining.
13
* extensions: ["handle-floats.js"]
16
* in your configuration.
18
* ---------------------------------------------------------------------
20
* Copyright (c) 2012 Design Science, Inc.
22
* Licensed under the Apache License, Version 2.0 (the "License");
23
* you may not use this file except in compliance with the License.
24
* You may obtain a copy of the License at
26
* http://www.apache.org/licenses/LICENSE-2.0
28
* Unless required by applicable law or agreed to in writing, software
29
* distributed under the License is distributed on an "AS IS" BASIS,
30
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
* See the License for the specific language governing permissions and
32
* limitations under the License.
36
MathJax.Extension["HTML-CSS/handle-floats"] = {
41
// Make the display DIV be a table-cell
42
// Use padding to get the separation, since table cells don't do margin
43
// Make the width large (it will shrink to fit the remaining room)
49
display: "table-cell",
50
padding: "1em 0 ! important",
51
width: (MathJax.Hub.Browser.isMSIE && (document.documentMode||0) < 8 ? "100%" : "1000em")
58
// Two consecutive equations would end up side-by-side, so force a separator
59
// (Needed by IE8, IE9, and Firefox, at least).
61
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
62
var HTMLCSS = MathJax.OutputJax["HTML-CSS"],
63
TRANSLATE = HTMLCSS.Translate;
65
Translate: function (script,state) {
66
TRANSLATE.call(this,script,state);
67
if (script.MathJax.elementJax.HTMLCSS.display) {
68
var next = script.nextSibling;
69
if (!next || next.className !== "MathJax_MSIE_Separator") {
70
var span = HTMLCSS.Element("span",{className:"MathJax_MSIE_Separator"});
71
script.parentNode.insertBefore(span,next);
76
MathJax.Hub.Startup.signal.Post("HTML-CSS handle-floats Ready");
79
MathJax.Ajax.loadComplete("[MathJax]/extensions/HTML-CSS/handle-floats.js");