added jsMath files
[lambda.git] / jsMath / extensions / underset-overset.js
1 /*
2  *  extensions/underset-overset.js
3  *  
4  *  Part of the jsMath package for mathematics on the web.
5  *
6  *  This file implements \underset and \overset macros.  It will be loaded
7  *  automatically when needed, or can be loaded by
8  *  
9  *    jsMath.Extension.Require('underset-overset');
10  *  
11  *  ---------------------------------------------------------------------
12  *
13  *  Copyright 200-20065 by Davide P. Cervone
14  * 
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
18  * 
19  *      http://www.apache.org/licenses/LICENSE-2.0
20  * 
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.
26  */
27
28 /********************************************************************/
29
30 jsMath.Package(jsMath.Parser,{
31
32   macros: {
33     overset:  'Overset',
34     underset: 'Underset'
35   },
36   
37   Overset: function (name) {
38     var top = this.ProcessArg(this.cmd+name); if (this.error) return;
39     var bot = this.ProcessArg(this.cmd+name); if (this.error) return;
40     var op = jsMath.mItem.Atom('op',bot);
41     op.limits = 1; op.sup = top;
42     this.mlist.Add(op);
43   },
44
45   Underset: function (name) {
46     var bot = this.ProcessArg(this.cmd+name); if (this.error) return;
47     var top = this.ProcessArg(this.cmd+name); if (this.error) return;
48     var op = jsMath.mItem.Atom('op',top);
49     op.limits = 1; op.sub = bot;
50     this.mlist.Add(op);
51   }
52
53 });