Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the bboldx package. #1056

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions components/mjs/input/tex/extensions/bboldx/bboldx.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import './lib/bboldx.js';
import {MathJax, combineDefaults} from 'mathjax-full/js/components/global.js';

const FONTPATH = (typeof document === 'undefined' ?
'@mathjax/mathjax-bboldx-font-extension' :
'https://cdn.jsdelivr.net/npm/mathjax-bboldx-font-extension');

if (MathJax.config?.loader) {
combineDefaults(MathJax.config.loader, 'paths', {
'mathjax-bboldx-extension': FONTPATH
});
MathJax.config.loader['[tex]/bboldx'] = {
checkReady() {
return MathJax.loader.load(`[mathjax-bboldx-extension]/${MathJax.config?.startup?.output || 'chtml'}`);
}
};
}
14 changes: 14 additions & 0 deletions components/mjs/input/tex/extensions/bboldx/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"build": {
"id": "[tex]//bboldx",
"component": "input/tex/extensions//bboldx",
"targets": ["input/tex//bboldx"]
},
"webpack": {
"name": "input/tex/extensions/bboldx",
"libs": [
"components/src/input/tex-base/lib",
"components/src/core/lib"
]
}
}
62 changes: 62 additions & 0 deletions ts/input/tex/bboldx/BboldxConfiguration.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*************************************************************
*
* Copyright (c) 2017-2023 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


/**
* @fileoverview The bboldx package.
*
* @author [email protected] (Volker Sorge)
*/

import {Configuration} from '../Configuration.js';
import './BboldxMappings.js';

/**
* Configuration for the text macros of this package. They are automatically
* available, when the textmacros package is loaded.
*/
Configuration.create('text-bboldx', {
parser: 'text',
handler: {
macro: ['text-bboldx', 'text-bboldx-mathchar0miNormal', 'text-bboldx-delimiterNormal',
'text-bboldx-mathchar0miBold', 'text-bboldx-delimiterBold'],
delimiter: ['text-bboldx-delimiterNormal', 'text-bboldx-delimiterBold'],
}
});

//
// Define the package configuration, including switches for light and always
// bold bb.
//
export const BboldxConfiguration = Configuration.create('bboldx', {
handler: {
macro: ['bboldx', 'bboldx-mathchar0miNormal', 'bboldx-delimiterNormal',
'bboldx-mathchar0miBold', 'bboldx-delimiterBold'],
delimiter: ['bboldx-delimiterNormal', 'bboldx-delimiterBold'],
},
options: {
bboldx: {
bfbb: false,
light: false
},
// add text macros by default to textmacros
textmacros: {
packages: {'[+]': ['text-bboldx']}
}
Comment on lines +56 to +59
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interesting approach, and I'm trying to decide if I like it or not. We don't do this for textcomp, and I think it should probably consistent, one way or the other. We do require people to no only load a package but actually add it to the tex.packages configuration as well, so I'm not sure why it is right to add to the textmacros packages automatically. Perhaps we should discuss it in our next meeting.

}
});

270 changes: 270 additions & 0 deletions ts/input/tex/bboldx/BboldxMappings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,270 @@
/*************************************************************
*
* Copyright (c) 2017-2024 The MathJax Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/


/**
* @fileoverview Symbol mappings for the bboldx package.
*
* @author [email protected] (Volker Sorge)
*/

import {CommandMap, CharacterMap, DelimiterMap} from '../TokenMap.js';
import {BboldxMethods} from './BboldxMethods.js';

/**
* Bb symbols macros for bboldx package.
*/
new CharacterMap('bboldx-mathchar0miNormal', BboldxMethods.mathchar0miNormal, {
// Upper Case Greek
bbGamma: '\u0393',
bbDelta: '\u2206',
bbTheta: '\u0398',
bbLambda: '\u039B',
bbXi: '\u039E',
bbPi: '\u03A0',
bbSigma: '\u03A3',
bbUpsilon: '\u03A5',
bbPhi: '\u03A6',
bbPsi: '\u03A8',
bbOmega: '\u2126',
// Lower Case Greek
bbalpha: '\u03B1',
bbbeta: '\u03B2',
bbgamma: '\u03B3',
bbdelta: '\u03B4',
bbepsilon: '\u03B5',
bbzeta: '\u03B6',
bbeta: '\u03B7',
bbtheta: '\u03B8',
bbiota: '\u03B9',
bbkappa: '\u03BA',
bblambda: '\u03BB',
bbmu: '\u00B5',
bbnu: '\u03BD',
bbxi: '\u03BE',
bbpi: '\u03C0',
bbrho: '\u03C1',
bbsigma: '\u03C3',
bbtau: '\u03C4',
bbupsilon: '\u03C5',
bbphi: '\u03C6',
bbchi: '\u03C7',
bbpsi: '\u03C8',
bbomega: '\u03C9',
bbdotlessi: '\u0131',
bbdotlessj: '\u0237',
});

