UpgreekConfiguration.ts 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /*************************************************************
  2. *
  3. * Copyright (c) 2021-2022 The MathJax Consortium
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /**
  18. * @fileoverview Configuration file for the upgreek package.
  19. *
  20. * @author v.sorge@mathjax.org (Volker Sorge)
  21. */
  22. import {Configuration} from '../Configuration.js';
  23. import {Symbol} from '../Symbol.js';
  24. import {CharacterMap} from '../SymbolMap.js';
  25. import {TexConstant} from '../TexConstants.js';
  26. import TexParser from '../TexParser.js';
  27. /**
  28. * Handle greek mathchar as mi in normal variant.
  29. * @param {TexParser} parser The current tex parser.
  30. * @param {Symbol} mchar The parsed symbol.
  31. */
  32. function mathchar0miNormal(parser: TexParser, mchar: Symbol) {
  33. const def = mchar.attributes || {};
  34. def.mathvariant = TexConstant.Variant.NORMAL;
  35. const node = parser.create('token', 'mi', def, mchar.char);
  36. parser.Push(node);
  37. }
  38. /**
  39. * Upright Greek characters.
  40. */
  41. new CharacterMap('upgreek', mathchar0miNormal, {
  42. upalpha: '\u03B1',
  43. upbeta: '\u03B2',
  44. upgamma: '\u03B3',
  45. updelta: '\u03B4',
  46. upepsilon: '\u03F5',
  47. upzeta: '\u03B6',
  48. upeta: '\u03B7',
  49. uptheta: '\u03B8',
  50. upiota: '\u03B9',
  51. upkappa: '\u03BA',
  52. uplambda: '\u03BB',
  53. upmu: '\u03BC',
  54. upnu: '\u03BD',
  55. upxi: '\u03BE',
  56. upomicron: '\u03BF',
  57. uppi: '\u03C0',
  58. uprho: '\u03C1',
  59. upsigma: '\u03C3',
  60. uptau: '\u03C4',
  61. upupsilon: '\u03C5',
  62. upphi: '\u03D5',
  63. upchi: '\u03C7',
  64. uppsi: '\u03C8',
  65. upomega: '\u03C9',
  66. upvarepsilon: '\u03B5',
  67. upvartheta: '\u03D1',
  68. upvarpi: '\u03D6',
  69. upvarrho: '\u03F1',
  70. upvarsigma: '\u03C2',
  71. upvarphi: '\u03C6',
  72. Upgamma: '\u0393',
  73. Updelta: '\u0394',
  74. Uptheta: '\u0398',
  75. Uplambda: '\u039B',
  76. Upxi: '\u039E',
  77. Uppi: '\u03A0',
  78. Upsigma: '\u03A3',
  79. Upupsilon: '\u03A5',
  80. Upphi: '\u03A6',
  81. Uppsi: '\u03A8',
  82. Upomega: '\u03A9'
  83. });
  84. export const UpgreekConfiguration = Configuration.create(
  85. 'upgreek', {
  86. handler: {macro: ['upgreek']},
  87. }
  88. );