BraketMappings.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*************************************************************
  2. *
  3. * Copyright (c) 2018-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 Mappings for TeX parsing of the braket package.
  19. *
  20. * @author v.sorge@mathjax.org (Volker Sorge)
  21. */
  22. import {CommandMap, MacroMap} from '../SymbolMap.js';
  23. import BraketMethods from './BraketMethods.js';
  24. /**
  25. * Macros for braket package.
  26. */
  27. new CommandMap('Braket-macros', {
  28. bra: ['Macro', '{\\langle {#1} \\vert}', 1],
  29. ket: ['Macro', '{\\vert {#1} \\rangle}', 1],
  30. braket: ['Braket', '\u27E8', '\u27E9', false, Infinity],
  31. 'set': ['Braket', '{', '}', false, 1],
  32. Bra: ['Macro', '{\\left\\langle {#1} \\right\\vert}', 1],
  33. Ket: ['Macro', '{\\left\\vert {#1} \\right\\rangle}', 1],
  34. Braket: ['Braket', '\u27E8', '\u27E9', true, Infinity],
  35. Set: ['Braket', '{', '}', true, 1],
  36. // Not part of the LaTeX package:
  37. ketbra: ['Macro', '{\\vert {#1} \\rangle\\langle {#2} \\vert}', 2],
  38. Ketbra: ['Macro', '{\\left\\vert {#1} \\right\\rangle\\left\\langle {#2} \\right\\vert}', 2],
  39. // Treatment of bar.
  40. '|': 'Bar'
  41. }, BraketMethods);
  42. /**
  43. * Character map for braket package.
  44. */
  45. new MacroMap('Braket-characters', {
  46. '|': 'Bar'
  47. }, BraketMethods);