symbols.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895
  1. // @flow
  2. /**
  3. * This file holds a list of all no-argument functions and single-character
  4. * symbols (like 'a' or ';').
  5. *
  6. * For each of the symbols, there are three properties they can have:
  7. * - font (required): the font to be used for this symbol. Either "main" (the
  8. normal font), or "ams" (the ams fonts).
  9. * - group (required): the ParseNode group type the symbol should have (i.e.
  10. "textord", "mathord", etc).
  11. See https://github.com/KaTeX/KaTeX/wiki/Examining-TeX#group-types
  12. * - replace: the character that this symbol or function should be
  13. * replaced with (i.e. "\phi" has a replace value of "\u03d5", the phi
  14. * character in the main font).
  15. *
  16. * The outermost map in the table indicates what mode the symbols should be
  17. * accepted in (e.g. "math" or "text").
  18. */
  19. import type {Mode} from "./types";
  20. type Font = "main" | "ams";
  21. // Some of these have a "-token" suffix since these are also used as `ParseNode`
  22. // types for raw text tokens, and we want to avoid conflicts with higher-level
  23. // `ParseNode` types. These `ParseNode`s are constructed within `Parser` by
  24. // looking up the `symbols` map.
  25. export const ATOMS = {
  26. "bin": 1,
  27. "close": 1,
  28. "inner": 1,
  29. "open": 1,
  30. "punct": 1,
  31. "rel": 1,
  32. };
  33. export const NON_ATOMS = {
  34. "accent-token": 1,
  35. "mathord": 1,
  36. "op-token": 1,
  37. "spacing": 1,
  38. "textord": 1,
  39. };
  40. export type Atom = $Keys<typeof ATOMS>;
  41. export type NonAtom = $Keys<typeof NON_ATOMS>
  42. export type Group = Atom | NonAtom;
  43. type CharInfoMap = {[string]: {font: Font, group: Group, replace: ?string}};
  44. const symbols: {[Mode]: CharInfoMap} = {
  45. "math": {},
  46. "text": {},
  47. };
  48. export default symbols;
  49. /** `acceptUnicodeChar = true` is only applicable if `replace` is set. */
  50. export function defineSymbol(
  51. mode: Mode,
  52. font: Font,
  53. group: Group,
  54. replace: ?string,
  55. name: string,
  56. acceptUnicodeChar?: boolean,
  57. ) {
  58. symbols[mode][name] = {font, group, replace};
  59. if (acceptUnicodeChar && replace) {
  60. symbols[mode][replace] = symbols[mode][name];
  61. }
  62. }
  63. // Some abbreviations for commonly used strings.
  64. // This helps minify the code, and also spotting typos using jshint.
  65. // modes:
  66. const math = "math";
  67. const text = "text";
  68. // fonts:
  69. const main = "main";
  70. const ams = "ams";
  71. // groups:
  72. const accent = "accent-token";
  73. const bin = "bin";
  74. const close = "close";
  75. const inner = "inner";
  76. const mathord = "mathord";
  77. const op = "op-token";
  78. const open = "open";
  79. const punct = "punct";
  80. const rel = "rel";
  81. const spacing = "spacing";
  82. const textord = "textord";
  83. // Now comes the symbol table
  84. // Relation Symbols
  85. defineSymbol(math, main, rel, "\u2261", "\\equiv", true);
  86. defineSymbol(math, main, rel, "\u227a", "\\prec", true);
  87. defineSymbol(math, main, rel, "\u227b", "\\succ", true);
  88. defineSymbol(math, main, rel, "\u223c", "\\sim", true);
  89. defineSymbol(math, main, rel, "\u22a5", "\\perp");
  90. defineSymbol(math, main, rel, "\u2aaf", "\\preceq", true);
  91. defineSymbol(math, main, rel, "\u2ab0", "\\succeq", true);
  92. defineSymbol(math, main, rel, "\u2243", "\\simeq", true);
  93. defineSymbol(math, main, rel, "\u2223", "\\mid", true);
  94. defineSymbol(math, main, rel, "\u226a", "\\ll", true);
  95. defineSymbol(math, main, rel, "\u226b", "\\gg", true);
  96. defineSymbol(math, main, rel, "\u224d", "\\asymp", true);
  97. defineSymbol(math, main, rel, "\u2225", "\\parallel");
  98. defineSymbol(math, main, rel, "\u22c8", "\\bowtie", true);
  99. defineSymbol(math, main, rel, "\u2323", "\\smile", true);
  100. defineSymbol(math, main, rel, "\u2291", "\\sqsubseteq", true);
  101. defineSymbol(math, main, rel, "\u2292", "\\sqsupseteq", true);
  102. defineSymbol(math, main, rel, "\u2250", "\\doteq", true);
  103. defineSymbol(math, main, rel, "\u2322", "\\frown", true);
  104. defineSymbol(math, main, rel, "\u220b", "\\ni", true);
  105. defineSymbol(math, main, rel, "\u221d", "\\propto", true);
  106. defineSymbol(math, main, rel, "\u22a2", "\\vdash", true);
  107. defineSymbol(math, main, rel, "\u22a3", "\\dashv", true);
  108. defineSymbol(math, main, rel, "\u220b", "\\owns");
  109. // Punctuation
  110. defineSymbol(math, main, punct, "\u002e", "\\ldotp");
  111. defineSymbol(math, main, punct, "\u22c5", "\\cdotp");
  112. // Misc Symbols
  113. defineSymbol(math, main, textord, "\u0023", "\\#");
  114. defineSymbol(text, main, textord, "\u0023", "\\#");
  115. defineSymbol(math, main, textord, "\u0026", "\\&");
  116. defineSymbol(text, main, textord, "\u0026", "\\&");
  117. defineSymbol(math, main, textord, "\u2135", "\\aleph", true);
  118. defineSymbol(math, main, textord, "\u2200", "\\forall", true);
  119. defineSymbol(math, main, textord, "\u210f", "\\hbar", true);
  120. defineSymbol(math, main, textord, "\u2203", "\\exists", true);
  121. defineSymbol(math, main, textord, "\u2207", "\\nabla", true);
  122. defineSymbol(math, main, textord, "\u266d", "\\flat", true);
  123. defineSymbol(math, main, textord, "\u2113", "\\ell", true);
  124. defineSymbol(math, main, textord, "\u266e", "\\natural", true);
  125. defineSymbol(math, main, textord, "\u2663", "\\clubsuit", true);
  126. defineSymbol(math, main, textord, "\u2118", "\\wp", true);
  127. defineSymbol(math, main, textord, "\u266f", "\\sharp", true);
  128. defineSymbol(math, main, textord, "\u2662", "\\diamondsuit", true);
  129. defineSymbol(math, main, textord, "\u211c", "\\Re", true);
  130. defineSymbol(math, main, textord, "\u2661", "\\heartsuit", true);
  131. defineSymbol(math, main, textord, "\u2111", "\\Im", true);
  132. defineSymbol(math, main, textord, "\u2660", "\\spadesuit", true);
  133. defineSymbol(text, main, textord, "\u00a7", "\\S", true);
  134. defineSymbol(text, main, textord, "\u00b6", "\\P", true);
  135. // Math and Text
  136. defineSymbol(math, main, textord, "\u2020", "\\dag");
  137. defineSymbol(text, main, textord, "\u2020", "\\dag");
  138. defineSymbol(text, main, textord, "\u2020", "\\textdagger");
  139. defineSymbol(math, main, textord, "\u2021", "\\ddag");
  140. defineSymbol(text, main, textord, "\u2021", "\\ddag");
  141. defineSymbol(text, main, textord, "\u2021", "\\textdaggerdbl");
  142. // Large Delimiters
  143. defineSymbol(math, main, close, "\u23b1", "\\rmoustache", true);
  144. defineSymbol(math, main, open, "\u23b0", "\\lmoustache", true);
  145. defineSymbol(math, main, close, "\u27ef", "\\rgroup", true);
  146. defineSymbol(math, main, open, "\u27ee", "\\lgroup", true);
  147. // Binary Operators
  148. defineSymbol(math, main, bin, "\u2213", "\\mp", true);
  149. defineSymbol(math, main, bin, "\u2296", "\\ominus", true);
  150. defineSymbol(math, main, bin, "\u228e", "\\uplus", true);
  151. defineSymbol(math, main, bin, "\u2293", "\\sqcap", true);
  152. defineSymbol(math, main, bin, "\u2217", "\\ast");
  153. defineSymbol(math, main, bin, "\u2294", "\\sqcup", true);
  154. defineSymbol(math, main, bin, "\u25ef", "\\bigcirc");
  155. defineSymbol(math, main, bin, "\u2219", "\\bullet");
  156. defineSymbol(math, main, bin, "\u2021", "\\ddagger");
  157. defineSymbol(math, main, bin, "\u2240", "\\wr", true);
  158. defineSymbol(math, main, bin, "\u2a3f", "\\amalg");
  159. defineSymbol(math, main, bin, "\u0026", "\\And"); // from amsmath
  160. // Arrow Symbols
  161. defineSymbol(math, main, rel, "\u27f5", "\\longleftarrow", true);
  162. defineSymbol(math, main, rel, "\u21d0", "\\Leftarrow", true);
  163. defineSymbol(math, main, rel, "\u27f8", "\\Longleftarrow", true);
  164. defineSymbol(math, main, rel, "\u27f6", "\\longrightarrow", true);
  165. defineSymbol(math, main, rel, "\u21d2", "\\Rightarrow", true);
  166. defineSymbol(math, main, rel, "\u27f9", "\\Longrightarrow", true);
  167. defineSymbol(math, main, rel, "\u2194", "\\leftrightarrow", true);
  168. defineSymbol(math, main, rel, "\u27f7", "\\longleftrightarrow", true);
  169. defineSymbol(math, main, rel, "\u21d4", "\\Leftrightarrow", true);
  170. defineSymbol(math, main, rel, "\u27fa", "\\Longleftrightarrow", true);
  171. defineSymbol(math, main, rel, "\u21a6", "\\mapsto", true);
  172. defineSymbol(math, main, rel, "\u27fc", "\\longmapsto", true);
  173. defineSymbol(math, main, rel, "\u2197", "\\nearrow", true);
  174. defineSymbol(math, main, rel, "\u21a9", "\\hookleftarrow", true);
  175. defineSymbol(math, main, rel, "\u21aa", "\\hookrightarrow", true);
  176. defineSymbol(math, main, rel, "\u2198", "\\searrow", true);
  177. defineSymbol(math, main, rel, "\u21bc", "\\leftharpoonup", true);
  178. defineSymbol(math, main, rel, "\u21c0", "\\rightharpoonup", true);
  179. defineSymbol(math, main, rel, "\u2199", "\\swarrow", true);
  180. defineSymbol(math, main, rel, "\u21bd", "\\leftharpoondown", true);
  181. defineSymbol(math, main, rel, "\u21c1", "\\rightharpoondown", true);
  182. defineSymbol(math, main, rel, "\u2196", "\\nwarrow", true);
  183. defineSymbol(math, main, rel, "\u21cc", "\\rightleftharpoons", true);
  184. // AMS Negated Binary Relations
  185. defineSymbol(math, ams, rel, "\u226e", "\\nless", true);
  186. defineSymbol(math, ams, rel, "\ue010", "\\nleqslant");
  187. defineSymbol(math, ams, rel, "\ue011", "\\nleqq");
  188. defineSymbol(math, ams, rel, "\u2a87", "\\lneq", true);
  189. defineSymbol(math, ams, rel, "\u2268", "\\lneqq", true);
  190. defineSymbol(math, ams, rel, "\ue00c", "\\lvertneqq");
  191. defineSymbol(math, ams, rel, "\u22e6", "\\lnsim", true);
  192. defineSymbol(math, ams, rel, "\u2a89", "\\lnapprox", true);
  193. defineSymbol(math, ams, rel, "\u2280", "\\nprec", true);
  194. // unicode-math maps \u22e0 to \npreccurlyeq. We'll use the AMS synonym.
  195. defineSymbol(math, ams, rel, "\u22e0", "\\npreceq", true);
  196. defineSymbol(math, ams, rel, "\u22e8", "\\precnsim", true);
  197. defineSymbol(math, ams, rel, "\u2ab9", "\\precnapprox", true);
  198. defineSymbol(math, ams, rel, "\u2241", "\\nsim", true);
  199. defineSymbol(math, ams, rel, "\ue006", "\\nshortmid");
  200. defineSymbol(math, ams, rel, "\u2224", "\\nmid", true);
  201. defineSymbol(math, ams, rel, "\u22ac", "\\nvdash", true);
  202. defineSymbol(math, ams, rel, "\u22ad", "\\nvDash", true);
  203. defineSymbol(math, ams, rel, "\u22ea", "\\ntriangleleft");
  204. defineSymbol(math, ams, rel, "\u22ec", "\\ntrianglelefteq", true);
  205. defineSymbol(math, ams, rel, "\u228a", "\\subsetneq", true);
  206. defineSymbol(math, ams, rel, "\ue01a", "\\varsubsetneq");
  207. defineSymbol(math, ams, rel, "\u2acb", "\\subsetneqq", true);
  208. defineSymbol(math, ams, rel, "\ue017", "\\varsubsetneqq");
  209. defineSymbol(math, ams, rel, "\u226f", "\\ngtr", true);
  210. defineSymbol(math, ams, rel, "\ue00f", "\\ngeqslant");
  211. defineSymbol(math, ams, rel, "\ue00e", "\\ngeqq");
  212. defineSymbol(math, ams, rel, "\u2a88", "\\gneq", true);
  213. defineSymbol(math, ams, rel, "\u2269", "\\gneqq", true);
  214. defineSymbol(math, ams, rel, "\ue00d", "\\gvertneqq");
  215. defineSymbol(math, ams, rel, "\u22e7", "\\gnsim", true);
  216. defineSymbol(math, ams, rel, "\u2a8a", "\\gnapprox", true);
  217. defineSymbol(math, ams, rel, "\u2281", "\\nsucc", true);
  218. // unicode-math maps \u22e1 to \nsucccurlyeq. We'll use the AMS synonym.
  219. defineSymbol(math, ams, rel, "\u22e1", "\\nsucceq", true);
  220. defineSymbol(math, ams, rel, "\u22e9", "\\succnsim", true);
  221. defineSymbol(math, ams, rel, "\u2aba", "\\succnapprox", true);
  222. // unicode-math maps \u2246 to \simneqq. We'll use the AMS synonym.
  223. defineSymbol(math, ams, rel, "\u2246", "\\ncong", true);
  224. defineSymbol(math, ams, rel, "\ue007", "\\nshortparallel");
  225. defineSymbol(math, ams, rel, "\u2226", "\\nparallel", true);
  226. defineSymbol(math, ams, rel, "\u22af", "\\nVDash", true);
  227. defineSymbol(math, ams, rel, "\u22eb", "\\ntriangleright");
  228. defineSymbol(math, ams, rel, "\u22ed", "\\ntrianglerighteq", true);
  229. defineSymbol(math, ams, rel, "\ue018", "\\nsupseteqq");
  230. defineSymbol(math, ams, rel, "\u228b", "\\supsetneq", true);
  231. defineSymbol(math, ams, rel, "\ue01b", "\\varsupsetneq");
  232. defineSymbol(math, ams, rel, "\u2acc", "\\supsetneqq", true);
  233. defineSymbol(math, ams, rel, "\ue019", "\\varsupsetneqq");
  234. defineSymbol(math, ams, rel, "\u22ae", "\\nVdash", true);
  235. defineSymbol(math, ams, rel, "\u2ab5", "\\precneqq", true);
  236. defineSymbol(math, ams, rel, "\u2ab6", "\\succneqq", true);
  237. defineSymbol(math, ams, rel, "\ue016", "\\nsubseteqq");
  238. defineSymbol(math, ams, bin, "\u22b4", "\\unlhd");
  239. defineSymbol(math, ams, bin, "\u22b5", "\\unrhd");
  240. // AMS Negated Arrows
  241. defineSymbol(math, ams, rel, "\u219a", "\\nleftarrow", true);
  242. defineSymbol(math, ams, rel, "\u219b", "\\nrightarrow", true);
  243. defineSymbol(math, ams, rel, "\u21cd", "\\nLeftarrow", true);
  244. defineSymbol(math, ams, rel, "\u21cf", "\\nRightarrow", true);
  245. defineSymbol(math, ams, rel, "\u21ae", "\\nleftrightarrow", true);
  246. defineSymbol(math, ams, rel, "\u21ce", "\\nLeftrightarrow", true);
  247. // AMS Misc
  248. defineSymbol(math, ams, rel, "\u25b3", "\\vartriangle");
  249. defineSymbol(math, ams, textord, "\u210f", "\\hslash");
  250. defineSymbol(math, ams, textord, "\u25bd", "\\triangledown");
  251. defineSymbol(math, ams, textord, "\u25ca", "\\lozenge");
  252. defineSymbol(math, ams, textord, "\u24c8", "\\circledS");
  253. defineSymbol(math, ams, textord, "\u00ae", "\\circledR");
  254. defineSymbol(text, ams, textord, "\u00ae", "\\circledR");
  255. defineSymbol(math, ams, textord, "\u2221", "\\measuredangle", true);
  256. defineSymbol(math, ams, textord, "\u2204", "\\nexists");
  257. defineSymbol(math, ams, textord, "\u2127", "\\mho");
  258. defineSymbol(math, ams, textord, "\u2132", "\\Finv", true);
  259. defineSymbol(math, ams, textord, "\u2141", "\\Game", true);
  260. defineSymbol(math, ams, textord, "\u006b", "\\Bbbk");
  261. defineSymbol(math, ams, textord, "\u2035", "\\backprime");
  262. defineSymbol(math, ams, textord, "\u25b2", "\\blacktriangle");
  263. defineSymbol(math, ams, textord, "\u25bc", "\\blacktriangledown");
  264. defineSymbol(math, ams, textord, "\u25a0", "\\blacksquare");
  265. defineSymbol(math, ams, textord, "\u29eb", "\\blacklozenge");
  266. defineSymbol(math, ams, textord, "\u2605", "\\bigstar");
  267. defineSymbol(math, ams, textord, "\u2222", "\\sphericalangle", true);
  268. defineSymbol(math, ams, textord, "\u2201", "\\complement", true);
  269. // unicode-math maps U+F0 (ð) to \matheth. We map to AMS function \eth
  270. defineSymbol(math, ams, textord, "\u00f0", "\\eth", true);
  271. defineSymbol(math, ams, textord, "\u2571", "\\diagup");
  272. defineSymbol(math, ams, textord, "\u2572", "\\diagdown");
  273. defineSymbol(math, ams, textord, "\u25a1", "\\square");
  274. defineSymbol(math, ams, textord, "\u25a1", "\\Box");
  275. defineSymbol(math, ams, textord, "\u25ca", "\\Diamond");
  276. // unicode-math maps U+A5 to \mathyen. We map to AMS function \yen
  277. defineSymbol(math, ams, textord, "\u00a5", "\\yen", true);
  278. defineSymbol(text, ams, textord, "\u00a5", "\\yen", true);
  279. defineSymbol(math, ams, textord, "\u2713", "\\checkmark", true);
  280. defineSymbol(text, ams, textord, "\u2713", "\\checkmark");
  281. // AMS Hebrew
  282. defineSymbol(math, ams, textord, "\u2136", "\\beth", true);
  283. defineSymbol(math, ams, textord, "\u2138", "\\daleth", true);
  284. defineSymbol(math, ams, textord, "\u2137", "\\gimel", true);
  285. // AMS Greek
  286. defineSymbol(math, ams, textord, "\u03dd", "\\digamma");
  287. defineSymbol(math, ams, textord, "\u03f0", "\\varkappa");
  288. // AMS Delimiters
  289. defineSymbol(math, ams, open, "\u250c", "\\ulcorner", true);
  290. defineSymbol(math, ams, close, "\u2510", "\\urcorner", true);
  291. defineSymbol(math, ams, open, "\u2514", "\\llcorner", true);
  292. defineSymbol(math, ams, close, "\u2518", "\\lrcorner", true);
  293. // AMS Binary Relations
  294. defineSymbol(math, ams, rel, "\u2266", "\\leqq", true);
  295. defineSymbol(math, ams, rel, "\u2a7d", "\\leqslant", true);
  296. defineSymbol(math, ams, rel, "\u2a95", "\\eqslantless", true);
  297. defineSymbol(math, ams, rel, "\u2272", "\\lesssim", true);
  298. defineSymbol(math, ams, rel, "\u2a85", "\\lessapprox", true);
  299. defineSymbol(math, ams, rel, "\u224a", "\\approxeq", true);
  300. defineSymbol(math, ams, bin, "\u22d6", "\\lessdot");
  301. defineSymbol(math, ams, rel, "\u22d8", "\\lll", true);
  302. defineSymbol(math, ams, rel, "\u2276", "\\lessgtr", true);
  303. defineSymbol(math, ams, rel, "\u22da", "\\lesseqgtr", true);
  304. defineSymbol(math, ams, rel, "\u2a8b", "\\lesseqqgtr", true);
  305. defineSymbol(math, ams, rel, "\u2251", "\\doteqdot");
  306. defineSymbol(math, ams, rel, "\u2253", "\\risingdotseq", true);
  307. defineSymbol(math, ams, rel, "\u2252", "\\fallingdotseq", true);
  308. defineSymbol(math, ams, rel, "\u223d", "\\backsim", true);
  309. defineSymbol(math, ams, rel, "\u22cd", "\\backsimeq", true);
  310. defineSymbol(math, ams, rel, "\u2ac5", "\\subseteqq", true);
  311. defineSymbol(math, ams, rel, "\u22d0", "\\Subset", true);
  312. defineSymbol(math, ams, rel, "\u228f", "\\sqsubset", true);
  313. defineSymbol(math, ams, rel, "\u227c", "\\preccurlyeq", true);
  314. defineSymbol(math, ams, rel, "\u22de", "\\curlyeqprec", true);
  315. defineSymbol(math, ams, rel, "\u227e", "\\precsim", true);
  316. defineSymbol(math, ams, rel, "\u2ab7", "\\precapprox", true);
  317. defineSymbol(math, ams, rel, "\u22b2", "\\vartriangleleft");
  318. defineSymbol(math, ams, rel, "\u22b4", "\\trianglelefteq");
  319. defineSymbol(math, ams, rel, "\u22a8", "\\vDash", true);
  320. defineSymbol(math, ams, rel, "\u22aa", "\\Vvdash", true);
  321. defineSymbol(math, ams, rel, "\u2323", "\\smallsmile");
  322. defineSymbol(math, ams, rel, "\u2322", "\\smallfrown");
  323. defineSymbol(math, ams, rel, "\u224f", "\\bumpeq", true);
  324. defineSymbol(math, ams, rel, "\u224e", "\\Bumpeq", true);
  325. defineSymbol(math, ams, rel, "\u2267", "\\geqq", true);
  326. defineSymbol(math, ams, rel, "\u2a7e", "\\geqslant", true);
  327. defineSymbol(math, ams, rel, "\u2a96", "\\eqslantgtr", true);
  328. defineSymbol(math, ams, rel, "\u2273", "\\gtrsim", true);
  329. defineSymbol(math, ams, rel, "\u2a86", "\\gtrapprox", true);
  330. defineSymbol(math, ams, bin, "\u22d7", "\\gtrdot");
  331. defineSymbol(math, ams, rel, "\u22d9", "\\ggg", true);
  332. defineSymbol(math, ams, rel, "\u2277", "\\gtrless", true);
  333. defineSymbol(math, ams, rel, "\u22db", "\\gtreqless", true);
  334. defineSymbol(math, ams, rel, "\u2a8c", "\\gtreqqless", true);
  335. defineSymbol(math, ams, rel, "\u2256", "\\eqcirc", true);
  336. defineSymbol(math, ams, rel, "\u2257", "\\circeq", true);
  337. defineSymbol(math, ams, rel, "\u225c", "\\triangleq", true);
  338. defineSymbol(math, ams, rel, "\u223c", "\\thicksim");
  339. defineSymbol(math, ams, rel, "\u2248", "\\thickapprox");
  340. defineSymbol(math, ams, rel, "\u2ac6", "\\supseteqq", true);
  341. defineSymbol(math, ams, rel, "\u22d1", "\\Supset", true);
  342. defineSymbol(math, ams, rel, "\u2290", "\\sqsupset", true);
  343. defineSymbol(math, ams, rel, "\u227d", "\\succcurlyeq", true);
  344. defineSymbol(math, ams, rel, "\u22df", "\\curlyeqsucc", true);
  345. defineSymbol(math, ams, rel, "\u227f", "\\succsim", true);
  346. defineSymbol(math, ams, rel, "\u2ab8", "\\succapprox", true);
  347. defineSymbol(math, ams, rel, "\u22b3", "\\vartriangleright");
  348. defineSymbol(math, ams, rel, "\u22b5", "\\trianglerighteq");
  349. defineSymbol(math, ams, rel, "\u22a9", "\\Vdash", true);
  350. defineSymbol(math, ams, rel, "\u2223", "\\shortmid");
  351. defineSymbol(math, ams, rel, "\u2225", "\\shortparallel");
  352. defineSymbol(math, ams, rel, "\u226c", "\\between", true);
  353. defineSymbol(math, ams, rel, "\u22d4", "\\pitchfork", true);
  354. defineSymbol(math, ams, rel, "\u221d", "\\varpropto");
  355. defineSymbol(math, ams, rel, "\u25c0", "\\blacktriangleleft");
  356. // unicode-math says that \therefore is a mathord atom.
  357. // We kept the amssymb atom type, which is rel.
  358. defineSymbol(math, ams, rel, "\u2234", "\\therefore", true);
  359. defineSymbol(math, ams, rel, "\u220d", "\\backepsilon");
  360. defineSymbol(math, ams, rel, "\u25b6", "\\blacktriangleright");
  361. // unicode-math says that \because is a mathord atom.
  362. // We kept the amssymb atom type, which is rel.
  363. defineSymbol(math, ams, rel, "\u2235", "\\because", true);
  364. defineSymbol(math, ams, rel, "\u22d8", "\\llless");
  365. defineSymbol(math, ams, rel, "\u22d9", "\\gggtr");
  366. defineSymbol(math, ams, bin, "\u22b2", "\\lhd");
  367. defineSymbol(math, ams, bin, "\u22b3", "\\rhd");
  368. defineSymbol(math, ams, rel, "\u2242", "\\eqsim", true);
  369. defineSymbol(math, main, rel, "\u22c8", "\\Join");
  370. defineSymbol(math, ams, rel, "\u2251", "\\Doteq", true);
  371. // AMS Binary Operators
  372. defineSymbol(math, ams, bin, "\u2214", "\\dotplus", true);
  373. defineSymbol(math, ams, bin, "\u2216", "\\smallsetminus");
  374. defineSymbol(math, ams, bin, "\u22d2", "\\Cap", true);
  375. defineSymbol(math, ams, bin, "\u22d3", "\\Cup", true);
  376. defineSymbol(math, ams, bin, "\u2a5e", "\\doublebarwedge", true);
  377. defineSymbol(math, ams, bin, "\u229f", "\\boxminus", true);
  378. defineSymbol(math, ams, bin, "\u229e", "\\boxplus", true);
  379. defineSymbol(math, ams, bin, "\u22c7", "\\divideontimes", true);
  380. defineSymbol(math, ams, bin, "\u22c9", "\\ltimes", true);
  381. defineSymbol(math, ams, bin, "\u22ca", "\\rtimes", true);
  382. defineSymbol(math, ams, bin, "\u22cb", "\\leftthreetimes", true);
  383. defineSymbol(math, ams, bin, "\u22cc", "\\rightthreetimes", true);
  384. defineSymbol(math, ams, bin, "\u22cf", "\\curlywedge", true);
  385. defineSymbol(math, ams, bin, "\u22ce", "\\curlyvee", true);
  386. defineSymbol(math, ams, bin, "\u229d", "\\circleddash", true);
  387. defineSymbol(math, ams, bin, "\u229b", "\\circledast", true);
  388. defineSymbol(math, ams, bin, "\u22c5", "\\centerdot");
  389. defineSymbol(math, ams, bin, "\u22ba", "\\intercal", true);
  390. defineSymbol(math, ams, bin, "\u22d2", "\\doublecap");
  391. defineSymbol(math, ams, bin, "\u22d3", "\\doublecup");
  392. defineSymbol(math, ams, bin, "\u22a0", "\\boxtimes", true);
  393. // AMS Arrows
  394. // Note: unicode-math maps \u21e2 to their own function \rightdasharrow.
  395. // We'll map it to AMS function \dashrightarrow. It produces the same atom.
  396. defineSymbol(math, ams, rel, "\u21e2", "\\dashrightarrow", true);
  397. // unicode-math maps \u21e0 to \leftdasharrow. We'll use the AMS synonym.
  398. defineSymbol(math, ams, rel, "\u21e0", "\\dashleftarrow", true);
  399. defineSymbol(math, ams, rel, "\u21c7", "\\leftleftarrows", true);
  400. defineSymbol(math, ams, rel, "\u21c6", "\\leftrightarrows", true);
  401. defineSymbol(math, ams, rel, "\u21da", "\\Lleftarrow", true);
  402. defineSymbol(math, ams, rel, "\u219e", "\\twoheadleftarrow", true);
  403. defineSymbol(math, ams, rel, "\u21a2", "\\leftarrowtail", true);
  404. defineSymbol(math, ams, rel, "\u21ab", "\\looparrowleft", true);
  405. defineSymbol(math, ams, rel, "\u21cb", "\\leftrightharpoons", true);
  406. defineSymbol(math, ams, rel, "\u21b6", "\\curvearrowleft", true);
  407. // unicode-math maps \u21ba to \acwopencirclearrow. We'll use the AMS synonym.
  408. defineSymbol(math, ams, rel, "\u21ba", "\\circlearrowleft", true);
  409. defineSymbol(math, ams, rel, "\u21b0", "\\Lsh", true);
  410. defineSymbol(math, ams, rel, "\u21c8", "\\upuparrows", true);
  411. defineSymbol(math, ams, rel, "\u21bf", "\\upharpoonleft", true);
  412. defineSymbol(math, ams, rel, "\u21c3", "\\downharpoonleft", true);
  413. defineSymbol(math, ams, rel, "\u22b8", "\\multimap", true);
  414. defineSymbol(math, ams, rel, "\u21ad", "\\leftrightsquigarrow", true);
  415. defineSymbol(math, ams, rel, "\u21c9", "\\rightrightarrows", true);
  416. defineSymbol(math, ams, rel, "\u21c4", "\\rightleftarrows", true);
  417. defineSymbol(math, ams, rel, "\u21a0", "\\twoheadrightarrow", true);
  418. defineSymbol(math, ams, rel, "\u21a3", "\\rightarrowtail", true);
  419. defineSymbol(math, ams, rel, "\u21ac", "\\looparrowright", true);
  420. defineSymbol(math, ams, rel, "\u21b7", "\\curvearrowright", true);
  421. // unicode-math maps \u21bb to \cwopencirclearrow. We'll use the AMS synonym.
  422. defineSymbol(math, ams, rel, "\u21bb", "\\circlearrowright", true);
  423. defineSymbol(math, ams, rel, "\u21b1", "\\Rsh", true);
  424. defineSymbol(math, ams, rel, "\u21ca", "\\downdownarrows", true);
  425. defineSymbol(math, ams, rel, "\u21be", "\\upharpoonright", true);
  426. defineSymbol(math, ams, rel, "\u21c2", "\\downharpoonright", true);
  427. defineSymbol(math, ams, rel, "\u21dd", "\\rightsquigarrow", true);
  428. defineSymbol(math, ams, rel, "\u21dd", "\\leadsto");
  429. defineSymbol(math, ams, rel, "\u21db", "\\Rrightarrow", true);
  430. defineSymbol(math, ams, rel, "\u21be", "\\restriction");
  431. defineSymbol(math, main, textord, "\u2018", "`");
  432. defineSymbol(math, main, textord, "$", "\\$");
  433. defineSymbol(text, main, textord, "$", "\\$");
  434. defineSymbol(text, main, textord, "$", "\\textdollar");
  435. defineSymbol(math, main, textord, "%", "\\%");
  436. defineSymbol(text, main, textord, "%", "\\%");
  437. defineSymbol(math, main, textord, "_", "\\_");
  438. defineSymbol(text, main, textord, "_", "\\_");
  439. defineSymbol(text, main, textord, "_", "\\textunderscore");
  440. defineSymbol(math, main, textord, "\u2220", "\\angle", true);
  441. defineSymbol(math, main, textord, "\u221e", "\\infty", true);
  442. defineSymbol(math, main, textord, "\u2032", "\\prime");
  443. defineSymbol(math, main, textord, "\u25b3", "\\triangle");
  444. defineSymbol(math, main, textord, "\u0393", "\\Gamma", true);
  445. defineSymbol(math, main, textord, "\u0394", "\\Delta", true);
  446. defineSymbol(math, main, textord, "\u0398", "\\Theta", true);
  447. defineSymbol(math, main, textord, "\u039b", "\\Lambda", true);
  448. defineSymbol(math, main, textord, "\u039e", "\\Xi", true);
  449. defineSymbol(math, main, textord, "\u03a0", "\\Pi", true);
  450. defineSymbol(math, main, textord, "\u03a3", "\\Sigma", true);
  451. defineSymbol(math, main, textord, "\u03a5", "\\Upsilon", true);
  452. defineSymbol(math, main, textord, "\u03a6", "\\Phi", true);
  453. defineSymbol(math, main, textord, "\u03a8", "\\Psi", true);
  454. defineSymbol(math, main, textord, "\u03a9", "\\Omega", true);
  455. defineSymbol(math, main, textord, "A", "\u0391");
  456. defineSymbol(math, main, textord, "B", "\u0392");
  457. defineSymbol(math, main, textord, "E", "\u0395");
  458. defineSymbol(math, main, textord, "Z", "\u0396");
  459. defineSymbol(math, main, textord, "H", "\u0397");
  460. defineSymbol(math, main, textord, "I", "\u0399");
  461. defineSymbol(math, main, textord, "K", "\u039A");
  462. defineSymbol(math, main, textord, "M", "\u039C");
  463. defineSymbol(math, main, textord, "N", "\u039D");
  464. defineSymbol(math, main, textord, "O", "\u039F");
  465. defineSymbol(math, main, textord, "P", "\u03A1");
  466. defineSymbol(math, main, textord, "T", "\u03A4");
  467. defineSymbol(math, main, textord, "X", "\u03A7");
  468. defineSymbol(math, main, textord, "\u00ac", "\\neg", true);
  469. defineSymbol(math, main, textord, "\u00ac", "\\lnot");
  470. defineSymbol(math, main, textord, "\u22a4", "\\top");
  471. defineSymbol(math, main, textord, "\u22a5", "\\bot");
  472. defineSymbol(math, main, textord, "\u2205", "\\emptyset");
  473. defineSymbol(math, ams, textord, "\u2205", "\\varnothing");
  474. defineSymbol(math, main, mathord, "\u03b1", "\\alpha", true);
  475. defineSymbol(math, main, mathord, "\u03b2", "\\beta", true);
  476. defineSymbol(math, main, mathord, "\u03b3", "\\gamma", true);
  477. defineSymbol(math, main, mathord, "\u03b4", "\\delta", true);
  478. defineSymbol(math, main, mathord, "\u03f5", "\\epsilon", true);
  479. defineSymbol(math, main, mathord, "\u03b6", "\\zeta", true);
  480. defineSymbol(math, main, mathord, "\u03b7", "\\eta", true);
  481. defineSymbol(math, main, mathord, "\u03b8", "\\theta", true);
  482. defineSymbol(math, main, mathord, "\u03b9", "\\iota", true);
  483. defineSymbol(math, main, mathord, "\u03ba", "\\kappa", true);
  484. defineSymbol(math, main, mathord, "\u03bb", "\\lambda", true);
  485. defineSymbol(math, main, mathord, "\u03bc", "\\mu", true);
  486. defineSymbol(math, main, mathord, "\u03bd", "\\nu", true);
  487. defineSymbol(math, main, mathord, "\u03be", "\\xi", true);
  488. defineSymbol(math, main, mathord, "\u03bf", "\\omicron", true);
  489. defineSymbol(math, main, mathord, "\u03c0", "\\pi", true);
  490. defineSymbol(math, main, mathord, "\u03c1", "\\rho", true);
  491. defineSymbol(math, main, mathord, "\u03c3", "\\sigma", true);
  492. defineSymbol(math, main, mathord, "\u03c4", "\\tau", true);
  493. defineSymbol(math, main, mathord, "\u03c5", "\\upsilon", true);
  494. defineSymbol(math, main, mathord, "\u03d5", "\\phi", true);
  495. defineSymbol(math, main, mathord, "\u03c7", "\\chi", true);
  496. defineSymbol(math, main, mathord, "\u03c8", "\\psi", true);
  497. defineSymbol(math, main, mathord, "\u03c9", "\\omega", true);
  498. defineSymbol(math, main, mathord, "\u03b5", "\\varepsilon", true);
  499. defineSymbol(math, main, mathord, "\u03d1", "\\vartheta", true);
  500. defineSymbol(math, main, mathord, "\u03d6", "\\varpi", true);
  501. defineSymbol(math, main, mathord, "\u03f1", "\\varrho", true);
  502. defineSymbol(math, main, mathord, "\u03c2", "\\varsigma", true);
  503. defineSymbol(math, main, mathord, "\u03c6", "\\varphi", true);
  504. defineSymbol(math, main, bin, "\u2217", "*");
  505. defineSymbol(math, main, bin, "+", "+");
  506. defineSymbol(math, main, bin, "\u2212", "-");
  507. defineSymbol(math, main, bin, "\u22c5", "\\cdot", true);
  508. defineSymbol(math, main, bin, "\u2218", "\\circ");
  509. defineSymbol(math, main, bin, "\u00f7", "\\div", true);
  510. defineSymbol(math, main, bin, "\u00b1", "\\pm", true);
  511. defineSymbol(math, main, bin, "\u00d7", "\\times", true);
  512. defineSymbol(math, main, bin, "\u2229", "\\cap", true);
  513. defineSymbol(math, main, bin, "\u222a", "\\cup", true);
  514. defineSymbol(math, main, bin, "\u2216", "\\setminus");
  515. defineSymbol(math, main, bin, "\u2227", "\\land");
  516. defineSymbol(math, main, bin, "\u2228", "\\lor");
  517. defineSymbol(math, main, bin, "\u2227", "\\wedge", true);
  518. defineSymbol(math, main, bin, "\u2228", "\\vee", true);
  519. defineSymbol(math, main, textord, "\u221a", "\\surd");
  520. defineSymbol(math, main, open, "(", "(");
  521. defineSymbol(math, main, open, "[", "[");
  522. defineSymbol(math, main, open, "\u27e8", "\\langle", true);
  523. defineSymbol(math, main, open, "\u2223", "\\lvert");
  524. defineSymbol(math, main, open, "\u2225", "\\lVert");
  525. defineSymbol(math, main, close, ")", ")");
  526. defineSymbol(math, main, close, "]", "]");
  527. defineSymbol(math, main, close, "?", "?");
  528. defineSymbol(math, main, close, "!", "!");
  529. defineSymbol(math, main, close, "\u27e9", "\\rangle", true);
  530. defineSymbol(math, main, close, "\u2223", "\\rvert");
  531. defineSymbol(math, main, close, "\u2225", "\\rVert");
  532. defineSymbol(math, main, rel, "=", "=");
  533. defineSymbol(math, main, rel, "<", "<");
  534. defineSymbol(math, main, rel, ">", ">");
  535. defineSymbol(math, main, rel, ":", ":");
  536. defineSymbol(math, main, rel, "\u2248", "\\approx", true);
  537. defineSymbol(math, main, rel, "\u2245", "\\cong", true);
  538. defineSymbol(math, main, rel, "\u2265", "\\ge");
  539. defineSymbol(math, main, rel, "\u2265", "\\geq", true);
  540. defineSymbol(math, main, rel, "\u2190", "\\gets");
  541. defineSymbol(math, main, rel, ">", "\\gt");
  542. defineSymbol(math, main, rel, "\u2208", "\\in", true);
  543. defineSymbol(math, main, rel, "\u0338", "\\@not");
  544. defineSymbol(math, main, rel, "\u2282", "\\subset", true);
  545. defineSymbol(math, main, rel, "\u2283", "\\supset", true);
  546. defineSymbol(math, main, rel, "\u2286", "\\subseteq", true);
  547. defineSymbol(math, main, rel, "\u2287", "\\supseteq", true);
  548. defineSymbol(math, ams, rel, "\u2288", "\\nsubseteq", true);
  549. defineSymbol(math, ams, rel, "\u2289", "\\nsupseteq", true);
  550. defineSymbol(math, main, rel, "\u22a8", "\\models");
  551. defineSymbol(math, main, rel, "\u2190", "\\leftarrow", true);
  552. defineSymbol(math, main, rel, "\u2264", "\\le");
  553. defineSymbol(math, main, rel, "\u2264", "\\leq", true);
  554. defineSymbol(math, main, rel, "<", "\\lt");
  555. defineSymbol(math, main, rel, "\u2192", "\\rightarrow", true);
  556. defineSymbol(math, main, rel, "\u2192", "\\to");
  557. defineSymbol(math, ams, rel, "\u2271", "\\ngeq", true);
  558. defineSymbol(math, ams, rel, "\u2270", "\\nleq", true);
  559. defineSymbol(math, main, spacing, "\u00a0", "\\ ");
  560. defineSymbol(math, main, spacing, "\u00a0", "~");
  561. defineSymbol(math, main, spacing, "\u00a0", "\\space");
  562. // Ref: LaTeX Source 2e: \DeclareRobustCommand{\nobreakspace}{%
  563. defineSymbol(math, main, spacing, "\u00a0", "\\nobreakspace");
  564. defineSymbol(text, main, spacing, "\u00a0", "\\ ");
  565. defineSymbol(text, main, spacing, "\u00a0", "~");
  566. defineSymbol(text, main, spacing, "\u00a0", "\\space");
  567. defineSymbol(text, main, spacing, "\u00a0", "\\nobreakspace");
  568. defineSymbol(math, main, spacing, null, "\\nobreak");
  569. defineSymbol(math, main, spacing, null, "\\allowbreak");
  570. defineSymbol(math, main, punct, ",", ",");
  571. defineSymbol(math, main, punct, ";", ";");
  572. defineSymbol(math, ams, bin, "\u22bc", "\\barwedge", true);
  573. defineSymbol(math, ams, bin, "\u22bb", "\\veebar", true);
  574. defineSymbol(math, main, bin, "\u2299", "\\odot", true);
  575. defineSymbol(math, main, bin, "\u2295", "\\oplus", true);
  576. defineSymbol(math, main, bin, "\u2297", "\\otimes", true);
  577. defineSymbol(math, main, textord, "\u2202", "\\partial", true);
  578. defineSymbol(math, main, bin, "\u2298", "\\oslash", true);
  579. defineSymbol(math, ams, bin, "\u229a", "\\circledcirc", true);
  580. defineSymbol(math, ams, bin, "\u22a1", "\\boxdot", true);
  581. defineSymbol(math, main, bin, "\u25b3", "\\bigtriangleup");
  582. defineSymbol(math, main, bin, "\u25bd", "\\bigtriangledown");
  583. defineSymbol(math, main, bin, "\u2020", "\\dagger");
  584. defineSymbol(math, main, bin, "\u22c4", "\\diamond");
  585. defineSymbol(math, main, bin, "\u22c6", "\\star");
  586. defineSymbol(math, main, bin, "\u25c3", "\\triangleleft");
  587. defineSymbol(math, main, bin, "\u25b9", "\\triangleright");
  588. defineSymbol(math, main, open, "{", "\\{");
  589. defineSymbol(text, main, textord, "{", "\\{");
  590. defineSymbol(text, main, textord, "{", "\\textbraceleft");
  591. defineSymbol(math, main, close, "}", "\\}");
  592. defineSymbol(text, main, textord, "}", "\\}");
  593. defineSymbol(text, main, textord, "}", "\\textbraceright");
  594. defineSymbol(math, main, open, "{", "\\lbrace");
  595. defineSymbol(math, main, close, "}", "\\rbrace");
  596. defineSymbol(math, main, open, "[", "\\lbrack");
  597. defineSymbol(text, main, textord, "[", "\\lbrack");
  598. defineSymbol(math, main, close, "]", "\\rbrack");
  599. defineSymbol(text, main, textord, "]", "\\rbrack");
  600. defineSymbol(math, main, open, "(", "\\lparen");
  601. defineSymbol(math, main, close, ")", "\\rparen");
  602. defineSymbol(text, main, textord, "<", "\\textless"); // in T1 fontenc
  603. defineSymbol(text, main, textord, ">", "\\textgreater"); // in T1 fontenc
  604. defineSymbol(math, main, open, "\u230a", "\\lfloor", true);
  605. defineSymbol(math, main, close, "\u230b", "\\rfloor", true);
  606. defineSymbol(math, main, open, "\u2308", "\\lceil", true);
  607. defineSymbol(math, main, close, "\u2309", "\\rceil", true);
  608. defineSymbol(math, main, textord, "\\", "\\backslash");
  609. defineSymbol(math, main, textord, "\u2223", "|");
  610. defineSymbol(math, main, textord, "\u2223", "\\vert");
  611. defineSymbol(text, main, textord, "|", "\\textbar"); // in T1 fontenc
  612. defineSymbol(math, main, textord, "\u2225", "\\|");
  613. defineSymbol(math, main, textord, "\u2225", "\\Vert");
  614. defineSymbol(text, main, textord, "\u2225", "\\textbardbl");
  615. defineSymbol(text, main, textord, "~", "\\textasciitilde");
  616. defineSymbol(math, main, rel, "\u2191", "\\uparrow", true);
  617. defineSymbol(math, main, rel, "\u21d1", "\\Uparrow", true);
  618. defineSymbol(math, main, rel, "\u2193", "\\downarrow", true);
  619. defineSymbol(math, main, rel, "\u21d3", "\\Downarrow", true);
  620. defineSymbol(math, main, rel, "\u2195", "\\updownarrow", true);
  621. defineSymbol(math, main, rel, "\u21d5", "\\Updownarrow", true);
  622. defineSymbol(math, main, op, "\u2210", "\\coprod");
  623. defineSymbol(math, main, op, "\u22c1", "\\bigvee");
  624. defineSymbol(math, main, op, "\u22c0", "\\bigwedge");
  625. defineSymbol(math, main, op, "\u2a04", "\\biguplus");
  626. defineSymbol(math, main, op, "\u22c2", "\\bigcap");
  627. defineSymbol(math, main, op, "\u22c3", "\\bigcup");
  628. defineSymbol(math, main, op, "\u222b", "\\int");
  629. defineSymbol(math, main, op, "\u222b", "\\intop");
  630. defineSymbol(math, main, op, "\u222c", "\\iint");
  631. defineSymbol(math, main, op, "\u222d", "\\iiint");
  632. defineSymbol(math, main, op, "\u220f", "\\prod");
  633. defineSymbol(math, main, op, "\u2211", "\\sum");
  634. defineSymbol(math, main, op, "\u2a02", "\\bigotimes");
  635. defineSymbol(math, main, op, "\u2a01", "\\bigoplus");
  636. defineSymbol(math, main, op, "\u2a00", "\\bigodot");
  637. defineSymbol(math, main, op, "\u222e", "\\oint");
  638. defineSymbol(math, main, op, "\u222f", "\\oiint");
  639. defineSymbol(math, main, op, "\u2230", "\\oiiint");
  640. defineSymbol(math, main, op, "\u2a06", "\\bigsqcup");
  641. defineSymbol(math, main, op, "\u222b", "\\smallint");
  642. defineSymbol(text, main, inner, "\u2026", "\\textellipsis");
  643. defineSymbol(math, main, inner, "\u2026", "\\mathellipsis");
  644. defineSymbol(text, main, inner, "\u2026", "\\ldots", true);
  645. defineSymbol(math, main, inner, "\u2026", "\\ldots", true);
  646. defineSymbol(math, main, inner, "\u22ef", "\\@cdots", true);
  647. defineSymbol(math, main, inner, "\u22f1", "\\ddots", true);
  648. defineSymbol(math, main, textord, "\u22ee", "\\varvdots"); // \vdots is a macro
  649. defineSymbol(math, main, accent, "\u02ca", "\\acute");
  650. defineSymbol(math, main, accent, "\u02cb", "\\grave");
  651. defineSymbol(math, main, accent, "\u00a8", "\\ddot");
  652. defineSymbol(math, main, accent, "\u007e", "\\tilde");
  653. defineSymbol(math, main, accent, "\u02c9", "\\bar");
  654. defineSymbol(math, main, accent, "\u02d8", "\\breve");
  655. defineSymbol(math, main, accent, "\u02c7", "\\check");
  656. defineSymbol(math, main, accent, "\u005e", "\\hat");
  657. defineSymbol(math, main, accent, "\u20d7", "\\vec");
  658. defineSymbol(math, main, accent, "\u02d9", "\\dot");
  659. defineSymbol(math, main, accent, "\u02da", "\\mathring");
  660. defineSymbol(math, main, mathord, "\u0131", "\\imath", true);
  661. defineSymbol(math, main, mathord, "\u0237", "\\jmath", true);
  662. defineSymbol(text, main, textord, "\u0131", "\\i", true);
  663. defineSymbol(text, main, textord, "\u0237", "\\j", true);
  664. defineSymbol(text, main, textord, "\u00df", "\\ss", true);
  665. defineSymbol(text, main, textord, "\u00e6", "\\ae", true);
  666. defineSymbol(text, main, textord, "\u00e6", "\\ae", true);
  667. defineSymbol(text, main, textord, "\u0153", "\\oe", true);
  668. defineSymbol(text, main, textord, "\u00f8", "\\o", true);
  669. defineSymbol(text, main, textord, "\u00c6", "\\AE", true);
  670. defineSymbol(text, main, textord, "\u0152", "\\OE", true);
  671. defineSymbol(text, main, textord, "\u00d8", "\\O", true);
  672. defineSymbol(text, main, accent, "\u02ca", "\\'"); // acute
  673. defineSymbol(text, main, accent, "\u02cb", "\\`"); // grave
  674. defineSymbol(text, main, accent, "\u02c6", "\\^"); // circumflex
  675. defineSymbol(text, main, accent, "\u02dc", "\\~"); // tilde
  676. defineSymbol(text, main, accent, "\u02c9", "\\="); // macron
  677. defineSymbol(text, main, accent, "\u02d8", "\\u"); // breve
  678. defineSymbol(text, main, accent, "\u02d9", "\\."); // dot above
  679. defineSymbol(text, main, accent, "\u02da", "\\r"); // ring above
  680. defineSymbol(text, main, accent, "\u02c7", "\\v"); // caron
  681. defineSymbol(text, main, accent, "\u00a8", '\\"'); // diaresis
  682. defineSymbol(text, main, accent, "\u02dd", "\\H"); // double acute
  683. defineSymbol(text, main, accent, "\u25ef", "\\textcircled"); // \bigcirc glyph
  684. // These ligatures are detected and created in Parser.js's `formLigatures`.
  685. export const ligatures = {
  686. "--": true,
  687. "---": true,
  688. "``": true,
  689. "''": true,
  690. };
  691. defineSymbol(text, main, textord, "\u2013", "--");
  692. defineSymbol(text, main, textord, "\u2013", "\\textendash");
  693. defineSymbol(text, main, textord, "\u2014", "---");
  694. defineSymbol(text, main, textord, "\u2014", "\\textemdash");
  695. defineSymbol(text, main, textord, "\u2018", "`");
  696. defineSymbol(text, main, textord, "\u2018", "\\textquoteleft");
  697. defineSymbol(text, main, textord, "\u2019", "'");
  698. defineSymbol(text, main, textord, "\u2019", "\\textquoteright");
  699. defineSymbol(text, main, textord, "\u201c", "``");
  700. defineSymbol(text, main, textord, "\u201c", "\\textquotedblleft");
  701. defineSymbol(text, main, textord, "\u201d", "''");
  702. defineSymbol(text, main, textord, "\u201d", "\\textquotedblright");
  703. // \degree from gensymb package
  704. defineSymbol(math, main, textord, "\u00b0", "\\degree", true);
  705. defineSymbol(text, main, textord, "\u00b0", "\\degree");
  706. // \textdegree from inputenc package
  707. defineSymbol(text, main, textord, "\u00b0", "\\textdegree", true);
  708. // TODO: In LaTeX, \pounds can generate a different character in text and math
  709. // mode, but among our fonts, only Main-Italic defines this character "163".
  710. defineSymbol(math, main, mathord, "\u00a3", "\\pounds");
  711. defineSymbol(math, main, mathord, "\u00a3", "\\mathsterling", true);
  712. defineSymbol(text, main, mathord, "\u00a3", "\\pounds");
  713. defineSymbol(text, main, mathord, "\u00a3", "\\textsterling", true);
  714. defineSymbol(math, ams, textord, "\u2720", "\\maltese");
  715. defineSymbol(text, ams, textord, "\u2720", "\\maltese");
  716. defineSymbol(text, main, spacing, "\u00a0", "\\ ");
  717. defineSymbol(text, main, spacing, "\u00a0", " ");
  718. defineSymbol(text, main, spacing, "\u00a0", "~");
  719. // There are lots of symbols which are the same, so we add them in afterwards.
  720. // All of these are textords in math mode
  721. const mathTextSymbols = "0123456789/@.\"";
  722. for (let i = 0; i < mathTextSymbols.length; i++) {
  723. const ch = mathTextSymbols.charAt(i);
  724. defineSymbol(math, main, textord, ch, ch);
  725. }
  726. // All of these are textords in text mode
  727. const textSymbols = "0123456789!@*()-=+[]<>|\";:?/.,";
  728. for (let i = 0; i < textSymbols.length; i++) {
  729. const ch = textSymbols.charAt(i);
  730. defineSymbol(text, main, textord, ch, ch);
  731. }
  732. // All of these are textords in text mode, and mathords in math mode
  733. const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  734. for (let i = 0; i < letters.length; i++) {
  735. const ch = letters.charAt(i);
  736. defineSymbol(math, main, mathord, ch, ch);
  737. defineSymbol(text, main, textord, ch, ch);
  738. }
  739. // Blackboard bold and script letters in Unicode range
  740. defineSymbol(math, ams, textord, "C", "\u2102"); // blackboard bold
  741. defineSymbol(text, ams, textord, "C", "\u2102");
  742. defineSymbol(math, ams, textord, "H", "\u210D");
  743. defineSymbol(text, ams, textord, "H", "\u210D");
  744. defineSymbol(math, ams, textord, "N", "\u2115");
  745. defineSymbol(text, ams, textord, "N", "\u2115");
  746. defineSymbol(math, ams, textord, "P", "\u2119");
  747. defineSymbol(text, ams, textord, "P", "\u2119");
  748. defineSymbol(math, ams, textord, "Q", "\u211A");
  749. defineSymbol(text, ams, textord, "Q", "\u211A");
  750. defineSymbol(math, ams, textord, "R", "\u211D");
  751. defineSymbol(text, ams, textord, "R", "\u211D");
  752. defineSymbol(math, ams, textord, "Z", "\u2124");
  753. defineSymbol(text, ams, textord, "Z", "\u2124");
  754. defineSymbol(math, main, mathord, "h", "\u210E"); // italic h, Planck constant
  755. defineSymbol(text, main, mathord, "h", "\u210E");
  756. // The next loop loads wide (surrogate pair) characters.
  757. // We support some letters in the Unicode range U+1D400 to U+1D7FF,
  758. // Mathematical Alphanumeric Symbols.
  759. // Some editors do not deal well with wide characters. So don't write the
  760. // string into this file. Instead, create the string from the surrogate pair.
  761. let wideChar = "";
  762. for (let i = 0; i < letters.length; i++) {
  763. const ch = letters.charAt(i);
  764. // The hex numbers in the next line are a surrogate pair.
  765. // 0xD835 is the high surrogate for all letters in the range we support.
  766. // 0xDC00 is the low surrogate for bold A.
  767. wideChar = String.fromCharCode(0xD835, 0xDC00 + i); // A-Z a-z bold
  768. defineSymbol(math, main, mathord, ch, wideChar);
  769. defineSymbol(text, main, textord, ch, wideChar);
  770. wideChar = String.fromCharCode(0xD835, 0xDC34 + i); // A-Z a-z italic
  771. defineSymbol(math, main, mathord, ch, wideChar);
  772. defineSymbol(text, main, textord, ch, wideChar);
  773. wideChar = String.fromCharCode(0xD835, 0xDC68 + i); // A-Z a-z bold italic
  774. defineSymbol(math, main, mathord, ch, wideChar);
  775. defineSymbol(text, main, textord, ch, wideChar);
  776. wideChar = String.fromCharCode(0xD835, 0xDD04 + i); // A-Z a-z Fractur
  777. defineSymbol(math, main, mathord, ch, wideChar);
  778. defineSymbol(text, main, textord, ch, wideChar);
  779. wideChar = String.fromCharCode(0xD835, 0xDDA0 + i); // A-Z a-z sans-serif
  780. defineSymbol(math, main, mathord, ch, wideChar);
  781. defineSymbol(text, main, textord, ch, wideChar);
  782. wideChar = String.fromCharCode(0xD835, 0xDDD4 + i); // A-Z a-z sans bold
  783. defineSymbol(math, main, mathord, ch, wideChar);
  784. defineSymbol(text, main, textord, ch, wideChar);
  785. wideChar = String.fromCharCode(0xD835, 0xDE08 + i); // A-Z a-z sans italic
  786. defineSymbol(math, main, mathord, ch, wideChar);
  787. defineSymbol(text, main, textord, ch, wideChar);
  788. wideChar = String.fromCharCode(0xD835, 0xDE70 + i); // A-Z a-z monospace
  789. defineSymbol(math, main, mathord, ch, wideChar);
  790. defineSymbol(text, main, textord, ch, wideChar);
  791. if (i < 26) {
  792. // KaTeX fonts have only capital letters for blackboard bold and script.
  793. // See exception for k below.
  794. wideChar = String.fromCharCode(0xD835, 0xDD38 + i); // A-Z double struck
  795. defineSymbol(math, main, mathord, ch, wideChar);
  796. defineSymbol(text, main, textord, ch, wideChar);
  797. wideChar = String.fromCharCode(0xD835, 0xDC9C + i); // A-Z script
  798. defineSymbol(math, main, mathord, ch, wideChar);
  799. defineSymbol(text, main, textord, ch, wideChar);
  800. }
  801. // TODO: Add bold script when it is supported by a KaTeX font.
  802. }
  803. // "k" is the only double struck lower case letter in the KaTeX fonts.
  804. wideChar = String.fromCharCode(0xD835, 0xDD5C); // k double struck
  805. defineSymbol(math, main, mathord, "k", wideChar);
  806. defineSymbol(text, main, textord, "k", wideChar);
  807. // Next, some wide character numerals
  808. for (let i = 0; i < 10; i++) {
  809. const ch = i.toString();
  810. wideChar = String.fromCharCode(0xD835, 0xDFCE + i); // 0-9 bold
  811. defineSymbol(math, main, mathord, ch, wideChar);
  812. defineSymbol(text, main, textord, ch, wideChar);
  813. wideChar = String.fromCharCode(0xD835, 0xDFE2 + i); // 0-9 sans serif
  814. defineSymbol(math, main, mathord, ch, wideChar);
  815. defineSymbol(text, main, textord, ch, wideChar);
  816. wideChar = String.fromCharCode(0xD835, 0xDFEC + i); // 0-9 bold sans
  817. defineSymbol(math, main, mathord, ch, wideChar);
  818. defineSymbol(text, main, textord, ch, wideChar);
  819. wideChar = String.fromCharCode(0xD835, 0xDFF6 + i); // 0-9 monospace
  820. defineSymbol(math, main, mathord, ch, wideChar);
  821. defineSymbol(text, main, textord, ch, wideChar);
  822. }
  823. // We add these Latin-1 letters as symbols for backwards-compatibility,
  824. // but they are not actually in the font, nor are they supported by the
  825. // Unicode accent mechanism, so they fall back to Times font and look ugly.
  826. // TODO(edemaine): Fix this.
  827. export const extraLatin = "ÇÐÞçþ";
  828. for (let i = 0; i < extraLatin.length; i++) {
  829. const ch = extraLatin.charAt(i);
  830. defineSymbol(math, main, mathord, ch, ch);
  831. defineSymbol(text, main, textord, ch, ch);
  832. }
  833. defineSymbol(text, main, textord, "ð", "ð");
  834. // Unicode versions of existing characters
  835. defineSymbol(text, main, textord, "\u2013", "–");
  836. defineSymbol(text, main, textord, "\u2014", "—");
  837. defineSymbol(text, main, textord, "\u2018", "‘");
  838. defineSymbol(text, main, textord, "\u2019", "’");
  839. defineSymbol(text, main, textord, "\u201c", "“");
  840. defineSymbol(text, main, textord, "\u201d", "”");