Skip to content

Commit e64196c

Browse files
committed
Adds the textcomp package.
1 parent c125626 commit e64196c

8 files changed

Lines changed: 243 additions & 1 deletion

File tree

components/src/dependencies.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const dependencies = {
2525
'[tex]/physics': ['input/tex-base'],
2626
'[tex]/require': ['input/tex-base'],
2727
'[tex]/tagformat': ['input/tex-base'],
28+
'[tex]/textcomp': ['input/tex-base', '[tex]/textmacros'],
2829
'[tex]/textmacros': ['input/tex-base'],
2930
'[tex]/unicode': ['input/tex-base'],
3031
'[tex]/verb': ['input/tex-base']
@@ -56,6 +57,7 @@ const allPackages = [
5657
'[tex]/physics',
5758
'[tex]/require',
5859
'[tex]/tagformat',
60+
'[tex]/textcomp',
5961
'[tex]/textmacros',
6062
'[tex]/unicode',
6163
'[tex]/verb'
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"component": "input/tex/extensions/textcomp",
3+
"targets": ["input/tex/textcomp"]
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import './lib/textcomp.js';
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const PACKAGE = require('../../../../../webpack.common.js');
2+
3+
module.exports = PACKAGE(
4+
'input/tex/extensions/textcomp', // the package to build
5+
'../../../../../../js', // location of the MathJax js library
6+
[ // packages to link to
7+
'components/src/input/tex/extensions/textmacros/lib',
8+
'components/src/input/tex-base/lib',
9+
'components/src/core/lib'
10+
],
11+
__dirname // our directory
12+
);

ts/input/tex/AllPackages.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import './noerrors/NoErrorsConfiguration.js';
4242
import './noundefined/NoUndefinedConfiguration.js';
4343
import './physics/PhysicsConfiguration.js';
4444
import './tagformat/TagFormatConfiguration.js';
45+
import './textcomp/TextcompConfiguration.js';
4546
import './textmacros/TextMacrosConfiguration.js';
4647
import './unicode/UnicodeConfiguration.js';
4748
import './verb/VerbConfiguration.js';
@@ -71,6 +72,7 @@ if (typeof MathJax !== 'undefined' && MathJax.loader) {
7172
'[tex]/verb',
7273
'[tex]/configmacros',
7374
'[tex]/tagformat',
75+
'[tex]/textcomp',
7476
'[tex]/textmacros'
7577
);
7678
}
@@ -97,5 +99,6 @@ export const AllPackages: string[] = [
9799
'verb',
98100
'configmacros',
99101
'tagformat',
102+
'textcomp',
100103
'textmacros'
101104
];
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*************************************************************
2+
*
3+
* Copyright (c) 2021 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+
19+
/**
20+
* @fileoverview Configuration file for the textcomp package.
21+
*
22+
* @author v.sorge@mathjax.org (Volker Sorge)
23+
*/
24+
25+
import {Configuration} from '../Configuration.js';
26+
import './TextcompMappings.js';
27+
28+
// import {TeX} from '../../tex.js';
29+
// import {TextParser} from '../textmacros/TextParser.js';
30+
// import {TextMacrosConfiguration} from '../textmacros/TextMacrosConfiguration.js';
31+
32+
33+
export const TextcompConfiguration = Configuration.create(
34+
'textcomp', {
35+
// config(config: ParserConfiguration, jax: TeX<any, any, any>) {
36+
// try {
37+
// TextMacrosConfiguration.config(config, jax);
38+
// } catch (e) {
39+
// console.log(e);
40+
// }
41+
// },
42+
handler: {macro: ['textcomp']},
43+
}
44+
);
45+
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
/*************************************************************
2+
*
3+
* Copyright (c) 2021 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+
19+
/**
20+
* @fileoverview Mappings for the textcomp package.
21+
*
22+
* @author v.sorge@mathjax.org (Volker Sorge)
23+
*/
24+
25+
26+
import ParseMethods from '../ParseMethods.js';
27+
import {CharacterMap} from '../SymbolMap.js';
28+
import {TexConstant} from '../TexConstants.js';
29+
30+
31+
/**
32+
* Identifiers from the Textcomp package.
33+
*/
34+
new CharacterMap('textcomp', ParseMethods.mathchar0mi, {
35+
36+
// Table 3: Predefined LATEX 2ε Text-Mode Commands
37+
'textasciicircum': ['\u005E', {mathvariant: TexConstant.Variant.NORMAL}],
38+
'textasciitilde': ['\u007E', {mathvariant: TexConstant.Variant.NORMAL}],
39+
// 'textasteriskcentered'
40+
'textbackslash': ['\u005C', {mathvariant: TexConstant.Variant.NORMAL}],
41+
'textbar': ['\u007C', {mathvariant: TexConstant.Variant.NORMAL}],
42+
'textbraceleft': ['\u007B', {mathvariant: TexConstant.Variant.NORMAL}],
43+
'textbraceright': ['\u007D', {mathvariant: TexConstant.Variant.NORMAL}],
44+
'textbullet': ['\u2022', {mathvariant: TexConstant.Variant.NORMAL}],
45+
'textdagger': ['\u2020', {mathvariant: TexConstant.Variant.NORMAL}],
46+
'textdaggerdbl': ['\u2021', {mathvariant: TexConstant.Variant.NORMAL}],
47+
'textellipsis': ['\u2026', {mathvariant: TexConstant.Variant.NORMAL}],
48+
'textemdash': ['\u2014', {mathvariant: TexConstant.Variant.NORMAL}],
49+
'textendash': ['\u2013', {mathvariant: TexConstant.Variant.NORMAL}],
50+
'textexclamdown': ['\u00A1', {mathvariant: TexConstant.Variant.NORMAL}],
51+
'textgreater': ['\u003E', {mathvariant: TexConstant.Variant.NORMAL}],
52+
'textless': ['\u003C', {mathvariant: TexConstant.Variant.NORMAL}],
53+
'textordfeminine': ['\u00AA', {mathvariant: TexConstant.Variant.NORMAL}],
54+
'textordmasculine': ['\u00BA', {mathvariant: TexConstant.Variant.NORMAL}],
55+
'textparagraph': ['\u00B6', {mathvariant: TexConstant.Variant.NORMAL}],
56+
'textperiodcentered': ['\u00B7', {mathvariant: TexConstant.Variant.NORMAL}],
57+
'textquestiondown': ['\u00BF', {mathvariant: TexConstant.Variant.NORMAL}],
58+
'textquotedblleft': ['\u201C', {mathvariant: TexConstant.Variant.NORMAL}],
59+
'textquotedblright': ['\u201D', {mathvariant: TexConstant.Variant.NORMAL}],
60+
'textquoteleft': ['\u2018', {mathvariant: TexConstant.Variant.NORMAL}],
61+
'textquoteright': ['\u2019', {mathvariant: TexConstant.Variant.NORMAL}],
62+
'textsection': ['\u00A7', {mathvariant: TexConstant.Variant.NORMAL}],
63+
'textunderscore': ['\u005F', {mathvariant: TexConstant.Variant.NORMAL}],
64+
'textvisiblespace': ['\u2423', {mathvariant: TexConstant.Variant.NORMAL}],
65+
66+
// Table 12: textcomp Diacritics
67+
'textacutedbl': ['\u02DD', {mathvariant: TexConstant.Variant.NORMAL}],
68+
'textasciiacute': ['\u00B4', {mathvariant: TexConstant.Variant.NORMAL}],
69+
'textasciibreve': ['\u02D8', {mathvariant: TexConstant.Variant.NORMAL}],
70+
'textasciicaron': ['\u02C7', {mathvariant: TexConstant.Variant.NORMAL}],
71+
'textasciidieresis': ['\u00A8', {mathvariant: TexConstant.Variant.NORMAL}],
72+
'textasciimacron': ['\u00AF', {mathvariant: TexConstant.Variant.NORMAL}],
73+
'textgravedbl': ['\u02F5', {mathvariant: TexConstant.Variant.NORMAL}],
74+
'texttildelow': ['\u02F7', {mathvariant: TexConstant.Variant.NORMAL}],
75+
76+
// Table 13: textcomp Currency Symbols
77+
'textbaht': ['\u0E3F', {mathvariant: TexConstant.Variant.NORMAL}],
78+
'textcent': ['\u00A2', {mathvariant: TexConstant.Variant.NORMAL}],
79+
// This is not the correct glyph
80+
'textcentoldstyle': ['$', {mathvariant: TexConstant.Variant.OLDSTYLE}],
81+
'textcolonmonetary': ['\u20A1', {mathvariant: TexConstant.Variant.NORMAL}],
82+
'textcurrency': ['\u00A4', {mathvariant: TexConstant.Variant.NORMAL}],
83+
'textdollar': ['\u0024', {mathvariant: TexConstant.Variant.NORMAL}],
84+
// This is not the correct glyph
85+
'textdollaroldstyle': ['$', {mathvariant: TexConstant.Variant.OLDSTYLE}],
86+
'textdong': ['\u20AB', {mathvariant: TexConstant.Variant.NORMAL}],
87+
'texteuro': ['\u20AC', {mathvariant: TexConstant.Variant.NORMAL}],
88+
'textflorin': ['\u0192', {mathvariant: TexConstant.Variant.NORMAL}],
89+
'textguarani': ['\u20B2', {mathvariant: TexConstant.Variant.NORMAL}],
90+
'textlira': ['\u20A4', {mathvariant: TexConstant.Variant.NORMAL}],
91+
'textnaira': ['\u20A6', {mathvariant: TexConstant.Variant.NORMAL}],
92+
'textpeso': ['\u20B1', {mathvariant: TexConstant.Variant.NORMAL}],
93+
'textsterling': ['\u00A3', {mathvariant: TexConstant.Variant.NORMAL}],
94+
'textwon': ['\u20A9', {mathvariant: TexConstant.Variant.NORMAL}],
95+
'textyen': ['\u00A5', {mathvariant: TexConstant.Variant.NORMAL}],
96+
97+
// Table 15: textcomp Legal Symbols
98+
'textcircledP': ['\u2117', {mathvariant: TexConstant.Variant.NORMAL}],
99+
'textcompwordmark': ['\u200C', {mathvariant: TexConstant.Variant.NORMAL}],
100+
'textcopyleft': ['\u1F12F', {mathvariant: TexConstant.Variant.NORMAL}],
101+
'textcopyright': ['\u00A9', {mathvariant: TexConstant.Variant.NORMAL}],
102+
'textregistered': ['\u00AE', {mathvariant: TexConstant.Variant.NORMAL}],
103+
'textservicemark': ['\u2120', {mathvariant: TexConstant.Variant.NORMAL}],
104+
'texttrademark': ['\u2122', {mathvariant: TexConstant.Variant.NORMAL}],
105+
106+
// Table 16: textcomp Old-Style Numerals
107+
'textzerooldstyle': ['0', {mathvariant: TexConstant.Variant.OLDSTYLE}],
108+
'textoneoldstyle': ['1', {mathvariant: TexConstant.Variant.OLDSTYLE}],
109+
'texttwooldstyle': ['2', {mathvariant: TexConstant.Variant.OLDSTYLE}],
110+
'textthreeoldstyle': ['3', {mathvariant: TexConstant.Variant.OLDSTYLE}],
111+
'textfouroldstyle': ['4', {mathvariant: TexConstant.Variant.OLDSTYLE}],
112+
'textfiveoldstyle': ['5', {mathvariant: TexConstant.Variant.OLDSTYLE}],
113+
'textsixoldstyle': ['6', {mathvariant: TexConstant.Variant.OLDSTYLE}],
114+
'textsevenoldstyle': ['7', {mathvariant: TexConstant.Variant.OLDSTYLE}],
115+
'texteightoldstyle': ['8', {mathvariant: TexConstant.Variant.OLDSTYLE}],
116+
'textnineoldstyle': ['9', {mathvariant: TexConstant.Variant.OLDSTYLE}],
117+
118+
// Table 20: Miscellaneous textcomp Symbol
119+
'textbardbl': ['\u2016', {mathvariant: TexConstant.Variant.NORMAL}],
120+
'textbigcircle': ['\u25EF', {mathvariant: TexConstant.Variant.NORMAL}],
121+
'textblank': ['\u2422', {mathvariant: TexConstant.Variant.NORMAL}],
122+
'textbrokenbar': ['\u00A6', {mathvariant: TexConstant.Variant.NORMAL}],
123+
'textdiscount': ['\u2052', {mathvariant: TexConstant.Variant.NORMAL}],
124+
'textestimated': ['\u212E', {mathvariant: TexConstant.Variant.NORMAL}],
125+
'textinterrobang': ['\u203D', {mathvariant: TexConstant.Variant.NORMAL}],
126+
'textinterrobangdown': ['\u2E18', {mathvariant: TexConstant.Variant.NORMAL}],
127+
'textmusicalnote': ['\u266A', {mathvariant: TexConstant.Variant.NORMAL}],
128+
'textnumero': ['\u2116', {mathvariant: TexConstant.Variant.NORMAL}],
129+
'textopenbullet': ['\u25E6', {mathvariant: TexConstant.Variant.NORMAL}],
130+
'textpertenthousand': ['\u2031', {mathvariant: TexConstant.Variant.NORMAL}],
131+
'textperthousand': ['\u2030', {mathvariant: TexConstant.Variant.NORMAL}],
132+
'textrecipe': ['\u211E', {mathvariant: TexConstant.Variant.NORMAL}],
133+
'textreferencemark': ['\u203B', {mathvariant: TexConstant.Variant.NORMAL}],
134+
// 'textthreequartersemdash'
135+
// 'texttwelveudash'
136+
137+
// Table 51: textcomp Text-Mode Delimiters
138+
'textlangle': ['\u2329', {mathvariant: TexConstant.Variant.NORMAL}],
139+
'textrangle': ['\u232A', {mathvariant: TexConstant.Variant.NORMAL}],
140+
'textlbrackdbl': ['\u27E6', {mathvariant: TexConstant.Variant.NORMAL}],
141+
'textrbrackdbl': ['\u27E7', {mathvariant: TexConstant.Variant.NORMAL}],
142+
'textlquill': ['\u2045', {mathvariant: TexConstant.Variant.NORMAL}],
143+
'textrquill': ['\u2046', {mathvariant: TexConstant.Variant.NORMAL}],
144+
145+
// Table 62: textcomp Text-Mode Math and Science Symbols
146+
'textcelsius': ['\u2103', {mathvariant: TexConstant.Variant.NORMAL}],
147+
'textdegree': ['\u00B0', {mathvariant: TexConstant.Variant.NORMAL}],
148+
'textdiv': ['\u00F7', {mathvariant: TexConstant.Variant.NORMAL}],
149+
'textdownarrow': ['\u2193', {mathvariant: TexConstant.Variant.NORMAL}],
150+
'textfractionsolidus': ['\u2044', {mathvariant: TexConstant.Variant.NORMAL}],
151+
'textleftarrow': ['\u2190', {mathvariant: TexConstant.Variant.NORMAL}],
152+
'textlnot': ['\u00AC', {mathvariant: TexConstant.Variant.NORMAL}],
153+
'textmho': ['\u2127', {mathvariant: TexConstant.Variant.NORMAL}],
154+
'textminus': ['\u2212', {mathvariant: TexConstant.Variant.NORMAL}],
155+
'textmu': ['\u00B5', {mathvariant: TexConstant.Variant.NORMAL}],
156+
'textohm': ['\u2126', {mathvariant: TexConstant.Variant.NORMAL}],
157+
'textonehalf': ['\u00BD', {mathvariant: TexConstant.Variant.NORMAL}],
158+
'textonequarter': ['\u00BC', {mathvariant: TexConstant.Variant.NORMAL}],
159+
'textonesuperior': ['\u00B9', {mathvariant: TexConstant.Variant.NORMAL}],
160+
'textpm': ['\u00B1', {mathvariant: TexConstant.Variant.NORMAL}],
161+
'textrightarrow': ['\u2192', {mathvariant: TexConstant.Variant.NORMAL}],
162+
'textsurd': ['\u221A', {mathvariant: TexConstant.Variant.NORMAL}],
163+
'textthreequarters': ['\u00BE', {mathvariant: TexConstant.Variant.NORMAL}],
164+
'textthreesuperior': ['\u00B3', {mathvariant: TexConstant.Variant.NORMAL}],
165+
'texttimes': ['\u00D7', {mathvariant: TexConstant.Variant.NORMAL}],
166+
'texttwosuperior': ['\u00B2', {mathvariant: TexConstant.Variant.NORMAL}],
167+
'textuparrow': ['\u2191', {mathvariant: TexConstant.Variant.NORMAL}],
168+
169+
// Table 110: textcomp Genealogical Symbols
170+
'textborn': ['\u002A', {mathvariant: TexConstant.Variant.NORMAL}],
171+
'textdied': ['\u2020', {mathvariant: TexConstant.Variant.NORMAL}],
172+
'textdivorced': ['\u26AE', {mathvariant: TexConstant.Variant.NORMAL}],
173+
// 'textleaf'
174+
'textmarried': ['\u26AD', {mathvariant: TexConstant.Variant.NORMAL}]
175+
});

ts/input/tex/textmacros/TextMacrosConfiguration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export const TextMacrosConfiguration = Configuration.create('textmacros', {
114114
parseOptions.tags.configuration = parseOptions;
115115
//
116116
// Share the TeX input jax's parseOptions packageData object
117-
// so that require and other packagses will work in both parsers,
117+
// so that require and other packages will work in both parsers,
118118
// set the textmacros data (texParser will be filled in later),
119119
// and replace the internalMath function with our own.
120120
//

0 commit comments

Comments
 (0)