@@ -51,10 +51,10 @@ const MJCONFIG = (global.MathJax ? global.MathJax.config || {} : {});
5151 * @param {string } name The name of the extension being added (e.g., '[tex]/amsCd')
5252 */
5353function RegisterExtension ( jax : TeX < any , any , any > , name : string ) {
54- const required = jax . parseOptions . options . require . required ;
55- if ( required . indexOf ( name ) < 0 ) {
56- const extension = name . substr ( 6 ) ;
57- required . push ( name ) ;
54+ const require = jax . parseOptions . options . require ;
55+ const extension = name . substr ( require . prefix . length ) ;
56+ if ( require . required . indexOf ( extension ) < 0 ) {
57+ require . required . push ( extension ) ;
5858 //
5959 // Register any dependencies that were loaded to handle this one
6060 //
@@ -122,8 +122,8 @@ export function RequireLoad(parser: TexParser, name: string) {
122122 */
123123function config ( config : Configuration , jax : TeX < any , any , any > ) {
124124 const options = jax . parseOptions . options . require ;
125- options . jax = jax ; // \require needs access to this
126- options . required = [ ] ; // stores the names of the packages that have been added
125+ options . jax = jax ; // \require needs access to this
126+ options . required = [ ... jax . options . packages ] ; // stores the names of the packages that have been added
127127 const prefix = options . prefix ;
128128 if ( prefix . match ( / [ ^ _ a - z A - Z 0 - 9 ] / ) ) {
129129 throw Error ( 'Illegal characters used in \\require prefix' ) ;
0 commit comments