Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

replace jsMath with jqMath

Signed-off-by: David A. Cuadrado <krawek@gmail.com>
  • Loading branch information...
commit ffb80ae5e4cb72c11bf443b1d588acdc1bedf656 1 parent 8ac2bb9
David Cuadrado dcu authored
Showing with 1,110 additions and 5,574 deletions.
  1. +3 −1 app/helpers/application_helper.rb
  2. +0 −7 config/initializers/jsmath_fonts.rb
  3. BIN  data/fonts.tar.bz2
  4. +0 −202 public/javascripts/jsMath/COPYING.txt
  5. BIN  public/javascripts/jsMath/blank.gif
  6. +0 −164 public/javascripts/jsMath/easy/load.js
  7. +0 −293 public/javascripts/jsMath/extensions/AMSmath.js
  8. +0 −290 public/javascripts/jsMath/extensions/AMSsymbols.js
  9. +0 −122 public/javascripts/jsMath/extensions/HTML.js
  10. +0 −51 public/javascripts/jsMath/extensions/autobold.js
  11. +0 −113 public/javascripts/jsMath/extensions/bbox.js
  12. +0 −63 public/javascripts/jsMath/extensions/boldsymbol.js
  13. +0 −250 public/javascripts/jsMath/extensions/double-click.js
  14. +0 −234 public/javascripts/jsMath/extensions/eqn-number.js
  15. +0 −71 public/javascripts/jsMath/extensions/fbox.js
  16. +0 −38 public/javascripts/jsMath/extensions/font.js
  17. +0 −124 public/javascripts/jsMath/extensions/leaders.js
  18. +0 −70 public/javascripts/jsMath/extensions/mathchoice.js
  19. +0 −36 public/javascripts/jsMath/extensions/mimeTeX.js
  20. +0 −68 public/javascripts/jsMath/extensions/moreArrows.js
  21. +0 −205 public/javascripts/jsMath/extensions/newcommand.js
  22. +0 −53 public/javascripts/jsMath/extensions/underset-overset.js
  23. +0 −58 public/javascripts/jsMath/extensions/verb.js
  24. +0 −428 public/javascripts/jsMath/jsMath-BaKoMa-fonts.js
  25. +0 −165 public/javascripts/jsMath/jsMath-easy-load.js
  26. +0 −107 public/javascripts/jsMath/jsMath-fallback-mac-mozilla.js
  27. +0 −200 public/javascripts/jsMath/jsMath-fallback-mac-msie.js
  28. +0 −29 public/javascripts/jsMath/jsMath-fallback-mac.js
  29. +0 −29 public/javascripts/jsMath/jsMath-fallback-pc.js
  30. +0 −28 public/javascripts/jsMath/jsMath-fallback-symbols.js
  31. +0 −29 public/javascripts/jsMath/jsMath-fallback-unix.js
  32. +0 −39 public/javascripts/jsMath/jsMath-loader-omniweb4.js
  33. +0 −53 public/javascripts/jsMath/jsMath-msie-mac.js
  34. +0 −58 public/javascripts/jsMath/jsMath-old-browsers.js
  35. +0 −51 public/javascripts/jsMath/jsMath.js
  36. +0 −17 public/javascripts/jsMath/local/macros.js
  37. +0 −85 public/javascripts/jsMath/plugins/CHMmode.js
  38. +0 −474 public/javascripts/jsMath/plugins/autoload.js
  39. +0 −52 public/javascripts/jsMath/plugins/global.js
  40. +0 −221 public/javascripts/jsMath/plugins/mimeTeX.js
  41. +0 −71 public/javascripts/jsMath/plugins/noCache.js
  42. +0 −33 public/javascripts/jsMath/plugins/noGlobal.js
  43. +0 −41 public/javascripts/jsMath/plugins/noImageFonts.js
  44. +0 −70 public/javascripts/jsMath/plugins/smallFonts.js
  45. +0 −372 public/javascripts/jsMath/plugins/spriteImageFonts.js
  46. +0 −409 public/javascripts/jsMath/plugins/tex2math.js
  47. +70 −0 public/javascripts/mathscribe/jqmath-0.1.1.css
  48. +702 −0 public/javascripts/mathscribe/jqmath-0.1.1.js
  49. +53 −0 public/javascripts/mathscribe/jqmath-etc-0.1.1.min.js
  50. +269 −0 public/javascripts/mathscribe/jscurry-0.1.js
  51. +13 −0 public/javascripts/mathscribe/jscurry-0.1.min.js
