Problem
Hello, thanks for providing mdbook with MathJax support! I noticed an issue with rendering formulas in MathJax versions prior to 2.7.5. Alphabetic characters in formulas are not rendered as italic as expected.
Specifically, the character U+03B3 (Greek small letter gamma) is not rendered in italic fonts in MathJax 2.7.1 and 2.7.4, but it works fine in MathJax 2.7.5.
Environment:
- MacOS M2 Tahoe 26.1 (I just found this issue does not exist on my phone)
- mdbook 0.5.1
- Microsoft Edge 142.0.3595.94 arm64 (the latest official version)
Rendered HTML by MathJax for the formula \\( \gamma \\) ($\gamma$) is as follows:
-
MathJax 2.7.1 (Current default):
<span
class="mi"
id="MathJax-Span-22"
style="font-family: STIXGeneral-Italic; padding-left: 0.305em;"
>γ<span
style="display: inline-block; overflow: hidden; height: 1px; width: 0.053em;"
></span
></span>
γ
-
MathJax 2.7.4 (still not rendering correctly):
<span
class="mi"
id="MathJax-Span-22"
style="font-family: STIXGeneral-Italic; padding-left: 0.305em;"
>γ<span
style="display: inline-block; overflow: hidden; height: 1px; width: 0.053em;"
></span
></span>
γ
-
MathJax 2.7.5 (fixes the issue):
<span
class="mi"
id="MathJax-Span-22"
style="font-family: STIXGeneral-Italic; padding-left: 0.305em;"
>𝛾<span
style="display: inline-block; overflow: hidden; height: 1px; width: 0.053em;"
></span
></span>
𝛾
Screenshots of the formula below in different MathJax versions are attached for reference:
\\[
\\alpha_i + \\beta_i = \\gamma
\\]
\\[
G_{\\mu\\nu} + \\lambda g_{\\mu\\nu} = \\frac{8 \\pi G}{c^4} T_{\\mu\\nu}
\\]
-
MathJax 2.7.1:
-
MathJax 2.7.4:
-
MathJax 2.7.5:
Proposed Solution
Though it's enough to update the default MathJax version (and users can also modify MathJax version by using the theme hack), I guess it's great to add configurable MathJax support and pick up some previous PRs (for example, #1918, #2285 and #2069). For example, we can have a new configuration item as below:
[output.html.mathjax]
# Specify the MathJax version. However I'm not sure if we should check whether the version exists
version = "*.*.*"
# Or even specify the MathJax URL.
src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
And if a new PR is appreciated, I'm glad to work on it.
Notes
No response
Problem
Hello, thanks for providing
mdbookwith MathJax support! I noticed an issue with rendering formulas in MathJax versions prior to2.7.5. Alphabetic characters in formulas are not rendered as italic as expected.Specifically, the character U+03B3 (Greek small letter gamma) is not rendered in italic fonts in
MathJax 2.7.1and2.7.4, but it works fine inMathJax 2.7.5.Environment:
Rendered HTML by MathJax for the formula$\gamma$ ) is as follows:
\\( \gamma \\)(MathJax 2.7.1(Current default):γ
MathJax 2.7.4(still not rendering correctly):γ
MathJax 2.7.5(fixes the issue):𝛾
Screenshots of the formula below in different MathJax versions are attached for reference:
MathJax 2.7.1:MathJax 2.7.4:MathJax 2.7.5:Proposed Solution
Though it's enough to update the default MathJax version (and users can also modify MathJax version by using the
themehack), I guess it's great to add configurable MathJax support and pick up some previous PRs (for example, #1918, #2285 and #2069). For example, we can have a new configuration item as below:And if a new PR is appreciated, I'm glad to work on it.
Notes
No response