mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-08 04:28:41 +00:00
Support \gdef in multiple equations in auto-render (#1425)
Within a single call to `renderMathInElement`, default `macros` to a shared empty object (same as if you specified an object) so that global macros defined via `\gdef` can be defined and shared.
This commit is contained in:
@@ -101,6 +101,13 @@ const renderMathInElement = function(elem, options) {
|
||||
}
|
||||
|
||||
const optionsCopy = Object.assign({}, defaultAutoRenderOptions, options);
|
||||
|
||||
// Enable sharing of global macros defined via `\gdef` between different
|
||||
// math elements within a single call to `renderMathInElement`.
|
||||
if (!optionsCopy.macros) {
|
||||
optionsCopy.macros = {};
|
||||
}
|
||||
|
||||
renderElem(elem, optionsCopy);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user