4 app/helpers/application_helper.rb
View
@@ -331,7 +331,9 @@ def gravatar(*args)
def include_latex
if current_group.enable_latex
- require_js domain_url(:custom => current_group.domain)+'/javascripts/jsMath/easy/load.js'
+ require_css 'http://fonts.googleapis.com/css?family=UnifrakturMaguntia'
+ require_css domain_url(:custom => current_group.domain)+'/javascripts/mathscribe/jqmath-0.1.1.css'
+ require_js domain_url(:custom => current_group.domain)+'/javascripts/mathscribe/jqmath-etc-0.1.1.min.js'
end
end
7 config/initializers/jsmath_fonts.rb
View
@@ -1,7 +0,0 @@
-if RUBY_PLATFORM !~ /mswin|mingw/
- path = Rails.root.to_s+"/public/javascripts/jsMath"
- if !File.exist?(path+"/fonts")
- puts ">> Installing jsmath fonts..."
- system "tar xjf '#{Rails.root.to_s+"/data/fonts.tar.bz2"}' -C '#{path}'"
- end
-end
BIN  data/fonts.tar.bz2
View
Binary file not shown
202 public/javascripts/jsMath/COPYING.txt
View
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
BIN  public/javascripts/jsMath/blank.gif
View
Deleted file not rendered
164 public/javascripts/jsMath/easy/load.js
View
@@ -1,164 +0,0 @@
-/**********************************************************************
- *
- * Customize the values given below to suit your needs.
- * You can make additional copies of this file with
- * different customizated settings if you need to load
- * jsMath with different parameters.
- *
- * Load this page via:
- *
- * <SCRIPT SRC="path-to-jsMath/easy/load.js"></SCRIPT>
- *
- * (If you are including this file into your page via Server-Side
- * Includes, you should remove line above.)
- *
- * You can make copies of this file with different settings
- * if you need to have several different configurations.
- *
- **********************************************************************/
-
-if (!window.jsMath) {window.jsMath = {}}
-
-jsMath.Easy = {
- //
- // The URL of the root jsMath directory on your server
- // (it must be in the same domain as the HTML page).
- // It should include "http://yoursite.com/", or should
- // be relative to the root of your server. It is possible
- // to be a relative URL, but it will be relative to the
- // HTML page loading this file.
- //
- // If you leave this blank, jsMath will try to look it up from
- // the URL where it loaded this file, but that may not work.
- //
- root: "",
-
- //
- // The default scaling factor for mathematics compared to the
- // surrounding text.
- //
- scale: 120,
-
- //
- // 1 means use the autoload plug-in to decide if jsMath should be loaded
- // 0 means always load jsMath
- //
- autoload: 1,
-
- //
- // Setting any of these will cause the tex2math plugin to be used
- // to add the <DIV> and <SPAN> tags that jsMath needs. See the
- // documentation for the tex2math plugin for more information.
- //
- processSlashParens: 1, // process \(...\) in text?
- processSlashBrackets: 1, // process \[...\] in text?
- processDoubleDollars: 1, // process $$...$$ in text?
- processSingleDollars: 0, // process $...$ in text?
- processLaTeXenvironments: 0, // process \begin{xxx}...\end{xxx} outside math mode?
- fixEscapedDollars: 0, // convert \$ to $ outside of math mode?
- doubleDollarsAreInLine: 0, // make $$...$$ be in-line math?
- allowDisableTag: 1, // allow ID="tex2math_off" to disable tex2math?
- //
- // If you want to use your own custom delimiters for math instead
- // of the usual ones, then uncomment the following four lines and
- // insert your own delimiters within the quotes. You may want to
- // turn off processing of the dollars and other delimiters above
- // as well, though you can use them in combination with the
- // custom delimiters if you wish. See the tex2math documentation
- // for more details.
- //
- //customDelimiters: [
- // '[math]','[/math]', // to begin and end in-line math
- // '[display]','[/display]' // to begin and end display math
- //],
-
- //
- // Disallow the use of the @(...) mechanism for including raw HTML
- // in the contents of \hbox{}? (If used in a content-management system
- // where users are allowed to enter mathematics, setting this to 0
- // would allow them to enter arbitrary HTML code within their
- // math formulas, and that poses a security risk.)
- //
- safeHBoxes: 1,
-
- //
- // Show TeX source when mathematics is double-clicked?
- //
- allowDoubleClicks: 1,
-
- //
- // Show jsMath font warning messages? (Disabling this prevents yours
- // users from finding out that they can have a better experience on your
- // site by installing some fonts, so don't disable this).
- //
- showFontWarnings: 0,
-
- //
- // Use "Process" or "ProcessBeforeShowing". See the jsMath
- // author's documentation for the difference between these
- // two routines.
- //
- method: "Process",
-
- //
- // List of plug-ins and extensions that you want to be
- // loaded automatically. E.g.
- // ["plugins/mimeTeX.js","extensions/AMSsymbols.js"]
- //
- loadFiles: [],
-
- //
- // List of fonts to load automatically. E.g.
- // ["cmmib10"]
- //
- loadFonts: [],
-
- //
- // List of macros to define. These are of the form
- // name: value
- // where 'value' is the replacement text for the macro \name.
- // The 'value' can also be [value,n] where 'value' is the replacement
- // text and 'n' is the number of parameters for the macro.
- // Note that backslashes must be doubled in the replacement string.
- // E.g.,
- // {
- // RR: '{\\bf R}',
- // bold: ['{\\bf #1}', 1]
- // }
- //
- macros: {},
-
- //
- // Allow jsMath to enter global mode?
- // (Uses frames, so may not always work with complex web sites)
- //
- allowGlobal: 0,
-
- //
- // Disable image fonts? (In case you don't load them on your server.)
- //
- noImageFonts: 0
-
-};
-
-/****************************************************************/
-/****************************************************************/
-//
-// DO NOT MAKE CHANGES BELOW THIS
-//
-/****************************************************************/
-/****************************************************************/
-
-if (jsMath.Easy.root == "") {
- jsMath.Easy.root = document.getElementsByTagName("script");
- jsMath.Easy.root = jsMath.Easy.root[jsMath.Easy.root.length-1].src
- if (jsMath.Easy.root.match(/\/easy\/[^\/]*$/)) {
- jsMath.Easy.root = jsMath.Easy.root.replace(/\/easy\/[^\/]*$/,"");
- } else {
- jsMath.Easy.root = jsMath.Easy.root.replace(/\/(jsMath\/(easy\/)?)?[^\/]*$/,"/jsMath");
- }
-}
-jsMath.Easy.root = jsMath.Easy.root.replace(/\/$/,""); // trim trailing "/" if any
-
-document.write('<script src="'+jsMath.Easy.root+'/jsMath-easy-load.js"><'+'/script>');
-
293 public/javascripts/jsMath/extensions/AMSmath.js
View
@@ -1,293 +0,0 @@
-/*
- * extensions/AMSmath.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file defines most of the macros and environments from
- * the amsmath LaTeX package. You can activate it by calling
- *
- * jsMath.Extension.Require('AMSmath');
- *
- * once jsMath.js has been loaded, or by adding "extensions/AMSmath.js"
- * to the loadFiles array in jsMath/easy/load.js.
- *
- * You may wish to load AMSsymbols.js as well, but note that it
- * requires the extra msam10 and msb10 fonts that you will have
- * to install on your server first.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2007 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Extension.Require("moreArrows");
-
-jsMath.Package(jsMath.Parser,{
- macros: {
- intI: ['Macro','\\mathchoice{\\!}{}{}{}\\!\\!\\int'],
- iint: ['Macro','\\!\\!\\!\\mathop{\\,\\,\\,\\int\\intI}'],
- iiint: ['Macro','\\!\\!\\!\\mathop{\\,\\,\\,\\int\\intI\\intI}'],
- iiiint: ['Macro','\\!\\!\\!\\mathop{\\,\\,\\,\\int\\intI\\intI\\intI}'],
- idotsint: ['Macro','\\!\\!\\mathop{\\,\\,\\int\\cdots\\int}'],
-
- dddot: ['Macro','\\mathop{#1}\\limits^{\\textstyle ...}',1],
- ddddot: ['Macro','\\mathop{#1}\\limits^{\\textstyle ....}',1],
-
- sideset: ['Macro','\\mathop{\\rlap{\\phantom{#3}}}#1\\!{#3}#2',3],
- stackrel: ['Macro','\\mathrel{\\mathop{#2}\\limits^{#1}}',2],
-
- boxed: ['Macro','\\fbox{$\\displaystyle{#1}$}',1],
-
- tag: 'HandleTag',
- notag: ['Macro',''],
-
- substack: ['Macro','\\begin{subarray}{c}#1\\end{subarray}',1],
-
- varliminf: ['Macro','\\mathop{\\underline{\\raise1.5pt{\\rule{0pt}{.6em}{0pt}\\smash{\\lower1.5pt{\\rm lim}}}}}'],
- varlimsup: ['Macro','\\mathop{\\overline{\\rule{0pt}{.6em}{0pt}\\smash{\\rm lim}}}'],
- varinjlim: ['Macro','\\mathop{\\underrightarrow{\\rm lim}}'],
- varprojlim: ['Macro','\\mathop{\\underleftarrow{\\rm lim}}'],
-
- DeclareMathOperator: 'HandleDeclareOp',
- operatorname: 'HandleOperatorName',
-
- genfrac: 'Genfrac',
- frac: ['Genfrac',"","","",""],
- tfrac: ['Genfrac',"","","","1"],
- dfrac: ['Genfrac',"","","","0"],
- binom: ['Genfrac',"(",")","0pt",""],
- tbinom: ['Genfrac',"(",")","0pt","1"],
- dbinom: ['Genfrac',"(",")","0pt","0"],
-
- cfrac: 'CFrac',
-
- shoveleft: ['HandleShove','left'],
- shoveright: ['HandleShove','right']
- },
-
- environments: {
- align: ['Array',null,null,'rlrlrlrlrlrl',[5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18],1,'D'],
- 'align*': ['Array',null,null,'rlrlrlrlrlrl',[5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18],1,'D'],
- aligned: ['Array',null,null,'rlrlrlrlrlrl',[5/18,2,5/18,2,5/18,2,5/18,2,5/18,2,5/18],1,'D'],
- multline: 'Multline',
- 'multline*': 'Multline',
- split: ['Array',null,null,'rl',[5/18],1,'D'],
- gather: ['Array',null,null,'c',null,1,'D'],
- 'gather*': ['Array',null,null,'c',null,1,'D'],
- gathered: ['Array',null,null,'c',null,1,'D'],
- subarray: ['Array',null,null,null,[0,0,0,0],1,'S',0,.25],
- smallmatrix: ['Array',null,null,'cccccccccc',[1/3,1/3,1/3,1/3,1/3,1/3,1/3,1/3,1/3,1/3],1,'S',0]
- },
-
- delimiter: {
- '\\lvert': [4,2,0x6A,3,0x0C],
- '\\rvert': [5,2,0x6A,3,0x0C],
- '\\lVert': [4,2,0x6B,3,0x0D],
- '\\rVert': [5,2,0x6B,3,0x0D]
- },
-
- /*
- * Ignore the tag for now
- */
- HandleTag: function (name) {
- var arg = this.trimSpaces(this.GetArgument(this.cmd+name)); if (this.error) return;
- if (arg == "*") this.GetArgument(this.cmd+name);
- },
-
- /*
- * Handle \DeclareMathOperator
- */
- HandleDeclareOp: function (name) {
- var limits = "";
- var cs = this.trimSpaces(this.GetArgument(this.cmd+name)); if (this.error) return;
- if (cs == "*") {
- limits = "\\limits";
- cs = this.trimSpaces(this.GetArgument(this.cmd+name)); if (this.error) return;
- }
- if (cs.charAt(0) == "\\") {cs = cs.substr(1)}
- var op = this.GetArgument(this.cmd+name); if (this.error) return;
- op = op.replace(/\*/g,'\\char{cmr10}{0x2A}').replace(/-/g,'\\char{cmr10}{0x2D}');
- jsMath.Parser.prototype.macros[cs] = ['Macro','\\mathop{\\rm '+op+'}'+limits];
- },
-
- HandleOperatorName: function (name) {
- var limits = "\\nolimits";
- var op = this.trimSpaces(this.GetArgument(this.cmd+name)); if (this.error) return;
- if (op == "*") {
- limits = "\\limits";
- op = this.trimSpaces(this.GetArgument(this.cmd+name)); if (this.error) return;
- }
- op = op.replace(/\*/g,'\\char{cmr10}{0x2A}').replace(/-/g,'\\char{cmr10}{0x2D}');
- this.string = '\\mathop{\\rm '+op+'}'+limits+this.string.slice(this.i);
- this.i = 0;
- },
-
- /*
- * Record presence of \shoveleft and \shoveright
- */
- HandleShove: function (name,data) {
- if (this.mlist.data.entry == null) {this.mlist.data.entry = {}}
- this.mlist.data.entry.shove = data[0];
- },
-
- /*
- * Handle \cfrac
- */
- CFrac: function (name) {
- var lr = this.GetBrackets(this.cmd+name); if (this.error) return;
- var num = this.GetArgument(this.cmd+name); if (this.error) return;
- var den = this.GetArgument(this.cmd+name); if (this.error) return;
-
- num = this.Process('\\strut\\textstyle{'+num+'}'); if (this.error) return;
- den = this.Process('\\strut\\textstyle{'+den+'}'); if (this.error) return;
- var data = this.mlist.data;
- var TeX = jsMath.Typeset.TeX(data.style,data.size);
-
- if (lr != "") {
- if (lr != 'l' && lr != 'r') {this.Error("Illegal alignment specified in "+this.cmd+name); return}
- num = jsMath.Box.Set(num,data.style,data.size);
- den = jsMath.Box.Set(den,data.style,data.size);
- if (num.w > den.w) {
- if (lr == 'l') {den.html += jsMath.HTML.Spacer(num.w-den.w)}
- else {den.html = jsMath.HTML.Spacer(num.w-den.w) + den.html}
- den.w = num.w;
- } else if (num.w < den.w) {
- if (lr == 'l') {num.html += jsMath.HTML.Spacer(den.w-num.w)}
- else {num.html = jsMath.HTML.Spacer(den.w-num.w) + num.html}
- num.w = den.w;
- }
- }
-
- this.mlist.Add(jsMath.mItem.Fraction(name,num,den,TeX.default_rule_thickness));
- },
-
- /*
- * Implement AMS generalized fraction
- */
- Genfrac: function (name,data) {
- var left = data[0]; var right = data[1];
- var thickness = data[2]; var style = data[3];
-
- if (left != null) {left = this.delimiter[left]} else
- {left = this.GetDelimiterArg(this.cmd+name); if (this.error) return}
- if (right != null) {right = this.delimiter[right]} else
- {right = this.GetDelimiterArg(this.cmd+name); if (this.error) return}
- if (thickness == null) {thickness = this.GetArgument(this.cmd+name); if (this.error) return}
- if (style == null) {style = this.GetArgument(this.cmd+name); if (this.error) return}
-
- var num = this.ProcessArg(this.cmd+name); if (this.error) return;
- var den = this.ProcessArg(this.cmd+name); if (this.error) return;
-
- if (left == "") {left = null}; if (right == "") {right = null}
- if (thickness == "") {
- var TeX =jsMath.Typeset.TeX(this.mlist.data.style,this.mlist.data.size);
- thickness = TeX.default_rule_thickness;
- } else {
- thickness = this.ParseDimen(thickness,this.cmd+name,0,0);
- }
-
- var frac = jsMath.mItem.Fraction(name,num,den,thickness,left,right);
-
- if (style != "") {
- style = (["D","T","S","SS"])[style];
- if (style == null) {this.Error("Bad math style for "+this.cmd+name); return}
- var mlist = new jsMath.mList([new jsMath.mItem('style',{style:style}),frac]);
- this.mlist.Add(jsMath.mItem.Atom('inner',{type:'mlist',mlist: mlist}));
- } else {
- this.mlist.Add(frac);
- }
- },
-
- /*
- * Implements the multline environment
- */
- Multline: function (name,delim) {
- var data = this.mlist.data;
- var width = this.GetBrackets(this.cmd+'begin{'+name+'}'); if (this.error) return;
- var arg = this.GetEnd(name); if (this.error) return;
-
- var parse = new jsMath.Parser(arg+this.cmd+'\\',null,data.size,'D');
- parse.matrix = name; parse.row = []; parse.table = []; parse.rspacing = [];
- parse.Parse(); if (parse.error) {this.Error(parse); return}
- parse.HandleRow(name,1); // be sure the last row is recorded
-
- //
- // check rows for extra columns and maximum width
- //
- var i; var row; var W = 0;
- for (i = 0; i < parse.table.length; i++) {
- row = parse.table[i];
- if (row.length > 1) {
- this.Error("Rows can contain only one equation in '"+name+"' environment");
- return;
- }
- if (row[0].w > W) {W = row[0].w}
- }
-
- //
- // Determine width of display
- //
- if (width == "") {width = W+2} else {
- width = this.ParseDimen(width,name,0,0);
- if (width < W) {width = W}
- }
-
- //
- // Shove the top and bottom lines
- //
- if (parse.table.length > 1) {
- parse.table[0][0].entry.shove = 'left';
- row = parse.table[parse.table.length-1];
- if (!row[0].entry.shove) {row[0].entry.shove = 'right'}
- }
- //
- // Adjust widths of shoved lines
- //
- for (i = 0; i < parse.table.length; i++) {
- row = parse.table[i][0];
- if (row.entry.shove && row.w < width) {
- switch (row.entry.shove) {
- case 'left':
- row.html += jsMath.HTML.Spacer(width-row.w);
- break;
-
- case 'right':
- row.html = jsMath.HTML.Spacer(width-row.w)+row.html;
- break;
- }
- row.w = width;
- }
- }
-
- //
- // Do the layout
- //
- var box = jsMath.Box.Layout(data.size,parse.table);
- this.mlist.Add(jsMath.mItem.Atom('ord',box));
- },
-
- /*
- * Get a delimiter or empty argument
- */
- GetDelimiterArg: function (name) {
- var c = this.trimSpaces(this.GetArgument(name)); if (this.error) return null;
- if (c == "") return null;
- if (this.delimiter[c]) return this.delimiter[c];
- this.Error("Missing or unrecognized delimiter for "+name);
- return null;
- }
-});
290 public/javascripts/jsMath/extensions/AMSsymbols.js
View
@@ -1,290 +0,0 @@
-/*
- * extensions/AMSsymbol.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file defines the macros needed to access the AMS symbol fonts
- * available in msam10 and msbm10. You can activate it by calling
- *
- * jsMath.Extension.Require('AMSsymbols');
- *
- * once jsMath.js has been loaded.
- *
- * Note that you will need to install the msam10 and msbm10 fonts
- * that are available from the jsMath extra font page at
- *
- * http://www.math.union.edu/locate/jsMath/download/extra-fonts/
- *
- * in order to make this work in image mode. Note that there is no
- * unicode fallback mode for these fonts at this time.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-
-delete jsMath.Parser.prototype.macros['hbar'];
-delete jsMath.Parser.prototype.macros['angle'];
-delete jsMath.Parser.prototype.macros['rightleftharpoons'];
-
-jsMath.Extension.MathChar("msam10",{
- // Miscellaneous symbols
- vartriangle: [3,0x4D],
- triangledown: [0,0x4F],
- square: [0,0x03],
- lozenge: [0,0x06],
- circledS: [0,0x73],
- angle: [0,0x5C],
- measuredangle: [0,0x5D],
- backprime: [0,0x38],
- blacktriangle: [0,0x4E],
- blacktriangledown: [0,0x48],
- blacksquare: [0,0x04],
- blacklozenge: [0,0x07],
- bigstar: [0,0x46],
- sphericalangle: [0,0x5E],
- complement: [0,0x7B],
-
- // Binary operators
- dotplus: [2,0x75],
- Cap: [2,0x65],
- doublecap: [2,0x65],
- Cup: [2,0x64],
- doublecup: [2,0x64],
- barwedge: [2,0x5A],
- veebar: [2,0x59],
- doublebarwedge: [2,0x5B],
- boxminus: [2,0x0C],
- boxtimes: [2,0x02],
- boxdot: [2,0x00],
- boxplus: [2,0x01],
- leftthreetimes: [2,0x68],
- rightthreetimes: [2,0x69],
- curlywedge: [2,0x66],
- curlyvee: [2,0x67],
- circleddash: [2,0x7F],
- circledast: [2,0x7E],
- circledcirc: [2,0x7D],
- centerdot: [2,0x05],
- intercal: [2,0x7C],
-
- // Binary relations
- leqq: [3,0x35],
- leqslant: [3,0x36],
- eqslantless: [3,0x30],
- lesssim: [3,0x2E],
- lessapprox: [3,0x2F],
- lll: [3,0x6E],
- llless: [3,0x6E],
- lessgtr: [3,0x37],
- lesseqgtr: [3,0x51],
- lesseqqgtr: [3,0x53],
- doteqdot: [3,0x2B],
- Doteq: [3,0x2B],
- risingdotseq: [3,0x3A],
- fallingdotseq: [3,0x3B],
- backsim: [3,0x76],
- backsimeq: [3,0x77],
- subseteqq: [3,0x6A],
- Subset: [3,0x62],
- sqsubset: [3,0x40],
- preccurlyeq: [3,0x34],
- curlyeqprec: [3,0x32],
- precsim: [3,0x2D],
- vartriangleleft: [3,0x43],
- trianglelefteq: [3,0x45],
- vDash: [3,0x0F],
- Vvdash: [3,0x0E],
- smallsmile: [3,0x60],
- smallfrown: [3,0x61],
- bumpeq: [3,0x6C],
- Bumpeq: [3,0x6D],
- varpropto: [3,0x5F],
- blacktriangleleft: [3,0x4A],
- therefore: [3,0x29],
- geqq: [3,0x3D],
- geqslant: [3,0x3E],
- eqslantgtr: [3,0x31],
- gtrsim: [3,0x26],
- gtrapprox: [3,0x27],
- ggg: [3,0x6F],
- gggtr: [3,0x6F],
- gtrless: [3,0x3F],
- gtreqless: [3,0x52],
- gtreqqless: [3,0x54],
- eqcirc: [3,0x50],
- circeq: [3,0x24],
- triangleq: [3,0x2C],
- supseteqq: [3,0x6B],
- Supset: [3,0x63],
- sqsupset: [3,0x41],
- succcurlyeq: [3,0x3C],
- curlyeqsucc: [3,0x33],
- succsim: [3,0x25],
- vartriangleright: [3,0x42],
- trianglerighteq: [3,0x44],
- Vdash: [3,0x0D],
- between: [3,0x47],
- pitchfork: [3,0x74],
- blacktriangleright: [3,0x49],
- because: [3,0x2A],
-
- // Arrows
- leftleftarrows: [3,0x12],
- leftrightarrows: [3,0x1C],
- Lleftarrow: [3,0x57],
- twoheadleftarrow: [3,0x11],
- leftarrowtail: [3,0x1B],
- looparrowleft: [3,0x22],
- leftrightharpoons: [3,0x0B],
- circlearrowleft: [3,0x09],
- Lsh: [3,0x1E],
- upuparrows: [3,0x14],
- upharpoonleft: [3,0x18],
- downharpoonleft: [3,0x19],
- multimap: [3,0x28],
- leftrightsquigarrow:[3,0x21],
- rightrightarrows: [3,0x13],
- rightleftarrows: [3,0x1D],
- Rrightarrow: [3,0x56],
- twoheadrightarrow: [3,0x10],
- rightarrowtail: [3,0x1A],
- looparrowright: [3,0x23],
- rightleftharpoons: [3,0x0A],
- circlearrowright: [3,0x08],
- Rsh: [3,0x1F],
- downdownarrows: [3,0x15],
- upharpoonright: [3,0x16],
- downharpoonright: [3,0x17],
- rightsquigarrow: [3,0x20]
-});
-
-jsMath.Extension.MathChar("msbm10",{
- // Lowercase Greek letters
- digamma: [0,0x7A],
- varkappa: [0,0x7B],
-
- // Hebrew letters
- beth: [0,0x69],
- daleth: [0,0x6B],
- gimel: [0,0x6A],
-
- // Miscellaneous symbols
- hbar: [0,0x7E],
- hslash: [0,0x7D],
- nexists: [0,0x40],
- mho: [0,0x66],
- Finv: [0,0x60],
- Game: [0,0x61],
- Bbbk: [0,0x7C],
- varnothing: [0,0x3F],
- eth: [0,0x67],
- diagup: [0,0x1E],
- diagdown: [0,0x1F],
-
- // Binary operators
- smallsetminus: [2,0x72],
- divideontimes: [2,0x3E],
- ltimes: [2,0x6E],
- rtimes: [2,0x6F],
-
- // Binary relations
- approxeq: [3,0x75],
- lessdot: [3,0x6C],
- precapprox: [3,0x77],
- gtrdot: [3,0x6D],
- thicksim: [3,0x73],
- thickapprox: [3,0x74],
- succapprox: [3,0x76],
- shortmid: [3,0x70],
- shortparallel: [3,0x71],
- backepsilon: [3,0x7F],
-
- // Negated relations
- nless: [3,0x04],
- nleq: [3,0x02],
- nleqslant: [3,0x0A],
- nleqq: [3,0x14],
- lneq: [3,0x0C],
- lneqq: [3,0x08],
- lvertneqq: [3,0x00],
- lnsim: [3,0x12],
- lnapprox: [3,0x1A],
- nprec: [3,0x06],
- npreceq: [3,0x0E],
- precneqq: [3,0x16],
- precnsim: [3,0x10],
- precnapprox: [3,0x18],
- nsim: [3,0x1C],
- nshortmid: [3,0x2E],
- nmid: [3,0x2D],
- nvdash: [3,0x30],
- nVdash: [3,0x31],
- ntriangleleft: [3,0x36],
- ntrianglelefteq: [3,0x35],
- nsubseteq: [3,0x2A],
- nsubseteqq: [3,0x22],
- subsetneq: [3,0x28],
- varsubsetneq: [3,0x20],
- subsetneqq: [3,0x24],
- varsubsetneqq: [3,0x26],
- ngtr: [3,0x05],
- ngeq: [3,0x03],
- ngeqslant: [3,0x0B],
- ngeqq: [3,0x15],
- gneq: [3,0x0D],
- gneqq: [3,0x09],
- gvertneqq: [3,0x01],
- gnsim: [3,0x13],
- gnapprox: [3,0x1B],
- nsucc: [3,0x07],
- nsucceq: [3,0x0F],
- succneqq: [3,0x17],
- succnsim: [3,0x11],
- succnapprox: [3,0x19],
- ncong: [3,0x1D],
- nshortparallel: [3,0x2F],
- nparallel: [3,0x2C],
- nvDash: [3,0x32],
- nVDash: [3,0x33],
- ntriangleright: [3,0x37],
- ntrianglerighteq: [3,0x34],
- nsupseteq: [3,0x2B],
- nsupseteqq: [3,0x23],
- supsetneq: [3,0x29],
- varsupsetneq: [3,0x21],
- supsetneqq: [3,0x25],
- varsupsetneqq: [3,0x27],
-
- // Arrows
- curvearrowleft: [3,0x78],
- curvearrowright: [3,0x79],
-
- // Negated arrows
- nleftarrow: [3,0x38],
- nLeftarrow: [3,0x3A],
- nleftrightarrow: [3,0x3D],
- nrightarrow: [3,0x39],
- nRightarrow: [3,0x3B],
- nLeftrightarrow: [3,0x3C]
-});
-
-jsMath.Macro('Bbb','{\\msbm #1}',1);
-jsMath.Macro('mathbb','{\\msbm #1}',1);
-jsMath.Extension.Font('msbm');
-jsMath.Extension.Font('msam');
122 public/javascripts/jsMath/extensions/HTML.js
View
@@ -1,122 +0,0 @@
-/*
- * extensions/HTML.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements a number of HTML-specific extensions to TeX,
- * including \color, \style, \class, \unicode, etc. It will be loaded
- * automatically when needed, or can be loaded by
- *
- * jsMath.Extension.Require('HTML');
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {
- color: 'Color',
- href: 'Href',
- 'class': 'Class',
- style: 'Style',
- cssId: 'CSSId',
- unicode: 'Unicode'
- },
-
- /*
- * Show the argument in a particular color
- */
- Color: function (name) {
- var color = this.GetArgument(this.cmd+name); if (this.error) return;
- this.CheckHTML(color,name); if (this.error) return;
- // check that it looks like a color?
- this.AddHTML(name,['<span style="color: '+color+'">','</span>']);
- },
-
- /*
- * Make the argument be a link
- */
- Href: function (name) {
- var href = this.GetArgument(this.cmd+name); if (this.error) return;
- this.CheckHTML(href,name); if (this.error) return;
- this.AddHTML(name,['<a class="link" href="'+href+'">','</a>']);
- },
-
- /*
- * Apply a CSS class to the argument
- */
- Class: function (name) {
- var clss = this.GetArgument(this.cmd+name); if (this.error) return;
- this.CheckHTML(clss,name); if (this.error) return;
- this.AddHTML(name,['<span class="'+clss+'">','</span>']);
- },
-
- /*
- * Apply a CSS style to the argument
- */
- Style: function (name) {
- var style = this.GetArgument(this.cmd+name); if (this.error) return;
- this.CheckHTML(style,name); if (this.error) return;
- this.AddHTML(name,['<span style="'+style+'">','</span>']);
- },
-
- /*
- * Add a CSS element ID to the argument
- */
- CSSId: function (name) {
- var id = this.GetArgument(this.cmd+name); if (this.error) return;
- this.CheckHTML(id,name); if (this.error) return;
- this.AddHTML(name,['<span id="'+id+'">','</span>']);
- },
-
- /*
- * Insert some raw HTML around the argument (this will not affect
- * the spacing or other TeX features)
- */
- AddHTML: function (name,params) {
- var data = this.mlist.data;
- var arg = this.GetArgument(this.cmd+name); if (this.error) return;
- arg = jsMath.Parse(arg,data.font,data.size,data.style);
- if (arg.error) {this.Error(arg); return}
- this.mlist.Add(jsMath.mItem.HTML(params[0]));
- for (var i = 0; i < arg.mlist.Length(); i++) {this.mlist.Add(arg.mlist.Get(i))}
- this.mlist.Add(jsMath.mItem.HTML(params[1]));
- },
-
- CheckHTML: function (data,name) {
- if (data.match(/[<>&"]/))
- {this.Error("Can't include raw HTML in first argument of "+this.cmd+name)}
- },
-
- /*
- * Insert a unicode reference as an Ord atom. Its argument should
- * be the unicode code point, e.g. \unicode{8211}, or \unicode{x203F}.
- * You can also specify the height (offset from the x height) and depth
- * in ems, together with a CSS class for the character, e.g.,
- * \unicode{8211,class,.2,-.3}
- */
- Unicode: function (name) {
- var arg = this.GetArgument(this.cmd+name); if (this.error) return;
- this.CheckHTML(arg,name); if (this.error) return;
- arg = arg.split(','); arg[0] = '&#'+arg[0]+';';
- if (!arg[1]) {arg[1] = 'normal'}
- this.mlist.Add(jsMath.mItem.TextAtom('ord',arg[0],arg[1],arg[2],arg[3]));
- }
-
-});
51 public/javascripts/jsMath/extensions/autobold.js
View
@@ -1,51 +0,0 @@
-/*
- * extensions/autobold.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file causes jsMath to use \boldsymbol{...} around mathematics
- * that appears within <B>...</B> tags or has font-weight:bold applied
- * via CSS rule. You can activate it by calling
- *
- * jsMath.Extension.Require('autobold');
- *
- * once jsMath.js has been loaded, or by adding "extensions/autobold.js"
- * to the loadFiles array in jsMath/easy/load.js.
- *
- * Note that you will need to install the cmmib10 and cmbsy10 fonts
- * that are available from the jsMath extra font page at
- *
- * http://www.math.union.edu/locate/jsMath/download/extra-fonts/
- *
- * to make this work in image mode. Note that there is no unicode
- * fallback for these fonts at the moment.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2008 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Extension.Require("boldsymbol");
-
-jsMath.Translate.OldParse = jsMath.Translate.Parse;
-jsMath.Translate.Parse = function (style,text,noCache) {
- if (jsMath.BBoxFor('</SPAN></SPAN><SPAN STYLE="font-family:Times,serif">MMMMMMMMMM</SPAN><SPAN><SPAN>').w >
- jsMath.BBoxFor('</SPAN></SPAN><SPAN STYLE="font-family:Times,serif; font-weight:normal">MMMMMMMMMM</SPAN><SPAN><SPAN>').w) {
- text = '\\boldsymbol{' + text + '}';
- }
- return jsMath.Translate.OldParse(style,text,noCache);
-}
113 public/javascripts/jsMath/extensions/bbox.js
View
@@ -1,113 +0,0 @@
-/*
- * extensions/bbox.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements the \bbox macro, which creates an HTML box that
- * can be styled (for background colors, and so on). You can include
- * an optional dimension that tells how much extra padding to include
- * around the bounding box for the mathematics. E.g.,
- *
- * \bbox[2pt]{x+y} % an invisible box around x+y with 2pt of extra space
- * \bbox[green]{x+y} % a green box around x+y
- * \bbox[green,2pt]{x+y} % a green box with 2pt of extra space
- * \bbox[yellow,2pt,border:1px solid red]{x+y}
- * % a yellow box with a red border and 2pt space
- *
- * This extension is loaded automatically when needed, or you can call
- * it directly via
- *
- * jsMath.Extension.Require('bbox');
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Add(jsMath.HTML,{
-
- /*
- * Create a colored bbounding box
- */
- BBox: function (w,h,d,c,s) {
- if (w <= 0) {return ''}
- if (d == null) {d = 0}
- var style = (jsMath.Browser.msieInlineBlockFix ? '' : 'overflow:visible;');
- style += 'width:'+this.Em(w)+'; height:'+this.Em(h+d)+';';
- if (jsMath.Browser.mozInlineBlockBug) {d = -h}
- if (jsMath.Browser.msieInlineBlockFix) {d -= jsMath.d}
- if (d) {style += ' vertical-align:'+this.Em(-d)+';'}
- if (c) {style += ' background-color:'+c+';'}
- var html = '<span class="blank" style="'+style+s+'"></span>';
- return html;
- }
-
-});
-
-jsMath.Add(jsMath.mList.prototype.Atomize,{
- /*
- * Creates the box HTML
- */
- bbox: function (style,size,mitem,prev,mlist) {
- var box; var w; var h; var d;
- var nuc = mitem.nuc = jsMath.Box.Set(mitem.nuc,style,size).Remeasured();
- if (box == null) {w = nuc.w; h = nuc.h; d = nuc.d} // values before super/subs-cript
- var nuc = mitem.nuc; nuc.Styled(); var pad = mitem.pad;
- if (pad) {w += 2*pad; h += pad; d += pad; nuc.w += pad}
- if (jsMath.Browser.msieCenterBugFix)
- {nuc.html = '<span style="position:relative">'+nuc.html+'</span>'}
- nuc.html =
- jsMath.HTML.BBox(w,h,d,mitem.color,mitem.style) +
- jsMath.HTML.Spacer(pad-w) +
- nuc.html;
- nuc.Remeasured();
- if (pad && nuc.w < w) {
- nuc.html += jsMath.HTML.Spacer(w-nuc.w);
- nuc.w = w;
- }
- nuc.h = Math.max(nuc.h,h); nuc.d = Math.max(nuc.d,d);
- nuc.bh = Math.max(nuc.bh,nuc.h); nuc.bd = Math.max(nuc.bd,nuc.d);
- mitem.type = 'ord';
- jsMath.mList.prototype.Atomize.SupSub(style,size,mitem);
- }
-});
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {bbox: 'BBox'},
-
- /*
- * Implement \bbox[...]{...}
- */
- BBox: function (name) {
- var extra = this.GetBrackets(this.cmd+name); if (this.error) return;
- var arg = this.GetArgument(this.cmd+name); if (this.error) return;
- var nuc = this.Process(arg); if (this.error) return;
- var color; var pad = 0; var style = '';
- if (extra != '') {
- var parts = extra.split(/,/);
- for (var i in parts) {
- if (parts[i].match(/^\s*([-+]?(\.\d+|\d+(\.\d*)?))(pt|em|ex|mu|px)\s*$/))
- {pad = this.ParseDimen(parts[i],'',0,1)}
- else if (parts[i].match(/:/)) {style = parts[i]}
- else {color = parts[i]}
- }
- }
- var atom = {nuc: nuc, atom: 1, pad: pad, color: color, style: style};
- this.mlist.Add(new jsMath.mItem('bbox',atom));
- }
-});
63 public/javascripts/jsMath/extensions/boldsymbol.js
View
@@ -1,63 +0,0 @@
-/*
- * extensions/boldsymbol.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements the \boldsymbol macro. You can activate it
- * by calling
- *
- * jsMath.Extension.Macro('boldsymbol');
- *
- * which will cause the extension to be loaded only when it is
- * needed, or you can force it to be loaded via
- *
- * jsMath.Extension.Require('boldsymbol');
- *
- * once jsMath.js has been loaded.
- *
- * Note that you will need to install the cmmib10 and cmbsy10 fonts
- * that are available from the jsMath extra font page at
- *
- * http://www.math.union.edu/locate/jsMath/download/extra-fonts/
- *
- * to make this work in image mode. Note that there is no unicode
- * fallback for these fonts at the moment.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2006-2007 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {boldsymbol: 'BoldSymbol'},
-
- /*
- * Implement \boldsymbol{...}
- */
- BoldSymbol: function (name) {
- var fam = jsMath.TeX.fam; var restart = 0;
- var oldfam = [fam[0],fam[1],fam[2]];
- fam[0] = "cmbx10"; fam[1] = "cmmib10"; fam[2] = "cmbsy10";
- try{var box = this.ProcessArg(this.cmd+name)}
- catch (e) {restart = (e == "restart")}
- fam[0] = oldfam[0]; fam[1] = oldfam[1]; fam[2] = oldfam[2];
- if (this.error) return; if (restart) {throw "restart"}
- this.mlist.Add(jsMath.mItem.Atom('ord',box));
- }
-
-});
250 public/javascripts/jsMath/extensions/double-click.js
View
@@ -1,250 +0,0 @@
-/*
- * extensions/double-click.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file allows users to double click on typeset mathematics
- * to view the TeX source for the given expression. It will be loaded
- * automatically when needed, or can be loaded by
- *
- * jsMath.Extension.Require('double-click');
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2008 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-if (jsMath.Click && jsMath.Click.styles)
- {jsMath.Click.oldStyles = jsMath.Click.styles}
-
-jsMath.Add(jsMath.Click,{
-
- dragging: 0,
-
- styles: {
- // Floating windows for displaying TeX source
- '#jsMath_float': {
- position: 'absolute', top: '0px', left: '0px', 'z-index': '101',
- 'max-width': '80%', width: 'auto', height: 'auto',
- padding: '0px', margin: '0px', 'font-size': '100%'
- },
- '#jsMath_float .drag': {
- 'background-color': '#DDDDDD',
- border: 'outset 1px', padding: '0px', margin: '0px',
- width: 'auto', height: '12px', 'font-size': '1px'
- },
- '#jsMath_float .close': {
- 'background-color': '#E6E6E6',
- border: 'inset 1px', margin: '1px 2px', padding: '0px',
- width: '8px', height: '8px'
- },
- '#jsMath_float .source': {
- 'background-color': '#E2E2E2',
- border: 'outset 1px', margin: '0px', padding: '8px 15px',
- width: 'auto', height: 'auto',
- 'font-family': 'courier, fixed', 'font-size': '90%'
- }
- },
-
- /*
- * Create the hidden DIV used for the tex source window
- */
- Init: function () {
- if (this.oldStyles) {jsMath.Insert(this.styles,this.oldStyles)}
- jsMath.Setup.Styles(this.styles);
- this.source = jsMath.Setup.DIV("float",{display:'none'});
- this.source.innerHTML =
- '<div class="drag"><div class="close"></div></div>'
- + '<div class="source"><span></span></div>';
- this.drag = this.source.firstChild;
- this.tex = this.drag.nextSibling.firstChild;
- this.drag.firstChild.onclick = jsMath.Click.CloseSource;
- this.drag.onmousedown = jsMath.Click.StartDragging;
- this.drag.ondragstart = jsMath.Click.False;
- this.drag.onselectstart = jsMath.Click.False;
- this.source.onclick = jsMath.Click.CheckClose;
- },
- False: function () {return false},
-
- /*
- * Handle a double-click on an equation
- */
- DblClick: function (data) {
- var event = data[0]; var TeX = data[1];
- var event = jsMath.Click.Event(event);
-
- var source = jsMath.Click.source
- var tex = jsMath.Click.tex;
-
- source.style.visibility = 'hidden';
- source.style.display = ''; source.style.width = '';
- source.style.left = ''; source.style.top = '';
- tex.innerHTML = '';
-
- TeX = TeX.replace(/^\s+|\s+$/g,'');
- TeX = TeX.replace(/&/g,'&amp;');
- TeX = TeX.replace(/</g,'&lt;');
- TeX = TeX.replace(/>/g,'&gt;');
- TeX = TeX.replace(/\n/g,'<br/>');
- tex.innerHTML = TeX;
-
- var h = source.offsetHeight; var w;
- if (jsMath.Browser.msieDivWidthBug) {
- tex.className = 'source'; // Work around MSIE bug where
- w = tex.offsetWidth + 5; // DIV's don't collapse to
- tex.className = ''; // their natural widths
- } else {
- w = source.offsetWidth;
- }
- w = Math.max(50,Math.min(w,.8*event.W,event.W-40));
- var x = Math.floor(event.x-w/2); var y = Math.floor(event.y-h/2);
- x = event.X + Math.max(Math.min(x,event.W-w-20),20);
- y = event.Y + Math.max(Math.min(y,event.H-h-5),5);
-
- source.style.left = x+'px'; source.style.top = y+'px';
- source.style.width = w+'px';
- source.style.visibility = '';
- jsMath.Click.left = x + event.X; jsMath.Click.top = y + event.Y;
- jsMath.Click.w = w; jsMath.Click.h = source.offsetHeight;
-
- jsMath.Click.DeselectText(x,y);
- return false;
- },
-
- /*
- * Get window width, height, and offsets plus
- * position of pointer relative to the window
- */
- Event: function (event) {
- var W = jsMath.window.innerWidth || jsMath.document.body.clientWidth;
- var H = jsMath.window.innerHeight || jsMath.document.body.clientHeight;
- var X = jsMath.window.pageXOffset; var Y = jsMath.window.pageYOffset;
- if (X == null) {
- X = jsMath.document.body.clientLeft;
- Y = jsMath.document.body.clientTop;
- }
- var x = event.pageX; var y = event.pageY;
- if (x == null) {
- x = event.clientX; y = event.clientY;
- if (jsMath.browser == 'MSIE' && jsMath.document.compatMode == 'CSS1Compat') {
- X = jsMath.document.documentElement.scrollLeft;
- Y = jsMath.document.documentElement.scrollTop;
- W = jsMath.document.documentElement.clientWidth;
- H = jsMath.document.documentElement.clientHeight;
- } else {
- X = jsMath.document.body.scrollLeft;
- Y = jsMath.document.body.scrollTop;
- }
- } else {x -= X; y -= Y}
-
- return {x: x, y: y, W: W, H: H, X: X, Y: Y};
- },
-
- /*
- * Unselect whatever text is selected (since double-clicking
- * usually selects something)
- */
- DeselectText: function (x,y) {
- if (jsMath.window.getSelection && jsMath.window.getSelection().removeAllRanges)
- {jsMath.window.getSelection().removeAllRanges()}
- else if (jsMath.document.getSelection && jsMath.document.getSelection().removeAllRanges)
- {jsMath.document.getSelection().removeAllRanges()}
- else if (jsMath.document.selection && jsMath.document.selection.empty)
- {jsMath.document.selection.empty()}
- else {
- /* Hack to deselect the text in Opera and Safari */
- if (jsMath.browser == 'MSIE') return; // don't try it if MISE on Mac
- jsMath.hiddenTop.innerHTML =
- '<textarea style="visibility:hidden" rows="1" cols="1">a</textarea>';
- jsMath.hiddenTop.firstChild.style.position = 'absolute';
- jsMath.hiddenTop.firstChild.style.left = x+'px';
- jsMath.hiddenTop.firstChild.style.top = y+'px';
- setTimeout(jsMath.Click.SelectHidden,1);
- }
- },
- SelectHidden: function () {
- jsMath.hiddenTop.firstChild.focus();
- jsMath.hiddenTop.firstChild.select();
- jsMath.hiddenTop.innerHTML = '';
- },
-
- /*
- * Close the TeX source window
- */
- CloseSource: function () {
- jsMath.Click.tex.innerHTML = '';
- jsMath.Click.source.style.display = 'none';
- jsMath.Click.source.style.visibility = 'hidden';
- jsMath.Click.StopDragging();
- return false;
- },
- CheckClose: function (event) {
- if (!event) {event = jsMath.window.event}
- if (event.altKey) {jsMath.Click.CloseSource(); return false}
- },
-
- /*
- * Set up for dragging the source panel
- */
- StartDragging: function (event) {
- if (!event) {event = jsMath.window.event}
- if (jsMath.Click.dragging) {jsMath.Click.StopDragging(event)}
- var event = jsMath.Click.Event(event);
- jsMath.Click.dragging = 1;
- jsMath.Click.x = event.x + 2*event.X - jsMath.Click.left;
- jsMath.Click.y = event.y + 2*event.Y - jsMath.Click.top;
- jsMath.Click.oldonmousemove = jsMath.document.onmousemove;
- jsMath.Click.oldonmouseup = jsMath.document.onmouseup;
- jsMath.document.onmousemove = jsMath.Click.DragSource;
- jsMath.document.onmouseup = jsMath.Click.StopDragging;
- return false;
- },
-
- /*
- * Stop dragging the source window
- */
- StopDragging: function (event) {
- if (jsMath.Click.dragging) {
- jsMath.document.onmousemove = jsMath.Click.oldonmousemove;
- jsMath.document.onmouseup = jsMath.Click.oldonmouseup;
- jsMath.Click.oldonmousemove = null;
- jsMath.Click.oldonmouseup = null;
- jsMath.Click.dragging = 0;
- }
- return false;
- },
-
- /*
- * Move the source window (but stay within the browser window)
- */
- DragSource: function (event) {
- if (!event) {event = jsMath.window.event}
- if (jsMath.Browser.buttonCheck && !event.button) {return jsMath.Click.StopDragging(event)}
- event = jsMath.Click.Event(event);
- var x = event.x + event.X - jsMath.Click.x;
- var y = event.y + event.Y - jsMath.Click.y;
- x = Math.max(event.X,Math.min(event.W+event.X-jsMath.Click.w,x));
- y = Math.max(event.Y,Math.min(event.H+event.Y-jsMath.Click.h,y));
- jsMath.Click.source.style.left = x + 'px';
- jsMath.Click.source.style.top = y + 'px';
- jsMath.Click.left = x + event.X; jsMath.Click.top = y + event.Y;
- return false;
- }
-
-});
-
-jsMath.Click.Init();
234 public/javascripts/jsMath/extensions/eqn-number.js
View
@@ -1,234 +0,0 @@
-/*
- * extensions/eqn-number.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file causes jsMath to add equation numbers to displayed
- * equations. These are displayed at the right, but the styles can
- * be controlled through the jsMath.EqnNumber object. Equations
- * are numbered if they include a \label{xxx} call, and the macro
- * \ref{xxx} can be used to refer to the equation number elsewhere
- * in the document (it must appear by itself in a math formula,
- * e.g., $\ref{xxx}$). The "label-ref" CSS style can be used to
- * style the references.
- *
- * If jsMath.EqnNumber.autonumber is set to 1, then ALL displayed
- * equations will be numberd. Use the \nolabel macro to prevent
- * equation numbering on an equation.
- *
- * You can activate eqn-numbering by calling
- *
- * jsMath.Extension.Require('eqn-number');
- *
- * once jsMath.js has been loaded, or by adding "extensions/eqn-number.js"
- * to the loadFiles array in jsMath/easy/load.js.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2008 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-if (jsMath.EqnNumber) {jsMath.EqnNumber_old = jsMath.EqnNumber}
-
-jsMath.EqnNumber = {
-
- styles: {
- '.jsMath_displayBox, .tex2math_div': {position: 'relative'},
- '.jsMath_number': {
- position: 'absolute',
- right: '2em', top: '50%', 'margin-top': '-.5em',
- height: 'auto', width: 'auto'
- },
- '.jsMath_ref': {'text-decoration': 'none'}
- },
-
- autonumber: 0, // set to 1 to have ALL equations numbered
-
- number: 0,
- format: function (n) {return n},
- formatLabel: function (n) {return '<A NAME="eqn-'+n+'">('+n+')</A>'},
- formatRef: function (n) {return '(<A CLASS="jsMath_ref" HREF="#eqn-'+n+'">'+n+'</A>)'},
-
- _label: null, // flag set when \label{x} is used
- _labels: {}, // stores label-name => label-value pairs
- _refs: {}, // stores elements referring to undefined labels
- _nolabel: 0, // set by \nolabel
-
- nextNumber: function () {
- var ref = this.format(++this.number);
- if (this._label) {
- this._labels[this._label] = ref;
- if (this._refs[this._label]) this.fixRefs(this._label);
- }
- return this.formatLabel(ref);
- },
-
- isRef: function (element) {
- var tex = element.innerHTML;
- var result = tex.match(/^\s*\\ref\s*\{([^\}]+)\}\s*$/);
- if (!result) {return 0}
- var ref = result[1];
- if (this._labels[ref]) {
- this.setRef(element,ref);
- } else {
- if (!this._refs[ref]) {this._refs[ref] = []}
- this._refs[ref][this._refs[ref].length] = element;
- }
- return 1;
- },
-
- setRef: function (element,ref) {
- element.innerHTML = this.formatRef(this._labels[ref]);
- element.className = "label-ref";
- },
-
- fixRefs: function (label) {
- for (var i = 0; i < this._refs[label].length; i++)
- {this.setRef(this._refs[label][i],label)}
- delete this._refs[label];
- },
-
- badRefs: function () {
- for (var label in this._refs) {
- for (var i = 0; i < this._refs[label].length; i++) {
- var element = this._refs[label][i];
- element.className = "typeset";
- element.innerHTML = "<span class='error'>Reference '"+label+"' is undefined</span>";
- }
- }
- },
-
- makeDIV: function (element) {
- var div = document.createElement('div');
- div.className = 'jsMath_displayBox';
- div.innerHTML = '<div class="jsMath_number">' + this.nextNumber() + '</div>';
- element.parentNode.insertBefore(div,element);
- element.parentNode.removeChild(element);
- div.appendChild(element);
- },
-
- makeSPAN: function (element) {
- var span = document.createElement('span');
- span.className = 'jsMath_number';
- span.style.display = 'inline-block';
- span.innerHTML = jsMath.EqnNumber.nextNumber();
- element.parentNode.insertBefore(span,element);
- },
-
- ConvertMath: function (style,element,nocache) {
- var EqnNumber = jsMath.EqnNumber;
- if (EqnNumber.isRef(element)) return;
- EqnNumber._label = null; EqnNumber._nolabel = 0;
- this.ConvertMath_old(style,element,nocache);
- if (EqnNumber._label || (EqnNumber.autonumber && !EqnNumber._nolabel)) {
- if (element.tagName.toLowerCase() == 'div') {
- EqnNumber.makeDIV(element);
- } else if (element.parentNode.className == 'tex2math_div') {
- EqnNumber.makeSPAN(element);
- }
- }
- },
-
- ProcessComplete: function () {
- jsMath.EqnNumber.badRefs();
- this.ProcessComplete_old.apply(this,arguments);
- },
-
- Init: function () {
- jsMath.Setup.Styles(this.styles);
- jsMath.Translate.ConvertMath_old = jsMath.Translate.ConvertMath;
- jsMath.Translate.ConvertMath = this.ConvertMath;
- jsMath.Translate.ProcessComplete_old = jsMath.Translate.ProcessComplete;
- jsMath.Translate.ProcessComplete = this.ProcessComplete;
- },
-
- environments: {
- 'equation*': 'Star',
- 'eqnarray*': 'Star',
- 'align*': 'Star',
- 'multline*': 'Star',
- 'gather*': 'Star',
- align: ['StarExtension','AMSmath'],
- multline: ['StarExtension','AMSmath'],
- gather: ['StarExtension','AMSmath']
- },
-
- ResetStarEnvironments: function () {
- var Nenv = jsMath.EqnNumber.environments;
- var Penv = jsMath.Parser.prototype.environments;
- for (var name in Nenv) {
- if (name.match(/\*$/)) {Penv[name] = Nenv[name]}
- }
- }
-
-};
-
-if (jsMath.EqnNumber_old) {
- jsMath.Insert(jsMath.EqnNumber,jsMath.EqnNumber_old);
- delete jsMath.EqnNumber_old;
-}
-
-jsMath.Package(jsMath.Parser,{
- macros: {
- label: 'Label',
- nolabel: 'NoLabel',
- nonumber: 'NoLabel',
- ref: 'Ref'
- },
-
- environments: jsMath.EqnNumber.environments,
-
- Label: function (name) {
- var label = this.GetArgument(this.cmd+name); if (this.error) return;
- var EqnNumber = jsMath.EqnNumber;
- if (!EqnNumber._label) {
- if (!EqnNumber._labels[label]) {
- EqnNumber._label = label;
- EqnNumber._nolabel = 0;
- } else {
- this.Error("Label '"+label+"' is already defined");
- }
- } else {
- this.Error(this.cmd+name+' can only be used once in an equation');
- }
- },
-
- NoLabel: function (name) {
- var EqnNumber = jsMath.EqnNumber;
- EqnNumber._label = null; EqnNumber._nolabel = 1;
- },
-
- Ref: function (name) {
- this.Error(this.cmd+name+' must be used by itself');
- },
-
- Star: function (name) {
- this.NoLabel();
- var cmd = this.environments[name.substr(0,name.length-1)];
- if (typeof(cmd) === 'string') {cmd = [cmd]}
- this[cmd[0]](name,cmd.slice(1));
- },
-
- StarExtension: function (name,data) {
- try {this.Extension(name,data)} catch (e) {}
- jsMath.Synchronize(jsMath.EqnNumber.ResetStarEnvironments);
- throw "restart";
- }
-
-});
-
-jsMath.EqnNumber.Init();
71 public/javascripts/jsMath/extensions/fbox.js
View
@@ -1,71 +0,0 @@
-/*
- * extensions/fbox.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements the \fbox macro. It will be loaded
- * automatically when needed, or can be loaded by
- *
- * jsMath.Extension.Require('fbox');
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Add(jsMath.HTML,{
-
- /*
- * Create a colored frame
- */
- Frame: function (x,y,w,h,c,pos) {
-
- h -= 2/jsMath.em; // use 2 pixels to compensate for border size
- w -= 2/jsMath.em;
- y -= 1/jsMath.em;
- if (!c) {c = ''} else {c = ' '+c};
- if (pos) {pos = 'absolute;'} else
- {pos = 'relative; margin-right: '+this.Em(-(w+2/jsMath.em))+'; '}
- return '<img src="'+jsMath.blank+'" style="position:' + pos
- + 'vertical-align: '+this.Em(y)+'; left: '+this.Em(x)+'; '
- + 'width:' +this.Em(w*jsMath.Browser.imgScale)+'; '
- + 'height:'+this.Em(h*jsMath.Browser.imgScale)+'; '
- + 'border: 1px solid'+c+';" />';
- }
-
-});
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {fbox: 'FBox'},
-
- /*
- * Implement \fbox{...}
- */
- FBox: function (name) {
- var text = this.GetArgument(this.cmd+name); if (this.error) return;
- var arg = jsMath.Box.InternalMath(text,this.mlist.data.size);
- var f = 0.25 * jsMath.sizes[this.mlist.data.size]/100;
- var box = jsMath.Box.Set(arg,this.mlist.data.style,this.mlist.data.size,1).Remeasured();
- var frame = jsMath.HTML.Frame(-f,-box.d-f,box.w+2*f,box.h+box.d+2*f);
- box.html = frame + box.html + jsMath.HTML.Spacer(f);
- box.h += f; box.d += f; box.w +=2*f; box.x += f;
- box.bh = Math.max(box.bh,box.h); box.bd = Math.max(box.bd,box.d);
- this.mlist.Add(jsMath.mItem.Atom('ord',box));
- }
-
-});
38 public/javascripts/jsMath/extensions/font.js
View
@@ -1,38 +0,0 @@
-jsMath.Package(jsMath.Parser,{
-
- macros: {font: 'Font'},
- fontCS: {},
-
- /*
- * Get a CS name or give an error
- */
- GetCSname: function (cmd) {
- var c = this.GetNext();
- if (c != this.cmd) {this.Error(cmd+" must be followed by a control sequence"); return null}
- var cs = this.trimSpaces(this.GetArgument(cmd)); if (this.error) {return null};
- return cs.substr(1);
- },
-
- /*
- * Handle the \font command
- */
- Font: function (name) {
- var cs = this.GetCSname(this.cmd+name); if (this.error) return;
- while (this.nextIsSpace()) {this.i++}
- if (this.string.charAt(this.i++) == '=') {
- while (this.nextIsSpace()) {this.i++}
- var font = this.string.slice(this.i).match(/^[a-z]+[0-9]+/i);
- if (font) {
- this.i += (new String(font)).length;
- if (jsMath.TeX.famName[font] != null) {
- this.macros[cs] = ['HandleFont',jsMath.TeX.famName[font]];
- } else {
- this.macros[cs] = ['Extension',jsMath.Font.URL(font),"fontCS"];
- this.fontCS[cs] = 1; // so Extension has something to delete
- }
- } else {this.Error("Missing font name")}
- } else {this.Error("Missing font definition")}
- }
-
-});
-
124 public/javascripts/jsMath/extensions/leaders.js
View
@@ -1,124 +0,0 @@
-/*
- * extensions/leaders.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements the \overbrace, \underbrace, \overrightarrow
- * and \overleftarrow macros. It will be loaded automatically when needed,
- * or can be loaded by
- *
- * jsMath.Extension.Require('leaders');
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Add(jsMath.Box,{
-
- /*
- * Create a horizontally stretchable "delimiter" (like over- and
- * underbraces).
- */
-//### Add size?
- Leaders: function (W,leader) {
- var h; var d; var w; var html; var font;
- if (leader.lmid) {// braces
- font = jsMath.TeX.fam[leader.left[0]];
- var left = this.GetCharCode(leader.left);
- var right = this.GetCharCode(leader.right);
- var lmid = this.GetCharCode(leader.lmid);
- var rmid = this.GetCharCode(leader.rmid);
- w = (W - left.w - right.w - lmid.w - rmid.w)/2 - .1; h = .4; d = .3;
- if (w < 0) {w = 0}
- html = this.AddClass(left.tclass,left.c,left.font)
- + jsMath.HTML.Rule(w,left.h)
- + this.AddClass(lmid.tclass,lmid.c+rmid.c,lmid.font)
- + jsMath.HTML.Rule(w,right.h)
- + this.AddClass(right.tclass,right.c,right.font);
- } else { //arrows
- font = jsMath.TeX.fam[leader.rep[0]];
- var left = this.GetCharCode(leader.left? leader.left: leader.rep);
- var rep = this.GetCharCode(leader.rep);
- var right = this.GetCharCode(leader.right? leader.right: leader.rep);
- var n = Math.ceil((W - left.w - right.w + .4)/(rep.w - .3));
- w = (W - left.w - right.w + .4 - n*(rep.w - .3));
- if (leader.left) {h = left.h; d = left.d} else {h = right.h; d = right.d}
- if (d == null) {d = 0}; if (h == null) {h = 0}
- var html = this.AddClass(left.tclass,left.c,left.font); var m = Math.floor(n/2);
- var ext = jsMath.HTML.Place(rep.c,-.3,0);
- var ehtml = ''; for (var i = 0; i < m; i++) {ehtml += ext};
- html += this.AddClass(rep.tclass,ehtml,rep.font) + jsMath.HTML.Spacer(w);
- ehtml = ''; for (var i = m; i < n; i++) {ehtml += ext};
- html += this.AddClass(rep.tclass,ehtml,rep.font);
- if (jsMath.Browser.msieFontBug) {html += '<span style="display: none">x</span>'}
- html += jsMath.HTML.Place(this.AddClass(right.tclass,right.c,right.font),-.4,0);
- }
- w = jsMath.EmBoxFor(html).w;
- if (w != W) {
- w = jsMath.HTML.Spacer((W-w)/2);
- html = w + html + w;
- }
- var box = new jsMath.Box('html',html,W,h,d);
- box.bh = jsMath.TeX[font].h; box.bd = jsMath.TeX[font].d;
- return box;
- }
-
-});
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {
- overbrace: ['HandleLeaders','downbrace',1],
- underbrace: ['HandleLeaders','upbrace',1,1,-.05],
- overrightarrow: ['HandleLeaders','rightarrow'],
- underrightarrow: ['HandleLeaders','rightarrow',null,1,-.2],
- overleftarrow: ['HandleLeaders','leftarrow'],
- underleftarrow: ['HandleLeaders','leftarrow',null,1,-.2],
- overleftrightarrow: ['HandleLeaders','leftrightarrow'],
- underleftrightarrow: ['HandleLeaders','leftrightarrow',null,1,-.2]
- },
-
- /*
- * The horizontally stretchable delimiters
- */
- leaders: {
- downbrace: {left: [3,0x7A], lmid: [3,0x7D], rmid: [3,0x7C], right: [3,0x7B]},
- upbrace: {left: [3,0x7C], lmid: [3,0x7B], rmid: [3,0x7A], right: [3,0x7D]},
- leftarrow: {left: [2,0x20], rep: [2,0x00]},
- rightarrow: {rep: [2,0x00], right: [2,0x21]},
- leftrightarrow: {left: [2,0x20], rep: [2, 0x00], right: [2,0x21]}
- },
-
- /*
- * Implements \overbrace, \underbrace, etc.
- */
- HandleLeaders: function (name,data) {
- var box = this.ProcessArg(this.cmd+name); if (this.error) return;
- box = jsMath.Box.Set(box,'D',this.mlist.data.size).Remeasured();
- var leader = jsMath.Box.Leaders(box.w,this.leaders[data[0]]);
- if (data[2]) {leader.y = -leader.h-box.d+(data[3]||0)}
- else {leader.y = box.h + Math.max(0,leader.d)+(data[3]||0)}
- box.x = -(leader.w + box.w)/2;
- var space = jsMath.Box.Space((leader.w-box.w)/2);
- box = jsMath.mItem.Atom(data[1]? 'op': 'ord',
- jsMath.Box.SetList([leader,box,space],'T',this.mlist.data.size));
- box.limits = (data[1]? 1: 0);
- this.mlist.Add(box);
- }
-
-});
70 public/javascripts/jsMath/extensions/mathchoice.js
View
@@ -1,70 +0,0 @@
-/*
- * extensions/mathchoice.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements the 4-way math choice. It will be loaded
- * automatically when needed, or can be loaded by
- *
- * jsMath.Extension.Require('mathchoice');
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Add(jsMath.mList.prototype.Atomize,{
-
- /*
- * Handle a 4-way choice atom. (Rule 4)
- */
- choice: function (style,mitem,i,mlist) {
- if (style.charAt(style.length-1) == "'") {style = style.slice(0,style.length-1)}
- var nlist = []; var M = mitem[style];
- if (!M) {M = {type: 'mlist', mlist: {mlist: []}}}
- if (M.type == 'mlist') {
- M = M.mlist.mlist;
- for (var k = 0; k < i; k++) {nlist[k] = mlist[k]}
- for (k = 0; k < M.length; k++) {nlist[i+k] = M[k]}
- for (k = i+1; k < mlist.length; k++) {nlist[nlist.length] = mlist[k]}
- return nlist;
- } else {
- mlist[i] = jsMath.mItem.Atom('ord',M);
- return mlist;
- }
- }
-
-});
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {mathchoice: 'MathChoice'},
-
- /*
- * Implements \mathchoice{}{}{}{}
- */
- MathChoice: function (name) {
- var D = this.ProcessArg(this.cmd+name); if (this.error) return;
- var T = this.ProcessArg(this.cmd+name); if (this.error) return;
- var S = this.ProcessArg(this.cmd+name); if (this.error) return;
- var SS = this.ProcessArg(this.cmd+name); if (this.error) return;
- var box = new jsMath.mItem('choice',{D: D, T: T, S: S, SS: SS});
- this.mlist.Add(new jsMath.mItem('choice',{D: D, T: T, S: S, SS: SS}));
- }
-
-});
-
36 public/javascripts/jsMath/extensions/mimeTeX.js
View
@@ -1,36 +0,0 @@
-/*
- * extensions/mimeTeX.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file loads the mimeTeX plugin, and can be called either
- * by
- *
- * jsMath.Extension.Require('mimeTeX');
- *
- * or by using
- *
- * \require{mimeTeX}
- *
- * within a typeset equation.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Setup.Script('plugins/mimeTeX.js');
68 public/javascripts/jsMath/extensions/moreArrows.js
View
@@ -1,68 +0,0 @@
-/*
- * extensions/moreArrows.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements additional arrow macros with under- and
- * overset labels. It can be loaded by
- *
- * jsMath.Extension.Require('moreArrows');
- *
- * or using \require{moreArrows} within a math formula.
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Extension.Require('leaders');
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {
- xrightarrow: ['HandleArrows','rightarrow'],
- xleftarrow: ['HandleArrows','leftarrow'],
- xuprightharpoon: ['HandleArrows','uprightharpoon'],
- xupleftharpoon: ['HandleArrows','upleftharpoon'],
- xdownrightharpoon: ['HandleArrows','downrightharpoon'],
- xdownleftharpoon: ['HandleArrows','downleftharpoon']
- },
-
- leaders: {
- upleftharpoon: {left: [1,0x28], rep: [2,0x00]},
- uprightharpoon: {rep: [2,0x00], right: [1,0x2A]},
- downleftharpoon: {left: [1,0x29], rep: [2,0x00]},
- downrightharpoon: {rep: [2,0x00], right: [1,0x2B]}
- },
-
- HandleArrows: function (name,data) {
- var bot = this.GetBrackets(this.cmd+name); if (this.error) return;
- var top = this.ProcessArg(this.cmd+name); if (this.error) return;
- var box = jsMath.Box.Set(top,'S',this.mlist.data.size).Remeasured();
- var w = box.w;
- if (bot) {
- bot = this.Process(bot); if (this.error) return;
- var box = jsMath.Box.Set(bot,'S',this.mlist.data.size).Remeasured();
- w = Math.max(w,box.w);
- }
- var leader = jsMath.Box.Leaders(w+.75,this.leaders[data[0]]);
- box = jsMath.mItem.Atom('op',jsMath.Box.SetList([leader],'T',this.mlist.data.size));
- box.limits = 1; box.sup = top; box.sub = bot;
- this.mlist.Add(box);
- }
-
-});
205 public/javascripts/jsMath/extensions/newcommand.js
View
@@ -1,205 +0,0 @@
-/*
- * extensions/newcommand.js
- *
- * Part of the jsMath package for mathematics on the web.
- *
- * This file implements the \newcommand and \def macros. It will be
- * loaded automatically when needed, or can be loaded by
- *
- * jsMath.Extension.Require('newcommand');
- *
- * ---------------------------------------------------------------------
- *
- * Copyright 2005-2006 by Davide P. Cervone
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/********************************************************************/
-
-jsMath.Package(jsMath.Parser,{
-
- macros: {
- newcommand: 'NewCommand',
- newenvironment: 'NewEnvironment',
- def: 'MacroDef'
- },
-
- /*
- * Implement \newcommand{\name}[n]{...}
- */
- NewCommand: function (name) {
- var cs = this.trimSpaces(this.GetArgument(this.cmd+name)); if (this.error) return;
- var n = this.trimSpaces(this.GetBrackets(this.cmd+name)); if (this.error) return;
- var def = this.GetArgument(this.cmd+name); if (this.error) return;
- if (n == '') {n = null}
- if (cs.charAt(0) == this.cmd) {cs = cs.substr(1)}
- if (!cs.match(/^(.|[a-z]+)$/i)) {this.Error("Illegal control sequence name for "+this.cmd+name); return}
- if (n != null && !n.match(/^[0-9]+$/)) {this.Error("Illegal number of parameters specified in "+this.cmd+name); return}
- jsMath.Parser.prototype.macros[cs] = ['Macro',def,n];
- },
-
- /*
- * Implement \newenvironment{name}[n]{begincmd}{endcmd}
- */
- NewEnvironment: function (name) {
- var env = this.trimSpaces(this.GetArgument(this.cmd+name)); if (this.error) return;
- var n = this.trimSpaces(this.GetBrackets(this.cmd+name)); if (this.error) return;
- var bdef = this.GetArgument(this.cmd+name); if (this.error) return;
- var edef = this.GetArgument(this.cmd+name); if (this.error) return;
- if (n == '') {n = null}
- if (n != null && !n.match(/^[0-9]+$/)) {this.Error("Illegal number of parameters specified in "+this.cmd+name); return}
- jsMath.Parser.prototype.environments[env] = ['Environment',bdef,edef,n];
- },
-
- /*
- * Implement \def command
- */
- MacroDef: function (name) {
- var cs = this.GetCSname(this.cmd+name); if (this.error) return;
- var params = this.GetTemplate(this.cmd+name); if (this.error) return;
- var def = this.GetArgument(this.cmd+name); if (this.error) return;
- if (typeof(params) == 'number') {
- jsMath.Parser.prototype.macros[cs] = ['Macro',def,params];
- } else {
- jsMath.Parser.prototype.macros[cs] = ['MacroWithTemplate',def,params[0],params[1]];
- }
- },
-
- /*
- * Get a CS name or give an error
- */
- GetCSname: function (cmd) {
- var c = this.GetNext();
- if (c != this.cmd) {this.Error(cmd+" must be followed by a control sequence"); return null}
- var cs = this.trimSpaces(this.GetArgument(cmd)); if (this.error) {return null};
- return cs.substr(1);
- },
-
- /*
- * Get a \def parameter template
- */
- GetTemplate: function (cmd) {
- var c; var params = []; var n = 0;
- c = this.GetNext(); var i = this.i;
- while (this.i < this.string.length) {
- c = this.GetNext();
- if (c == '#') {
- if (i != this.i) {params[n] = this.string.substr(i,this.i-i)}
- c = this.string.charAt(++this.i);
- if (!c.match(/[1-9]/)) {this.Error("Illegal use of # in "+cmd); return null}
- if (1*c != ++n) {this.Error("Parameters must be numbered sequentially"); return null}
- i = this.i+1;
- } else if (c == '{') {
- if (i != this.i) {params[n] = this.string.substr(i,this.i-i)}
- if (params.length > 0) {return [n,params]} else {return n}
- }
- this.i++;
- }
- this.Error("Missing replacement string for definition of "+cmd);
- return null;
- },
-
- /*