mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
MathJax: support euqation number
http://docs.mathjax.org/en/latest/tex.html#automatic-equation-numbering
This commit is contained in:
parent
a246b7abab
commit
f3ff862cfb
@ -85,7 +85,8 @@ var updateHtml = function(html) {
|
|||||||
// MathJax may be not loaded for now.
|
// MathJax may be not loaded for now.
|
||||||
if (VEnableMathjax && (typeof MathJax != "undefined")) {
|
if (VEnableMathjax && (typeof MathJax != "undefined")) {
|
||||||
try {
|
try {
|
||||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]);
|
MathJax.Hub.Queue(["resetEquationNumbers",MathJax.InputJax.TeX],
|
||||||
|
["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
content.setLog("err: " + err);
|
content.setLog("err: " + err);
|
||||||
finishOneAsyncJob();
|
finishOneAsyncJob();
|
||||||
|
@ -169,7 +169,8 @@ var updateText = function(text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, eles, postProcessMathJax]);
|
MathJax.Hub.Queue(["resetEquationNumbers",MathJax.InputJax.TeX],
|
||||||
|
["Typeset", MathJax.Hub, eles, postProcessMathJax]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
content.setLog("err: " + err);
|
content.setLog("err: " + err);
|
||||||
finishOneAsyncJob();
|
finishOneAsyncJob();
|
||||||
@ -254,7 +255,8 @@ var handleMathjaxReady = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, eles, postProcessMathJaxWhenMathjaxReady]);
|
MathJax.Hub.Queue(["resetEquationNumbers",MathJax.InputJax.TeX],
|
||||||
|
["Typeset", MathJax.Hub, eles, postProcessMathJaxWhenMathjaxReady]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
content.setLog("err: " + err);
|
content.setLog("err: " + err);
|
||||||
finishOneAsyncJob();
|
finishOneAsyncJob();
|
||||||
|
@ -72,7 +72,8 @@ var updateText = function(text) {
|
|||||||
// finishLoading logic.
|
// finishLoading logic.
|
||||||
if (VEnableMathjax) {
|
if (VEnableMathjax) {
|
||||||
try {
|
try {
|
||||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]);
|
MathJax.Hub.Queue(["resetEquationNumbers",MathJax.InputJax.TeX],
|
||||||
|
["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
content.setLog("err: " + err);
|
content.setLog("err: " + err);
|
||||||
finishOneAsyncJob();
|
finishOneAsyncJob();
|
||||||
|
@ -72,7 +72,8 @@ var previewMathJax = function(identifier, id, timeStamp, text, isHtml) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MathJax.Hub.Queue(["Typeset",
|
MathJax.Hub.Queue(["resetEquationNumbers",MathJax.InputJax.TeX],
|
||||||
|
["Typeset",
|
||||||
MathJax.Hub,
|
MathJax.Hub,
|
||||||
p,
|
p,
|
||||||
[postProcessMathJax, identifier, id, timeStamp, p, isBlock]]);
|
[postProcessMathJax, identifier, id, timeStamp, p, isBlock]]);
|
||||||
|
@ -117,7 +117,8 @@ var updateText = function(text) {
|
|||||||
// finishLoading logic.
|
// finishLoading logic.
|
||||||
if (VEnableMathjax) {
|
if (VEnableMathjax) {
|
||||||
try {
|
try {
|
||||||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]);
|
MathJax.Hub.Queue(["resetEquationNumbers",MathJax.InputJax.TeX],
|
||||||
|
["Typeset", MathJax.Hub, contentDiv, postProcessMathJax]);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
content.setLog("err: " + err);
|
content.setLog("err: " + err);
|
||||||
finishOneAsyncJob();
|
finishOneAsyncJob();
|
||||||
|
@ -796,6 +796,9 @@ QString VUtils::generateHtmlTemplate(const QString &p_template,
|
|||||||
" TeX: {\n"
|
" TeX: {\n"
|
||||||
" Macros: {\n"
|
" Macros: {\n"
|
||||||
" bm: [\"\\\\boldsymbol{#1}\", 1]\n"
|
" bm: [\"\\\\boldsymbol{#1}\", 1]\n"
|
||||||
|
" },\n"
|
||||||
|
" equationNumbers: {\n"
|
||||||
|
" autoNumber: \"AMS\"\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" messageStyle: \"none\"});\n"
|
" messageStyle: \"none\"});\n"
|
||||||
@ -885,27 +888,30 @@ QString VUtils::generateExportHtmlTemplate(const QString &p_renderBg,
|
|||||||
if (p_includeMathJax) {
|
if (p_includeMathJax) {
|
||||||
extra += "<script type=\"text/x-mathjax-config\">\n"
|
extra += "<script type=\"text/x-mathjax-config\">\n"
|
||||||
"MathJax.Hub.Config({\n"
|
"MathJax.Hub.Config({\n"
|
||||||
"showProcessingMessages: false,\n"
|
" showProcessingMessages: false,\n"
|
||||||
"messageStyle: \"none\",\n"
|
" messageStyle: \"none\",\n"
|
||||||
"SVG: {\n"
|
" SVG: {\n"
|
||||||
"minScaleAdjust: 100,\n"
|
" minScaleAdjust: 100,\n"
|
||||||
"styles: {\n"
|
" styles: {\n"
|
||||||
/*
|
/*
|
||||||
FIXME: Using wkhtmltopdf, without 2em, the math formula will be very small. However,
|
FIXME: Using wkhtmltopdf, without 2em, the math formula will be very small. However,
|
||||||
with 2em, if there are Chinese characters in it, the font will be a mess.
|
with 2em, if there are Chinese characters in it, the font will be a mess.
|
||||||
*/
|
*/
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
"\".MathJax_SVG\": {\n"
|
" \".MathJax_SVG\": {\n"
|
||||||
"\"font-size\": \"2em !important\"\n"
|
" \"font-size\": \"2em !important\"\n"
|
||||||
"}\n"
|
" }\n"
|
||||||
#endif
|
#endif
|
||||||
"}\n"
|
" }\n"
|
||||||
"},\n"
|
" },\n"
|
||||||
"TeX: {\n"
|
" TeX: {\n"
|
||||||
" Macros: {\n"
|
" Macros: {\n"
|
||||||
" bm: [\"\\\\boldsymbol{#1}\", 1]\n"
|
" bm: [\"\\\\boldsymbol{#1}\", 1]\n"
|
||||||
|
" },\n"
|
||||||
|
" equationNumbers: {\n"
|
||||||
|
" autoNumber: \"AMS\"\n"
|
||||||
|
" }\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n"
|
|
||||||
"});\n"
|
"});\n"
|
||||||
"</script>\n";
|
"</script>\n";
|
||||||
|
|
||||||
@ -969,6 +975,9 @@ QString VUtils::generateMathJaxPreviewTemplate()
|
|||||||
" TeX: {\n"
|
" TeX: {\n"
|
||||||
" Macros: {\n"
|
" Macros: {\n"
|
||||||
" bm: [\"\\\\boldsymbol{#1}\", 1]\n"
|
" bm: [\"\\\\boldsymbol{#1}\", 1]\n"
|
||||||
|
" },\n"
|
||||||
|
" equationNumbers: {\n"
|
||||||
|
" autoNumber: \"AMS\"\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
" },\n"
|
" },\n"
|
||||||
" messageStyle: \"none\"});\n"
|
" messageStyle: \"none\"});\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user