cancel.js 1.6 KB

12345678910111213
  1. /*
  2. * /MathJax/extensions/TeX/cancel.js
  3. *
  4. * Copyright (c) 2009-2013 The MathJax Consortium
  5. *
  6. * Part of the MathJax library.
  7. * See http://www.mathjax.org for details.
  8. *
  9. * Licensed under the Apache License, Version 2.0;
  10. * you may not use this file except in compliance with the License.
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. */MathJax.Extension["TeX/cancel"]={version:"2.2",ALLOWED:{arrow:1,color:1,mathcolor:1,background:1,mathbackground:1,padding:1,thickness:1}};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var h=MathJax.InputJax.TeX,a=MathJax.ElementJax.mml,g=MathJax.Extension["TeX/cancel"];g.setAttributes=function(a,d){if(""!==d){d=d.replace(/ /g,"").split(/,/);for(var b=0,e=d.length;b<e;b++){var c=d[b].split(/[:=]/);g.ALLOWED[c[0]]&&("true"===c[1]&&(c[1]=!0),"false"===c[1]&&(c[1]=!1),a[c[0]]=c[1])}}return a};h.Definitions.Add({macros:{cancel:["Cancel",a.NOTATION.UPDIAGONALSTRIKE],bcancel:["Cancel",a.NOTATION.DOWNDIAGONALSTRIKE],xcancel:["Cancel",a.NOTATION.UPDIAGONALSTRIKE+" "+a.NOTATION.DOWNDIAGONALSTRIKE],cancelto:"CancelTo"}},null,!0);h.Parse.Augment({Cancel:function(f,d){var b=this.GetBrackets(f,""),e=this.ParseArg(f),b=g.setAttributes({notation:d},b);this.Push(a.menclose(e).With(b))},CancelTo:function(f,d){var b=this.ParseArg(f),e=this.GetBrackets(f,""),c=this.ParseArg(f),e=g.setAttributes({notation:a.NOTATION.UPDIAGONALSTRIKE,arrow:!0},e),b=a.mpadded(b).With({depth:"-.1em",height:"+.1em",voffset:".1em"});this.Push(a.msup(a.menclose(c).With(e),b))}});MathJax.Hub.Startup.signal.Post("TeX cancel Ready")});MathJax.Ajax.loadComplete("[MathJax]/extensions/TeX/cancel.js");