1234567891011121314151617181920212223242526272829303132 |
- /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
- /* vim: set ts=2 et sw=2 tw=80: */
- /*************************************************************
- *
- * MathJax/extensions/TeX/cancel.js
- *
- * Implements the \cancel, \bcancel, \xcancel, and \cancelto macros.
- *
- * Usage:
- *
- * \cancel{math} % strikeout math from lower left to upper right
- * \bcancel{math} % strikeout from upper left to lower right
- * \xcancel{math} % strikeout with an X
- * \cancelto{value}{math} % strikeout with arrow going to value
- *
- * ---------------------------------------------------------------------
- *
- * Copyright (c) 2011-2013 The MathJax Consortium
- *
- * 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.
- */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");
|