/* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */ /* vim: set ts=2 et sw=2 tw=80: */ /************************************************************* * * MathJax/extensions/TeX/begingroup.js * * Implements \begingroup and \endgroup commands that make local * definitions possible and are removed when the \endgroup occurs. * * --------------------------------------------------------------------- * * 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/begingroup"]={version:"2.2"};MathJax.Hub.Register.StartupHook("TeX Jax Ready",function(){var b=MathJax.InputJax.TeX,e=b.Definitions,d=MathJax.Object.Subclass({macros:null,environments:null,Init:function(a,c){this.macros=a||{};this.environments=c||{}},Find:function(a,c){if(this[c][a])return this[c][a]},Def:function(a,c,b){this[b][a]=c},Undef:function(a,c){delete this[c][a]},Merge:function(a){MathJax.Hub.Insert(this.macros,a.macros);MathJax.Hub.Insert(this.environments,a.environments)},MergeGlobals:function(a){var c=this.macros,b;for(b in c)c.hasOwnProperty(b)&&c[b].global&&(a.Def(b,c[b],"macros",!0),delete c[b].global,delete c[b])},Clear:function(a){this.environments={};if(a)this.macros={};else{a=this.macros;for(var b in a)a.hasOwnProperty(b)&&!a[b].global&&delete a[b]}return this}}),g=b.nsStack=MathJax.Object.Subclass({stack:null,top:0,isEqn:!1,Init:function(a){this.isEqn=a;this.stack=[];a?this.Push(d()):this.Push(d(e.macros,e.environment))},Def:function(a,b,f,e){var d=this.top-1;if(e){for(;0