Skip to content

Commit 7a5dbdc

Browse files
authored
Merge pull request #1073 from mathjax/textcomp-textmacros
Make textcomp package register with textmacros automatically.
2 parents b869096 + a803e44 commit 7a5dbdc

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ts/input/tex/textcomp/TextcompConfiguration.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,19 @@
2525
import {Configuration} from '../Configuration.js';
2626
import './TextcompMappings.js';
2727

28+
Configuration.create('text-textcomp', {
29+
parser: 'text',
30+
handler: {macro: ['textcomp-macros']}
31+
});
2832

2933
export const TextcompConfiguration = Configuration.create(
3034
'textcomp', {
31-
handler: {macro: ['textcomp-macros']}
35+
handler: {macro: ['textcomp-macros']},
36+
config(_config, jax) {
37+
const {textConf, parseOptions} = jax.parseOptions.packageData.get('textmacros');
38+
parseOptions.options.textmacros.packages.push('text-textcomp');
39+
textConf.add('text-textcomp', jax, {});
40+
}
3241
}
3342
);
3443

ts/input/tex/textmacros/TextMacrosConfiguration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import './TextMacrosMappings.js';
3939
*/
4040
export const TextBaseConfiguration = Configuration.create('text-base', {
4141
parser: 'text',
42+
priority: 1,
4243
handler: {
4344
character: ['command', 'text-special'],
4445
macro: ['text-macros']
@@ -96,6 +97,7 @@ function internalMath(parser: TexParser, text: string, level?: number | string,
9697
// The textmacros package configuration
9798
//
9899
export const TextMacrosConfiguration = Configuration.create('textmacros', {
100+
priority: 1,
99101
/**
100102
* @param {ParserConfiguration} config The configuration object we are being configured within
101103
* @param {TeX<any,any,any>} jax The TeX input jax in which we are running
@@ -120,7 +122,7 @@ export const TextMacrosConfiguration = Configuration.create('textmacros', {
120122
// and replace the internalMath function with our own.
121123
//
122124
parseOptions.packageData = jax.parseOptions.packageData;
123-
parseOptions.packageData.set('textmacros', {parseOptions, jax, texParser: null});
125+
parseOptions.packageData.set('textmacros', {textConf, parseOptions, jax, texParser: null});
124126
parseOptions.options.internalMath = internalMath;
125127
},
126128
preprocessors: [(data: {data: ParseOptions}) => {

0 commit comments

Comments
 (0)