Skip to content

Commit 215a1e7

Browse files
committed
Disabling Mathjax 4 packages
With Mathjax version 4 quite a few packages are automatically loaded, though this can lead to inconstancies with, the default use of, older versions Mathjax versions. An example of this is the use of the `_` inside `\text` (the default Mathjax 4 behavior is the same as with regular LaTeX, see also doxygen#11705 (comment)), by disabling the `textmacros` the old behavior can be obtained again (see also https://docs.mathjax.org/en/latest/upgrading/whats-new-4.0/input.html#textmacros-enabled-by-default) which is also valide for the underscore handling inside the `\text`. By prepending a `-` (minus sign) to the package name in the `MATHJAX_EXTENSIONS` the package will be disabled.
1 parent fe93d84 commit 215a1e7

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/htmlgen.cpp

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,16 @@ static QCString substituteHtmlKeywords(const QCString &file,
482482
for (const auto &s : mathJaxExtensions)
483483
{
484484
if (!first) mathJaxJs+= ",";
485-
mathJaxJs+= "\n '[+]': ['"+s+"']";
485+
if (s.at(0) =='-')
486+
{
487+
mathJaxJs+= "\n '[-]': ['";
488+
mathJaxJs+=s.data()+1;
489+
mathJaxJs+="']";
490+
}
491+
else
492+
{
493+
mathJaxJs+= "\n '[+]': ['"+s+"']";
494+
}
486495
first = false;
487496
}
488497
mathJaxJs += "\n }\n";
@@ -510,9 +519,12 @@ static QCString substituteHtmlKeywords(const QCString &file,
510519
" load: [";
511520
for (const auto &s : mathJaxExtensions)
512521
{
513-
if (!first) mathJaxJs+= ",";
514-
mathJaxJs+= "'[tex]/"+s+"'";
515-
first = false;
522+
if (s.at(0) !='-')
523+
{
524+
if (!first) mathJaxJs+= ",";
525+
mathJaxJs+= "'[tex]/"+s+"'"; // packages preceded by a minus sign should not be loaded
526+
first = false;
527+
}
516528
}
517529
mathJaxJs+= "]\n"
518530
" },\n";

0 commit comments

Comments
 (0)