Skip to content

Commit c867d60

Browse files
Omikhleiaalerque
authored andcommitted
feat(math): Add mathcal, mathbb and similar commands in TeX-like math
1 parent 803d699 commit c867d60

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

packages/math/texlike.lua

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,21 @@ compileToMathML(
544544
\def{Phi}{\mi[mathvariant=normal]{Φ}}
545545
\def{Psi}{\mi[mathvariant=normal]{Ψ}}
546546
\def{Omega}{\mi[mathvariant=normal]{Ω}}
547+
% Some calligraphic (script), fraktur, double-struck styles:
548+
% Convenience for compatibility with LaTeX.
549+
\def{mathcal}{\mi[mathvariant=script]{#1}}
550+
\def{mathfrak}{\mi[mathvariant=fraktur]{#1}}
551+
\def{mathbb}{\mi[mathvariant=double-struck]{#1}}
552+
% Some style-switching commands for compatibility with LaTeX math.
553+
% Caveat emptor: LaTeX would allow these to apply to a whole formula.
554+
% We can't do that in MathML, as mathvariant applies to token elements only.
555+
% Also note that LaTeX and related packages may have many more such commands.
556+
% We only provide a few common ('historical') ones here.
557+
\def{mathrm}{\mi[mathvariant=normal]{#1}}
558+
\def{mathbf}{\mi[mathvariant=bold]{#1}}
559+
\def{mathit}{\mi[mathvariant=italic]{#1}}
560+
\def{mathsf}{\mi[mathvariant=sans-serif]{#1}}
561+
\def{mathtt}{\mi[mathvariant=monospace]{#1}}
547562
548563
% Modulus operator forms
549564
\def{bmod}{\mo{mod}}

0 commit comments

Comments
 (0)