Skip to content

Commit b51b78a

Browse files
committed
add U+FE00, U+FE01 variant selectors for respectively caligraphic and script styles
1 parent 37248ca commit b51b78a

File tree

3 files changed

+83
-20
lines changed

3 files changed

+83
-20
lines changed

lib/LaTeXML/Post/MathML.pm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ my %default_token_content = (
643643
# Remaps some mathvariants to a simpler subset of Unicode
644644
my %plane1hackable = ( # CONSTANT
645645
script => 'script',
646+
caligraphic => 'caligraphic',
646647
'bold-script' => 'script',
647648
fraktur => 'fraktur',
648649
'bold-fraktur' => 'fraktur',
@@ -721,6 +722,8 @@ sub stylizeContent {
721722
# Use class (css) to patchup some weak translations
722723
if (!$font) { }
723724
elsif ($font =~ /caligraphic/) {
725+
# caligraphic is not a true mathvariant (see Unicode.pm), reset to script
726+
$variant =~ s/caligraphic/script/;
724727
# Note that this is unlikely to have effect when plane1 chars are used!
725728
$class = ($class ? $class . ' ' : '') . 'ltx_font_mathcaligraphic'; }
726729
elsif ($font =~ /script/) {

lib/LaTeXML/Util/Unicode.pm

Lines changed: 79 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,69 @@ my %unicode_map = ( # CONSTANT
5858
'sans-serif-italic' => { makePlane1Map(0x1D608, undef, undef, undef) },
5959
'sans-serif-bold-italic' => { makePlane1Map(0x1D63C, 0x1D790, 0x1D7AA, undef) },
6060
'monospace' => { makePlane1Map(0x1D670, undef, undef, 0x1D7F6) },
61-
'script' => { makePlane1Map(0x1D49C, undef, undef, undef),
62-
B => "\x{212C}", E => "\x{2130}", F => "\x{2131}", H => "\x{210B}", I => "\x{2110}",
63-
L => "\x{2112}", M => "\x{2133}", R => "\x{211B}",
64-
e => "\x{212F}", g => "\x{210A}", o => "\x{2134}" },
61+
# since Unicode 14, capital script characters admit two variant selectors
62+
# - U+FE00 for chancery style (caligraphic)
63+
# - U+FE01 for roundhand style (script)
64+
'script' => { makePlane1Map(0x1D49C, undef, undef, undef),
65+
A => "\x{1D49C}\x{FE01}",
66+
B => "\x{212C}\x{FE01}",
67+
C => "\x{1D49E}\x{FE01}",
68+
D => "\x{1D49F}\x{FE01}",
69+
E => "\x{2130}\x{FE01}",
70+
F => "\x{2131}\x{FE01}",
71+
G => "\x{1D4A2}\x{FE01}",
72+
H => "\x{210B}\x{FE01}",
73+
I => "\x{2110}\x{FE01}",
74+
J => "\x{1D4A5}\x{FE01}",
75+
K => "\x{1D4A6}\x{FE01}",
76+
L => "\x{2112}\x{FE01}",
77+
M => "\x{2133}\x{FE01}",
78+
N => "\x{1D4A9}\x{FE01}",
79+
O => "\x{1D4AA}\x{FE01}",
80+
P => "\x{1D4AB}\x{FE01}",
81+
Q => "\x{1D4AC}\x{FE01}",
82+
R => "\x{211B}\x{FE01}",
83+
S => "\x{1D4AE}\x{FE01}",
84+
T => "\x{1D4AF}\x{FE01}",
85+
U => "\x{1D4B0}\x{FE01}",
86+
V => "\x{1D4B1}\x{FE01}",
87+
W => "\x{1D4B2}\x{FE01}",
88+
X => "\x{1D4B3}\x{FE01}",
89+
Y => "\x{1D4B4}\x{FE01}",
90+
Z => "\x{1D4B5}\x{FE01}",
91+
e => "\x{212F}",
92+
g => "\x{210A}",
93+
o => "\x{2134}" },
94+
'caligraphic' => { makePlane1Map(0x1D49C, undef, undef, undef),
95+
A => "\x{1D49C}\x{FE00}",
96+
B => "\x{212C}\x{FE00}",
97+
C => "\x{1D49E}\x{FE00}",
98+
D => "\x{1D49F}\x{FE00}",
99+
E => "\x{2130}\x{FE00}",
100+
F => "\x{2131}\x{FE00}",
101+
G => "\x{1D4A2}\x{FE00}",
102+
H => "\x{210B}\x{FE00}",
103+
I => "\x{2110}\x{FE00}",
104+
J => "\x{1D4A5}\x{FE00}",
105+
K => "\x{1D4A6}\x{FE00}",
106+
L => "\x{2112}\x{FE00}",
107+
M => "\x{2133}\x{FE00}",
108+
N => "\x{1D4A9}\x{FE00}",
109+
O => "\x{1D4AA}\x{FE00}",
110+
P => "\x{1D4AB}\x{FE00}",
111+
Q => "\x{1D4AC}\x{FE00}",
112+
R => "\x{211B}\x{FE00}",
113+
S => "\x{1D4AE}\x{FE00}",
114+
T => "\x{1D4AF}\x{FE00}",
115+
U => "\x{1D4B0}\x{FE00}",
116+
V => "\x{1D4B1}\x{FE00}",
117+
W => "\x{1D4B2}\x{FE00}",
118+
X => "\x{1D4B3}\x{FE00}",
119+
Y => "\x{1D4B4}\x{FE00}",
120+
Z => "\x{1D4B5}\x{FE00}",
121+
e => "\x{212F}",
122+
g => "\x{210A}",
123+
o => "\x{2134}" },
65124
'bold-script' => { makePlane1Map(0x1D4D0, undef, undef, undef) },
66125
'fraktur' => { makePlane1Map(0x1D504, undef, undef, undef),
67126
C => "\x{212D}", H => "\x{210C}", I => "\x{2111}", R => "\x{211C}", Z => "\x{2128}" },
@@ -217,25 +276,25 @@ my %mathvariants = ( # CONSTANT
217276
'bold italic' => 'bold-italic',
218277
'doublestruck' => 'double-struck',
219278
'blackboard' => 'double-struck',
220-
'blackboard bold' => 'double-struck', # all collapse
221-
'blackboard upright' => 'double-struck', # all collapse
222-
'blackboard bold upright' => 'double-struck', # all collapse
279+
'blackboard bold' => 'double-struck', # all collapse
280+
'blackboard upright' => 'double-struck', # all collapse
281+
'blackboard bold upright' => 'double-struck', # all collapse
223282
'fraktur' => 'fraktur',
224-
'fraktur italic' => 'fraktur', # all collapse
283+
'fraktur italic' => 'fraktur', # all collapse
225284
'fraktur bold' => 'bold-fraktur',
226285
'script' => 'script',
227-
'script italic' => 'script', # all collapse
286+
'script italic' => 'script', # all collapse
228287
'script bold' => 'bold-script',
229-
'caligraphic' => 'script', # NOTE: TeX caligraphic is NOT script!
230-
'caligraphic bold' => 'bold-script', # collapse
231-
'sansserif' => 'sans-serif',
232-
'sansserif bold' => 'bold-sans-serif',
233-
'sansserif italic' => 'sans-serif-italic',
234-
'sansserif bold italic' => 'sans-serif-bold-italic',
235-
'typewriter' => 'monospace',
236-
'typewriter bold' => 'monospace',
237-
'typewriter italic' => 'monospace',
238-
'typewriter bold italic' => 'monospace',
288+
'caligraphic' => 'caligraphic', # not a true mathvariant, supported via Unicode variation sequences
289+
'caligraphic bold' => 'bold-script', # collapse (NOTE: TeX caligraphic is NOT script!)
290+
'sansserif' => 'sans-serif',
291+
'sansserif bold' => 'bold-sans-serif',
292+
'sansserif italic' => 'sans-serif-italic',
293+
'sansserif bold italic' => 'sans-serif-bold-italic',
294+
'typewriter' => 'monospace',
295+
'typewriter bold' => 'monospace',
296+
'typewriter italic' => 'monospace',
297+
'typewriter bold italic' => 'monospace',
239298
);
240299

241300
# The font differences (from the containing context) have been deciphered
@@ -310,6 +369,7 @@ C<sans-serif-italic>,
310369
C<sans-serif-bold-italic>,
311370
C<monospace>,
312371
C<script>,
372+
C<caligraphic>,
313373
C<bold-script>,
314374
C<fraktur>,
315375
C<bold-fraktur>,

t/daemon/formats/mixedmath.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
<tbody><tr class="ltx_equation ltx_eqn_row ltx_align_baseline">
6767
<td class="ltx_eqn_cell ltx_eqn_center_padleft"/>
68-
<td class="ltx_eqn_cell ltx_align_center"><math xmlns="http://www.w3.org/1998/Math/MathML" id="m8" class="ltx_Math" alttext="\left\langle\Psi\middle|\mathcal{H}\middle|\Phi\right\rangle+\defint{a}{b}{F(x%&#10;)}{x}" display="block"><semantics id="m8a"><mrow id="m8.16" xref="m8.16.cmml"><mrow id="m8.9" xref="m8.9.cmml"><mo id="m8.8" xref="m8.8.cmml">⟨</mo><mi mathvariant="normal" id="m8.5" xref="m8.5.cmml">Ψ</mi><mo id="m8.8a" xref="m8.8.cmml">|</mo><mi class="ltx_font_mathcaligraphic" id="m8.6" xref="m8.6.cmml">ℋ</mi><mo id="m8.8b" xref="m8.8.cmml">|</mo><mi mathvariant="normal" id="m8.7" xref="m8.7.cmml">Φ</mi><mo id="m8.8c" xref="m8.8.cmml">⟩</mo></mrow><mo rspace="0.055em" id="m8.10" xref="m8.10.cmml">+</mo><mrow id="m8.15" xref="m8.15.cmml"><msubsup id="m8.12" xref="m8.15.cmml"><mo id="m8.11" xref="m8.11.cmml">∫</mo><mi id="m8.1" xref="m8.1.cmml">a</mi><mi id="m8.2" xref="m8.2.cmml">b</mi></msubsup><mrow id="m8.14" xref="m8.15.cmml"><mrow id="m8.3b" xref="m8.3.cmml"><mi id="m8.3.1" xref="m8.3.1.cmml">F</mi><mo id="m8.3c" xref="m8.3.cmml">⁡</mo><mrow id="m8.3.3" xref="m8.3.cmml"><mo stretchy="false" id="m8.3" xref="m8.3.cmml">(</mo><mi id="m8.3.2" xref="m8.3.2.cmml">x</mi><mo stretchy="false" id="m8.3a" xref="m8.3.cmml">)</mo></mrow></mrow><mo lspace="0em" id="m8.11a" xref="m8.11.cmml">⁢</mo><mrow id="m8.13" xref="m8.15.cmml"><mo rspace="0em" id="m8.11b" xref="m8.11.cmml">𝑑</mo><mi id="m8.4" xref="m8.4.cmml">x</mi></mrow></mrow></mrow></mrow><annotation-xml encoding="MathML-Content" id="m8b"><apply id="m8.16.cmml" xref="m8.16"><plus id="m8.10.cmml" xref="m8.10"/><apply id="m8.9.cmml" xref="m8.9"><csymbol cd="latexml" id="m8.8.cmml" xref="m8.8">quantum-operator-product</csymbol><ci id="m8.5.cmml" xref="m8.5">Ψ</ci><ci id="m8.6.cmml" xref="m8.6">ℋ</ci><ci id="m8.7.cmml" xref="m8.7">Φ</ci></apply><apply id="m8.15.cmml" xref="m8.15"><int id="m8.11.cmml" xref="m8.11"/><bvar id="m8.15a.cmml" xref="m8.15"><ci id="m8.4.cmml" xref="m8.4">𝑥</ci></bvar><lowlimit id="m8.15b.cmml" xref="m8.15"><ci id="m8.1.cmml" xref="m8.1">𝑎</ci></lowlimit><uplimit id="m8.15c.cmml" xref="m8.15"><ci id="m8.2.cmml" xref="m8.2">𝑏</ci></uplimit><apply id="m8.3.cmml" xref="m8.3b"><ci id="m8.3.1.cmml" xref="m8.3.1">𝐹</ci><ci id="m8.3.2.cmml" xref="m8.3.2">𝑥</ci></apply></apply></apply></annotation-xml></semantics></math></td>
68+
<td class="ltx_eqn_cell ltx_align_center"><math xmlns="http://www.w3.org/1998/Math/MathML" id="m8" class="ltx_Math" alttext="\left\langle\Psi\middle|\mathcal{H}\middle|\Phi\right\rangle+\defint{a}{b}{F(x%&#10;)}{x}" display="block"><semantics id="m8a"><mrow id="m8.16" xref="m8.16.cmml"><mrow id="m8.9" xref="m8.9.cmml"><mo id="m8.8" xref="m8.8.cmml">⟨</mo><mi mathvariant="normal" id="m8.5" xref="m8.5.cmml">Ψ</mi><mo id="m8.8a" xref="m8.8.cmml">|</mo><mi class="ltx_font_mathcaligraphic" id="m8.6" xref="m8.6.cmml">ℋ︀</mi><mo id="m8.8b" xref="m8.8.cmml">|</mo><mi mathvariant="normal" id="m8.7" xref="m8.7.cmml">Φ</mi><mo id="m8.8c" xref="m8.8.cmml">⟩</mo></mrow><mo rspace="0.055em" id="m8.10" xref="m8.10.cmml">+</mo><mrow id="m8.15" xref="m8.15.cmml"><msubsup id="m8.12" xref="m8.15.cmml"><mo id="m8.11" xref="m8.11.cmml">∫</mo><mi id="m8.1" xref="m8.1.cmml">a</mi><mi id="m8.2" xref="m8.2.cmml">b</mi></msubsup><mrow id="m8.14" xref="m8.15.cmml"><mrow id="m8.3b" xref="m8.3.cmml"><mi id="m8.3.1" xref="m8.3.1.cmml">F</mi><mo id="m8.3c" xref="m8.3.cmml">⁡</mo><mrow id="m8.3.3" xref="m8.3.cmml"><mo stretchy="false" id="m8.3" xref="m8.3.cmml">(</mo><mi id="m8.3.2" xref="m8.3.2.cmml">x</mi><mo stretchy="false" id="m8.3a" xref="m8.3.cmml">)</mo></mrow></mrow><mo lspace="0em" id="m8.11a" xref="m8.11.cmml">⁢</mo><mrow id="m8.13" xref="m8.15.cmml"><mo rspace="0em" id="m8.11b" xref="m8.11.cmml">𝑑</mo><mi id="m8.4" xref="m8.4.cmml">x</mi></mrow></mrow></mrow></mrow><annotation-xml encoding="MathML-Content" id="m8b"><apply id="m8.16.cmml" xref="m8.16"><plus id="m8.10.cmml" xref="m8.10"/><apply id="m8.9.cmml" xref="m8.9"><csymbol cd="latexml" id="m8.8.cmml" xref="m8.8">quantum-operator-product</csymbol><ci id="m8.5.cmml" xref="m8.5">Ψ</ci><ci id="m8.6.cmml" xref="m8.6">ℋ︀</ci><ci id="m8.7.cmml" xref="m8.7">Φ</ci></apply><apply id="m8.15.cmml" xref="m8.15"><int id="m8.11.cmml" xref="m8.11"/><bvar id="m8.15a.cmml" xref="m8.15"><ci id="m8.4.cmml" xref="m8.4">𝑥</ci></bvar><lowlimit id="m8.15b.cmml" xref="m8.15"><ci id="m8.1.cmml" xref="m8.1">𝑎</ci></lowlimit><uplimit id="m8.15c.cmml" xref="m8.15"><ci id="m8.2.cmml" xref="m8.2">𝑏</ci></uplimit><apply id="m8.3.cmml" xref="m8.3b"><ci id="m8.3.1.cmml" xref="m8.3.1">𝐹</ci><ci id="m8.3.2.cmml" xref="m8.3.2">𝑥</ci></apply></apply></apply></annotation-xml></semantics></math></td>
6969
<td class="ltx_eqn_cell ltx_eqn_center_padright"/></tr></tbody>
7070
</table>
7171
<table id="S0.Ex9" class="ltx_equation ltx_eqn_table">

0 commit comments

Comments
 (0)