home *** CD-ROM | disk | FTP | other *** search
/ PC World 2002 September / PCWorld_2002-09_cd.bin / Komunik / amaya / 9x / amaya-Win98-6.2.exe / _SETUP.1 / MathML.trans < prev    next >
Encoding:
Text File  |  2000-06-02  |  6.0 KB  |  352 lines

  1. i! file MathML.trans : structure transformation for MathML
  2. ! see HTML.trans for a description of Trans language
  3. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4.  
  5. ! WARNING : transformations do NOT work with Multiscript elements
  6. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  7.  
  8. !!! mrow transformations
  9.  
  10. !surround an element with a mrow
  11. surrounding row: *;
  12.         {
  13.         * > mrow:*;
  14.         }
  15.  
  16. !surround a sequence of elements with a mrow
  17. surrounding row: *,*+;
  18.         {
  19.         * > mrow:*;
  20.         }
  21.  
  22. ! remove a mrow level
  23. remove row: mrow{*+};
  24.         {
  25.         * > :*;
  26.         }
  27.  
  28. !!! mstyle transformations
  29.  
  30. !surround an element with a mstyle
  31. surrounding mstyle: *;
  32.         {
  33.         * > mstyle:*;
  34.         }
  35.  
  36. !surround a sequence of elements with a mstyle
  37. surrounding mstyle: *,*+;
  38.         {
  39.         * > mstyle:*;
  40.         }
  41.  
  42. ! remove a mstyle level
  43. remove mstyle: mstyle{*+};
  44.         {
  45.         * > :*;
  46.         }
  47.  
  48. !!! Root Transformations
  49.  
  50. !surround an element with a root
  51. surrounding root : *;
  52.     {
  53.     * > mroot:*;
  54.     * > mroot:none % ;
  55.     }
  56.  
  57. !surround a sequence of elements with a root
  58. surrounding root: *+,last:*;
  59.         {
  60.         * > mroot.mrow:*;
  61.     last > mroot.mrow:*;
  62.     last > mroot:none % ;
  63.         }
  64.  
  65. !remove a root
  66. remove root: mroot{base:*,? index:*};
  67.         {
  68.         base > :*;
  69.     index / ;
  70.         }
  71.  
  72.  
  73. !!! Square Root Transformations
  74.  
  75. !surround an element with a square root
  76. surrounding square root: *;
  77.         {
  78.         * > msqrt:*;
  79.         }
  80.  
  81.  
  82. !surround a sequence of elements with a square root
  83. surrounding square root: *,*+;
  84.         {
  85.         * > msqrt.mrow:*;
  86.         }
  87.  
  88. !remove a square root
  89. remove square root: msqrt{*};
  90.         {
  91.         * > :*;
  92.         }
  93.  
  94. !transform a square root into a root
  95. root with index: msqrt{*};
  96.     {
  97.     * > mroot:*;
  98.     * > mroot:none %;
  99.     }
  100.  
  101. !transform a square root into a menclose
  102. menclose: msqrt{*};
  103.     {
  104.     * > menclose:*;
  105.     }
  106.  
  107. !!! menclose Transformations
  108.  
  109. !surround an element with a menclose
  110. surrounding menclose: *;
  111.         {
  112.         * > menclose:*;
  113.         }
  114.  
  115.  
  116. !surround a sequence of elements with a menclose
  117. surrounding menclose: *,*+;
  118.         {
  119.         * > menclose:*;
  120.         }
  121.  
  122. !remove a menclose
  123. remove menclose: menclose{*};
  124.         {
  125.         * > :*;
  126.         }
  127.  
  128. !transform a menclose into a square root
  129. square root: menclose{*};
  130.     {
  131.     * > msqrt:*;
  132.     }
  133.  
  134. !!! Fraction transformations
  135.  
  136. !transform 2 elements into a fraction
  137. fraction: (num:*,den:*) | mrow{num:*,den:*};
  138.         {
  139.         num > mfrac:*;
  140.         den > mfrac:*;
  141.         }
  142.  
  143. !transform an  element into a numerator
  144. numerator: *;
  145.         {
  146.         * > mfrac:*;
  147.         * > mfrac:none %;
  148.         }
  149.  
  150. !transform an sequence of elements into a numerator
  151. numerator: ?*+,last:*;
  152.         {
  153.         * > mfrac.mrow:*;
  154.     last > mfrac.mrow:*;
  155.         last > mfrac:none %;
  156.         }
  157.  
  158. !transform an element into a denominator
  159. denominator: *;
  160.         {
  161.         * > mfrac:none %;
  162.         * > mfrac:*;
  163.         }
  164.  
  165. !transform an sequence of elements into a denominator
  166. denominator: first:*,?*+;
  167.         {
  168.         first > mfrac:none %;
  169.     first > mfrac.mrow:*;
  170.         * > mfrac.mrow:*;
  171.         }
  172.  
  173. !remove a fraction
  174. remove fraction: mfrac{?(num:*),?(den:*)};
  175.         {
  176.         num > :*;
  177.         den > :*;
  178.         }
  179.  
  180.  
  181. !!! Sub and Sup Transformations
  182.  
  183. !surroud an element with a subsup
  184. add sub and sup:*;
  185.     {
  186.     * > msubsup:*;
  187.     * > msubsup:none%;
  188.     * > msubsup:none;
  189.     }
  190.  
  191. !removes a subsup
  192. remove subsup: msubsup{base:*,?sub:*,?sup:*};
  193.     {
  194.     base > :*;
  195.     sub /;
  196.     sup /;
  197.     }
  198.  
  199. !removes a superscript
  200. remove superscript: msubsup{base:*,?sub:*,?sup:*};
  201.     {
  202.     msubsup > msub;
  203.     sup /;
  204.     }
  205.  
  206. !removes a subscript
  207. remove subscript: msubsup{base:*,?sub:*,?sup:*};
  208.     {
  209.     msubsup > msup;
  210.     sub /;
  211.     }
  212.  
  213. !surroud element with a sub
  214. add subscript:*;
  215.     {
  216.     * > msub:*;
  217.     * > msub:none %;
  218.     }
  219.  
  220. !removes a subscript
  221. remove subscript: msub{base:*,?sub:*};
  222.     {
  223.     base > :*;
  224.     sub /;
  225.     }
  226.  
  227. !surroud an element with a sup
  228. add superscript:*;
  229.     {
  230.     * > msup:*;
  231.     * > msup:none %;
  232.     }
  233.  
  234. !removes a superscript
  235. remove superscript: msup{base:*,?sup:*};
  236.     {
  237.     base > :*;
  238.     sup /;
  239.     }
  240.  
  241. !change msub into msup
  242. superscript:msub;
  243.     {
  244.     msub > msup;
  245.     }
  246.  
  247. !change msup into msub
  248. subscript:msup;
  249.     {
  250.     msup > msub;
  251.     }
  252.  
  253. !change msub or msup into msubsup
  254. subsup:msub{base:*,sub:*} | msup{base:*,sup:*};
  255.     {
  256.     base > msubsup:*;
  257.     sup > msubsup:none %;
  258.     sup > msubsup:*;
  259.     sub > msubsup:*;
  260.     sub > msubsup:none;
  261.     }
  262.  
  263. !change msubsup into munderover
  264. change into munderover: msubsup{base:*,sub:*,sup:*};
  265.   {
  266.   base > munderover:*;
  267.   sub > munderover:*;
  268.   sup > munderover:*;
  269.   }
  270.  
  271. !!! Under and Over transformations
  272.  
  273. !surroud an element with a underover
  274. add under and over:*;
  275.     {
  276.     * > munderover:*;
  277.     * > munderover:none %;
  278.     * > munderover:none;
  279.     }
  280.  
  281. ! remove an underover
  282. remove under and over:munderover{base:*,?under:*,?over:*};
  283.     {
  284.     base > :*;
  285.     under /;
  286.     over /;
  287.     }
  288.  
  289. !surroud an element with a over
  290. add over:*;
  291.     {
  292.     * > mover:*;
  293.     * > mover:none %;
  294.     }
  295.  
  296. ! remove an over
  297. remove under and over:mover{base:*,?over:*};
  298.     {
  299.     base > :*;
  300.     over /;
  301.     }
  302.  
  303. !surroud an element with a under
  304. add under:*;
  305.     {
  306.     * > munder:*;
  307.     * > munder:none;
  308.     }
  309.  
  310. ! remove an under
  311. remove under:munder{base:*,?under:*};
  312.     {
  313.     base > :*;
  314.     under /;
  315.     }
  316.  
  317. !change munderover into msubsup
  318. change into msubsup: munderover{base:*,under:*,over:*};
  319.   {
  320.   base > msubsup:*;
  321.   under > msubsup:*;
  322.   over > msubsup:*;
  323.   }
  324.  
  325. !!! Parenthesis Transformations
  326.  
  327. !surround an element with parentheses
  328. parenthesize:*;
  329.         {
  330.         * > mrow:mo."(";
  331.         * > mrow:*;
  332.         * > mrow:mo.")";
  333.         }
  334.  
  335. !surround a sequence of elements with parentheses
  336. !group: first:*,?*+, last:* ;
  337. !        {
  338. !        first > mrow:mo."(";
  339. !        first > mrow:*;
  340. !        * > mrow:*;
  341. !        last > mrow:*;
  342. !        last > mrow:mo.")";
  343. !        }
  344.  
  345. !remove parenthesis
  346. remove parenthesis: mrow{mf,?*+,mf};
  347.     {
  348.     mf /;
  349.     * > :*;
  350.     }
  351.  
  352.