/**
* Macros for delimiters.
*/
new DelimiterMap('bboldx-delimiterNormal', BboldxMethods.delimiterNormal, {
'\\bbLparen': '\u0028',
'\\bbRparen': '\u0029',
'\\bbLbrack': '\u005B',
'\\bbRbrack': '\u005D',
'\\bbLangle': '\u2329',
'\\bbRangle': '\u232A',
});

/**
* Bb symbols macros for bboldx package.
*/
new CharacterMap('bboldx-mathchar0miBold', BboldxMethods.mathchar0miBold, {
// Upper Case Greek
bfbbGamma: '\u0393',
bfbbDelta: '\u2206',
bfbbTheta: '\u0398',
bfbbLambda: '\u039B',
bfbbXi: '\u039E',
bfbbPi: '\u03A0',
bfbbSigma: '\u03A3',
bfbbUpsilon: '\u03A5',
bfbbPhi: '\u03A6',
bfbbPsi: '\u03A8',
bfbbOmega: '\u2126',
// Lower Case Greek
bfbbalpha: '\u03B1',
bfbbbeta: '\u03B2',
bfbbgamma: '\u03B3',
bfbbdelta: '\u03B4',
bfbbepsilon: '\u03B5',
bfbbzeta: '\u03B6',
bfbbeta: '\u03B7',
bfbbtheta: '\u03B8',
bfbbiota: '\u03B9',
bfbbkappa: '\u03BA',
bfbblambda: '\u03BFBB',
bfbbmu: '\u00B5',
bfbbnu: '\u03BD',
bfbbxi: '\u03BE',
bfbbpi: '\u03C0',
bfbbrho: '\u03C1',
bfbbsigma: '\u03C3',
bfbbtau: '\u03C4',
bfbbupsilon: '\u03C5',
bfbbphi: '\u03C6',
bfbbchi: '\u03C7',
bfbbpsi: '\u03C8',
bfbbomega: '\u03C9',
bfbbdotlessi: '\u0131',
bfbbdotlessj: '\u0237',
});

/**
* Macros for delimiters.
*/
new DelimiterMap('bboldx-delimiterBold', BboldxMethods.delimiterBold, {
'\\bfbbLparen': '\u0028',
'\\bfbbRparen': '\u0029',
'\\bfbbLbrack': '\u005B',
'\\bfbbRbrack': '\u005D',
'\\bfbbLangle': '\u2329',
'\\bfbbRangle': '\u232A',
});

new CommandMap('bboldx', {
mathbb: ['ChooseFont', '-bboldx', '-bboldx-light', '-bboldx-bold'],
mathbfbb: ['ChooseFont', '-bboldx-bold', '-bboldx', '-bboldx-bold'],
imathbb: ['Macro', '\\bbdotlessi'],
jmathbb: ['Macro', '\\bbdotlessj'],
imathbfbb: ['Macro', '\\bfbbdotlessi'],
jmathbfbb: ['Macro', '\\bfbbdotlessj'],
}, BboldxMethods);

