Skip to content

Commit

Permalink
support tex macros
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed Aug 28, 2021
1 parent 43d1ebd commit 6556598
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/mathjax/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,22 @@ export interface MathToSVGConfig {
* */
packages: string[],

/**
* tex macros
* http://docs.mathjax.org/en/latest/input/tex/extensions/configmacros.html#tex-configmacros-options
*/
macros: {
[cmd: string]: string | any[]
},

/**
* tex environments
* http://docs.mathjax.org/en/latest/input/tex/extensions/configmacros.html#tex-configmacros-options
*/
environments: {
[env: string]: any[]
},

/**
* output the required CSS rather than the SVG itself
* default: false
Expand Down Expand Up @@ -80,6 +96,8 @@ export const mathToSVGDefaultConfig = {
ex: 8,
width: 80 * 16,
packages: AllPackages,
macros: {},
environments: {},
//css: false,
fontCache: true,
enrichSpeech: 'deep',
Expand Down
2 changes: 2 additions & 0 deletions src/mathjax/MathjaxAdaptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ export default class MathjaxAdaptor {
packages: options.packages,
inlineMath: options.inlineMath,
displayMath: options.displayMath,
macros: options.macros,
environments: options.environments,
formatError: (jax: TeX<any, any, any>, err: TexError) => {
const math = jax.latex;
ERROR_MAP.set(math, err);
Expand Down

0 comments on commit 6556598

Please sign in to comment.