4 * Part of the jsMath package for mathematics on the web.
6 * This file is used to load jsMath with one easy <SCRIPT>
7 * command in your HTML file. It is called by the files
8 * in the jsMath/easy/ directory. It expects that the jsMath.Easy
9 * array has been initialized before it is called.
11 * ---------------------------------------------------------------------
13 * Copyright 2007 by Davide P. Cervone
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
19 * http://www.apache.org/licenses/LICENSE-2.0
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.
28 if (!window.jsMath) {window.jsMath = {}}
29 if (!jsMath.Easy) {jsMath.Easy = {}}
30 if (!jsMath.tex2math) {jsMath.tex2math = {}}
32 jsMath.tex2math.doubleDollarsAreInLine = jsMath.Easy.doubleDollarsAreInLine;
33 jsMath.tex2math.allowDisableTag = jsMath.Easy.allowDisableTag;
35 jsMath.safeHBoxes = jsMath.Easy.safeHBoxes;
37 if (jsMath.Easy.scale) {
38 if (!jsMath.Controls) {jsMath.Controls = {}}
39 if (!jsMath.Controls.cookie) {jsMath.Controls.cookie = {}}
40 jsMath.Controls.cookie.scale = jsMath.Easy.scale;
42 if (!jsMath.Easy.allowDoubleClicks) {
43 if (!jsMath.Click) {jsMath.Click = {}}
44 jsMath.Click.CheckDblClick = function () {};
46 if (!jsMath.Easy.showFontWarnings) {
47 if (!jsMath.Font) {jsMath.Font = {}}
48 jsMath.Font.Message = function () {};
51 if (!jsMath.Easy.allowGlobal) {
52 if (!jsMath.Controls) {jsMath.Controls = {}}
53 if (!jsMath.Controls.cookie) {jsMath.Controls.cookie = {}}
54 jsMath.Controls.cookie.global = 'never';
55 jsMath.noGoGlobal = 1;
56 jsMath.noChangeGlobal = 1;
57 jsMath.noShowGlobal = 1;
60 if (jsMath.Easy.noImageFonts) {
61 jsMath.noImgFonts = 1;
62 if (!jsMath.Font) {jsMath.Font = {}}
63 if (!jsMath.Font.message) {
65 '<b>No jsMath TeX fonts found</b> -- using unicode fonts instead.<br/>\n'
66 + 'This may be slow and might not print well.<br/>\n'
67 + 'Use the jsMath control panel to get additional information.';
69 if (!jsMath.Fonts.extra_message) {
70 jsMath.Font.extra_message =
71 'Extra TeX fonts not found: <b><span id="jsMath_ExtraFonts"></span></b><br/>'
72 + 'Using unicode fonts instead. This may be slow and might not print well.<br/>\n'
73 + 'Use the jsMath control panel to get additional information.';
77 if (jsMath.Easy.processSingleDollars ||
78 jsMath.Easy.processDoubleDollars ||
79 jsMath.Easy.processSlashParens ||
80 jsMath.Easy.processSlashBrackets ||
81 jsMath.Easy.fixEscapedDollars) {
83 jsMath.Easy.findCustomSettings = {
84 processSingleDollars: jsMath.Easy.processSingleDollars,
85 processDoubleDollars: jsMath.Easy.processDoubleDollars,
86 processSlashParens: jsMath.Easy.processSlashParens,
87 processSlashBrackets: jsMath.Easy.processSlashBrackets,
88 processLaTeXenvironments: jsMath.Easy.processLaTeXenvironments,
89 fixEscapedDollars: jsMath.Easy.fixEscapedDollars,
94 if (!jsMath.Autoload) {jsMath.Autoload = {}}
95 jsMath.Autoload.root = jsMath.Easy.root+'/';
97 if (jsMath.Easy.autoload) {
98 jsMath.Autoload.findTeXstrings = 0;
99 jsMath.Autoload.findLaTeXstrings = 0;
100 jsMath.Autoload.findCustomStrings = jsMath.Easy.customDelimiters;
101 jsMath.Autoload.findCustomSettings = jsMath.Easy.findCustomSettings;
102 jsMath.Autoload.loadFiles = jsMath.Easy.loadFiles;
103 jsMath.Autoload.loadFonts = jsMath.Easy.loadFonts;
104 jsMath.Autoload.macros = jsMath.Easy.macros;
105 jsMath.Autoload.delayCheck = 1;
106 jsMath.Easy.autoloadCheck = 1;
107 document.write('<script src="'+jsMath.Autoload.root+'plugins/autoload.js"></script>');
110 jsMath.Easy.tex2math =
111 (jsMath.Easy.processSingleDollars ||
112 jsMath.Easy.processDoubleDollars ||
113 jsMath.Easy.processSlashParens ||
114 jsMath.Easy.processSlashBrackets ||
115 jsMath.Easy.processLaTeXenvironments ||
116 jsMath.Easy.fixEscapedDollars ||
117 jsMath.Easy.customDelimiters);
119 if (!jsMath.Setup) {jsMath.Setup = {}}
120 if (!jsMath.Setup.UserEvent) {jsMath.Setup.UserEvent = {}}
121 jsMath.Setup.UserEvent.onload = function () {
122 var easy = jsMath.Easy;
123 if (easy.tex2math) jsMath.Setup.Script("plugins/tex2math.js");
125 if (easy.loadFiles) {
126 for (i = 0; i < easy.loadFiles.length; i++)
127 jsMath.Setup.Script(easy.loadFiles[i]);
129 if (easy.loadFonts) {
130 for (i = 0; i < easy.loadFonts.length; i++)
131 jsMath.Font.Load(easy.loadFonts[i]);
134 for (i in easy.macros) {
135 if (typeof(easy.macros[i]) == 'string') {
136 jsMath.Macro(i,easy.macros[i]);
138 jsMath.Macro(i,easy.macros[i][0],easy.macros[i][1]);
143 document.write('<script src="'+jsMath.Easy.root+'/jsMath.js"></script>'+"\n");
146 jsMath.Easy.onload = function () {
147 if (jsMath.Easy.loaded) {return} else {jsMath.Easy.loaded = 1}
148 if (jsMath.Easy.autoloadCheck) jsMath.Autoload.Check();
149 if (jsMath.Easy.tex2math) {
150 jsMath.Synchronize(function () {
151 if (jsMath.Easy.findCustomSettings)
152 jsMath.tex2math.Convert(document,jsMath.Easy.findCustomSettings);
153 if (jsMath.Easy.customDelimiters) {
154 var s = jsMath.Easy.customDelimiters;
155 jsMath.tex2math.CustomSearch(s[0],s[1],s[2],s[3]);
156 jsMath.tex2math.ConvertCustom();
160 (jsMath[jsMath.Easy.method])();
163 if (window.addEventListener) {window.addEventListener("load",jsMath.Easy.onload,false)}
164 else if (window.attachEvent) {window.attachEvent("onload",jsMath.Easy.onload)}
165 else {window.onload = jsMath.Easy.onload}