| 1 |
/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ |
| 2 |
/* vim: set ts=2 et sw=2 tw=80: */ |
| 3 |
|
| 4 |
/************************************************************* |
| 5 |
* |
| 6 |
* MathJax/extensions/TeX/autobold.js |
| 7 |
* |
| 8 |
* Adds \boldsymbol around mathematics that appears in a section |
| 9 |
* of an HTML page that is in bold. |
| 10 |
* |
| 11 |
* --------------------------------------------------------------------- |
| 12 |
* |
| 13 |
* Copyright (c) 2009-2020 The MathJax Consortium |
| 14 |
* |
| 15 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 16 |
* you may not use this file except in compliance with the License. |
| 17 |
* You may obtain a copy of the License at |
| 18 |
* |
| 19 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 20 |
* |
| 21 |
* Unless required by applicable law or agreed to in writing, software |
| 22 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 23 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 24 |
* See the License for the specific language governing permissions and |
| 25 |
* limitations under the License. |
| 26 |
*/ |
| 27 |
|
| 28 |
MathJax.Extension["TeX/autobold"] = { |
| 29 |
version: "2.7.9" |
| 30 |
}; |
| 31 |
|
| 32 |
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () { |
| 33 |
var TEX = MathJax.InputJax.TeX; |
| 34 |
|
| 35 |
TEX.prefilterHooks.Add(function (data) { |
| 36 |
var span = data.script.parentNode.insertBefore(document.createElement("span"),data.script); |
| 37 |
span.visibility = "hidden"; |
| 38 |
span.style.fontFamily = "Times, serif"; |
| 39 |
span.appendChild(document.createTextNode("ABCXYZabcxyz")); |
| 40 |
var W = span.offsetWidth; |
| 41 |
span.style.fontWeight = "bold"; |
| 42 |
if (W && span.offsetWidth === W) {data.math = "\\boldsymbol{"+data.math+"}"} |
| 43 |
span.parentNode.removeChild(span); |
| 44 |
}); |
| 45 |
|
| 46 |
MathJax.Hub.Startup.signal.Post("TeX autobold Ready"); |
| 47 |
|
| 48 |
}); |
| 49 |
|
| 50 |
MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/autobold.js"); |