// Text Macros.
/**
* Bb symbols macros for text-bboldx package.
*/
new CharacterMap('text-bboldx-mathchar0miNormal', BboldxMethods.mathchar0miNormal, {
// Upper Case Greek
txtbbGamma: '\u0393',
txtbbDelta: '\u2206',
txtbbTheta: '\u0398',
txtbbLambda: '\u039B',
txtbbXi: '\u039E',
txtbbPi: '\u03A0',
txtbbSigma: '\u03A3',
txtbbUpsilon: '\u03A5',
txtbbPhi: '\u03A6',
txtbbPsi: '\u03A8',
txtbbOmega: '\u2126',
// Lower Case Greek
txtbbalpha: '\u03B1',
txtbbbeta: '\u03B2',
txtbbgamma: '\u03B3',
txtbbdelta: '\u03B4',
txtbbepsilon: '\u03B5',
txtbbzeta: '\u03B6',
txtbbeta: '\u03B7',
txtbbtheta: '\u03B8',
txtbbiota: '\u03B9',
txtbbkappa: '\u03BA',
txtbblambda: '\u03BB',
txtbbmu: '\u00B5',
txtbbnu: '\u03BD',
txtbbxi: '\u03BE',
txtbbpi: '\u03C0',
txtbbrho: '\u03C1',
txtbbsigma: '\u03C3',
txtbbtau: '\u03C4',
txtbbupsilon: '\u03C5',
txtbbphi: '\u03C6',
txtbbchi: '\u03C7',
txtbbpsi: '\u03C8',
txtbbomega: '\u03C9',
txtbbdotlessi: '\u0131',
txtbbdotlessj: '\u0237',
});

/**
* Macros for delimiters.
*/
new DelimiterMap('text-bboldx-delimiterNormal', BboldxMethods.delimiterNormal, {
'\\txtbbLparen': '\u0028',
'\\txtbbRparen': '\u0029',
'\\txtbbLbrack': '\u005B',
'\\txtbbRbrack': '\u005D',
'\\txtbbLangle': '\u2329',
'\\txtbbRangle': '\u232A',
});

/**
* Bb symbols macros for text-bboldx package.
*/
new CharacterMap('text-bboldx-mathchar0miBold', BboldxMethods.mathchar0miBold, {
// Upper Case Greek
txtbfbbGamma: '\u0393',
txtbfbbDelta: '\u2206',
txtbfbbTheta: '\u0398',
txtbfbbLambda: '\u039B',
txtbfbbXi: '\u039E',
txtbfbbPi: '\u03A0',
txtbfbbSigma: '\u03A3',
txtbfbbUpsilon: '\u03A5',
txtbfbbPhi: '\u03A6',
txtbfbbPsi: '\u03A8',
txtbfbbOmega: '\u2126',
// Lower Case Greek
txtbfbbalpha: '\u03B1',
txtbfbbbeta: '\u03B2',
txtbfbbgamma: '\u03B3',
txtbfbbdelta: '\u03B4',
txtbfbbepsilon: '\u03B5',
txtbfbbzeta: '\u03B6',
txtbfbbeta: '\u03B7',
txtbfbbtheta: '\u03B8',
txtbfbbiota: '\u03B9',
txtbfbbkappa: '\u03BA',
txtbfbblambda: '\u03BB',
txtbfbbmu: '\u00B5',
txtbfbbnu: '\u03BD',
txtbfbbxi: '\u03BE',
txtbfbbpi: '\u03C0',
txtbfbbrho: '\u03C1',
txtbfbbsigma: '\u03C3',
txtbfbbtau: '\u03C4',
txtbfbbupsilon: '\u03C5',
txtbfbbphi: '\u03C6',
txtbfbbchi: '\u03C7',
txtbfbbpsi: '\u03C8',
txtbfbbomega: '\u03C9',
txtbfbbdotlessi: '\u0131',
txtbfbbdotlessj: '\u0237',
});

/**
* Macros for delimiters.
*/
new DelimiterMap('text-bboldx-delimiterBold', BboldxMethods.delimiterBold, {
'\\txtbfbbLparen': '\u0028',
'\\txtbfbbRparen': '\u0029',
'\\txtbfbbLbrack': '\u005B',
'\\txtbfbbRbrack': '\u005D',
'\\txtbfbbLangle': '\u2329',
'\\txtbfbbRangle': '\u232A',
});

new CommandMap('text-bboldx', {
textbb: ['ChooseTextFont', '-bboldx', '-bboldx-light', '-bboldx-bold'],
textbfbb: ['ChooseTextFont', '-bboldx-bold', '-bboldx', '-bboldx-bold'],
itextbb: ['Macro', '\\txtbbdotlessi'],
jtextbb: ['Macro', '\\txtbbdotlessj'],
itextbfbb: ['Macro', '\\txtbfbbdotlessi'],
jtextbfbb: ['Macro', '\\txtbfbbdotlessj'],
}, BboldxMethods);

Loading