mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-07 20:28:38 +00:00
Support \bgroup and \egroup
This commit is contained in:
@@ -8,6 +8,13 @@ function defineMacro(name, body) {
|
|||||||
module.exports[name] = body;
|
module.exports[name] = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// basics
|
||||||
|
defineMacro("\\bgroup", "{");
|
||||||
|
defineMacro("\\egroup", "}");
|
||||||
|
defineMacro("\\begingroup", "{");
|
||||||
|
defineMacro("\\endgroup", "}");
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// amsmath.sty
|
// amsmath.sty
|
||||||
|
|
||||||
|
BIN
test/screenshotter/images/GroupMacros-chrome.png
Normal file
BIN
test/screenshotter/images/GroupMacros-chrome.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
test/screenshotter/images/GroupMacros-firefox.png
Normal file
BIN
test/screenshotter/images/GroupMacros-firefox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
@@ -26,5 +26,8 @@ for (var key in dict) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
itm.query = querystring.stringify(query);
|
itm.query = querystring.stringify(query);
|
||||||
|
if (itm.macros) {
|
||||||
|
itm.query += "&" + querystring.stringify(itm.macros);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = dict;
|
module.exports = dict;
|
||||||
|
@@ -74,6 +74,11 @@ Exponents: a^{a^a_a}_{a^a_a}
|
|||||||
FractionTest: \dfrac{a}{b}\frac{a}{b}\tfrac{a}{b}\;-\dfrac12\;1\tfrac12\;{1 \atop 2}
|
FractionTest: \dfrac{a}{b}\frac{a}{b}\tfrac{a}{b}\;-\dfrac12\;1\tfrac12\;{1 \atop 2}
|
||||||
Functions: \sin\cos\tan\ln\log
|
Functions: \sin\cos\tan\ln\log
|
||||||
GreekLetters: \alpha\beta\gamma\omega
|
GreekLetters: \alpha\beta\gamma\omega
|
||||||
|
GroupMacros:
|
||||||
|
macros:
|
||||||
|
\startExp: e^\bgroup
|
||||||
|
\endExp: \egroup
|
||||||
|
tex: \startExp a+b\endExp
|
||||||
KaTeX: \KaTeX
|
KaTeX: \KaTeX
|
||||||
Kern:
|
Kern:
|
||||||
tex: \frac{a\kern{1em}b}{c}a\kern{1em}b\kern{1ex}c\kern{-0.25em}d
|
tex: \frac{a\kern{1em}b}{c}a\kern{1em}b\kern{1ex}c\kern{-0.25em}d
|
||||||
|
@@ -47,6 +47,12 @@
|
|||||||
if (query["errorColor"]) {
|
if (query["errorColor"]) {
|
||||||
settings.errorColor = query["errorColor"];
|
settings.errorColor = query["errorColor"];
|
||||||
}
|
}
|
||||||
|
var macros = {};
|
||||||
|
var macroRegex = /(?:^\?|&)(?:\\|%5[Cc])([A-Za-z]+)=([^&]*)/g;
|
||||||
|
while ((match = macroRegex.exec(window.location.search)) !== null) {
|
||||||
|
settings.macros = macros;
|
||||||
|
macros["\\" + match[1]] = decodeURIComponent(match[2]);
|
||||||
|
}
|
||||||
|
|
||||||
katex.render(query["tex"], mathNode, settings);
|
katex.render(query["tex"], mathNode, settings);
|
||||||
document.getElementById("pre").innerHTML = query["pre"] || "";
|
document.getElementById("pre").innerHTML = query["pre"] || "";
|
||||||
|
Reference in New Issue
Block a user