katex 0.12.0 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/LICENSE +1 -1
- package/README.md +8 -7
- package/contrib/auto-render/auto-render.js +12 -19
- package/contrib/auto-render/index.html +9 -3
- package/contrib/auto-render/splitAtDelimiters.js +44 -61
- package/contrib/auto-render/test/auto-render-spec.js +88 -52
- package/contrib/copy-tex/README.md +5 -9
- package/contrib/copy-tex/copy-tex.css +0 -3
- package/contrib/mathtex-script-type/README.md +5 -5
- package/contrib/mhchem/README.md +4 -2
- package/contrib/render-a11y-string/render-a11y-string.js +31 -2
- package/contrib/render-a11y-string/test/render-a11y-string-spec.js +23 -0
- package/dist/README.md +8 -7
- package/dist/contrib/auto-render.js +148 -171
- package/dist/contrib/auto-render.min.js +1 -1
- package/dist/contrib/auto-render.mjs +91 -95
- package/dist/contrib/copy-tex.css +3 -3
- package/dist/contrib/copy-tex.js +11 -108
- package/dist/contrib/copy-tex.min.css +1 -1
- package/dist/contrib/copy-tex.min.js +1 -1
- package/dist/contrib/copy-tex.mjs +21 -20
- package/dist/contrib/mathtex-script-type.js +66 -91
- package/dist/contrib/mathtex-script-type.min.js +1 -1
- package/dist/contrib/mathtex-script-type.mjs +3 -3
- package/dist/contrib/mhchem.js +70 -95
- package/dist/contrib/mhchem.min.js +1 -1
- package/dist/contrib/mhchem.mjs +2 -2
- package/dist/contrib/render-a11y-string.js +97 -92
- package/dist/contrib/render-a11y-string.min.js +1 -1
- package/dist/contrib/render-a11y-string.mjs +86 -45
- package/dist/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/dist/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff +0 -0
- package/dist/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/dist/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/dist/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff +0 -0
- package/dist/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/dist/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/dist/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/dist/katex.css +66 -10
- package/dist/katex.js +2714 -1950
- package/dist/katex.min.css +1 -1
- package/dist/katex.min.js +1 -1
- package/dist/katex.mjs +3162 -2372
- package/katex.js +4 -3
- package/package.json +69 -59
- package/src/Lexer.js +4 -2
- package/src/MacroExpander.js +117 -37
- package/src/Options.js +2 -2
- package/src/ParseError.js +1 -1
- package/src/Parser.js +100 -159
- package/src/Settings.js +2 -2
- package/src/Style.js +4 -4
- package/src/Token.js +1 -1
- package/src/buildCommon.js +12 -5
- package/src/buildHTML.js +11 -0
- package/src/buildMathML.js +6 -0
- package/src/defineEnvironment.js +0 -3
- package/src/defineFunction.js +15 -22
- package/src/delimiter.js +61 -57
- package/src/domTree.js +1 -1
- package/src/environments/array.js +223 -35
- package/src/environments/cd.js +312 -0
- package/src/fontMetrics.js +1 -1
- package/src/fontMetricsData.js +2076 -0
- package/src/fonts/.gitignore +9 -0
- package/src/fonts/Makefile +139 -0
- package/src/fonts/default.cfg +20 -0
- package/src/fonts/generate_fonts.py +61 -0
- package/src/fonts/lib/Extra.otf +0 -0
- package/src/fonts/lib/Space.ttx +234 -0
- package/src/fonts/makeBlacker +49 -0
- package/src/fonts/makeFF +2003 -0
- package/src/fonts/xbbold.mf +182 -0
- package/src/fonts.less +64 -0
- package/src/functions/accent.js +3 -2
- package/src/functions/arrow.js +8 -2
- package/src/functions/color.js +4 -4
- package/src/functions/cr.js +7 -25
- package/src/functions/def.js +50 -24
- package/src/functions/delimsizing.js +8 -0
- package/src/functions/enclose.js +80 -12
- package/src/functions/environment.js +1 -1
- package/src/functions/font.js +3 -4
- package/src/functions/genfrac.js +36 -11
- package/src/functions/hbox.js +39 -0
- package/src/functions/kern.js +1 -0
- package/src/functions/mathchoice.js +1 -0
- package/src/functions/mclass.js +2 -1
- package/src/functions/op.js +3 -7
- package/src/functions/operatorname.js +1 -1
- package/src/functions/raisebox.js +0 -1
- package/src/functions/styling.js +1 -0
- package/src/functions/supsub.js +1 -3
- package/src/functions/symbolsOrd.js +0 -2
- package/src/functions/text.js +2 -3
- package/src/functions/vcenter.js +44 -0
- package/src/functions.js +3 -0
- package/src/katex.less +69 -16
- package/src/macros.js +42 -6
- package/src/mathMLTree.js +16 -1
- package/src/metrics/.gitignore +1 -0
- package/src/metrics/README.md +23 -0
- package/src/metrics/extract_tfms.py +114 -0
- package/src/metrics/extract_ttfs.py +119 -0
- package/src/metrics/format_json.py +28 -0
- package/src/metrics/mapping.pl +1224 -0
- package/src/metrics/parse_tfm.py +211 -0
- package/src/parseNode.js +29 -1
- package/src/parseTree.js +6 -0
- package/src/stretchy.js +12 -5
- package/src/svgGeometry.js +33 -4
- package/src/symbols.js +5 -3
- package/src/types.js +3 -2
- package/src/unicodeScripts.js +5 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
%% filename: xbbold.mf
|
|
2
|
+
%% version: 2.2
|
|
3
|
+
%% date: 1995/01/04
|
|
4
|
+
%%
|
|
5
|
+
%% (katex-fonts) The line 69 is modified to prevent overflow
|
|
6
|
+
%%
|
|
7
|
+
%% American Mathematical Society
|
|
8
|
+
%% Technical Support
|
|
9
|
+
%% Publications Technical Group
|
|
10
|
+
%% 201 Charles Street
|
|
11
|
+
%% Providence, RI 02904
|
|
12
|
+
%% USA
|
|
13
|
+
%% tel: (401) 455-4080
|
|
14
|
+
%% (800) 321-4267 (USA and Canada only)
|
|
15
|
+
%% fax: (401) 331-3842
|
|
16
|
+
%% email: tech-support@ams.org
|
|
17
|
+
%%
|
|
18
|
+
%% Copyright 1995, 2009 American Mathematical Society.
|
|
19
|
+
%%
|
|
20
|
+
%% This Font Software is licensed under the SIL Open Font License,
|
|
21
|
+
%% Version 1.1. This license is in the accompanying file OFL.txt, and
|
|
22
|
+
%% is also available with a FAQ at: http://scripts.sil.org/OFL.
|
|
23
|
+
%%
|
|
24
|
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
25
|
+
|
|
26
|
+
% Changes of minimal parameters in outlined characters for version 2.1
|
|
27
|
+
% done by Stefan Lindner, 18-April-1991
|
|
28
|
+
|
|
29
|
+
input xbbase;
|
|
30
|
+
%%mode_setup; %called by amsyb.mf; two calls confuse Metafont. NGB 15-OCT-1991
|
|
31
|
+
|
|
32
|
+
%%%%designsize:= font_size; % was 10pt#;
|
|
33
|
+
width#:= designsize; % was 10pt#;
|
|
34
|
+
unit#:= width#/18;
|
|
35
|
+
u#:= width#/54;
|
|
36
|
+
smallu#:= width#/162;
|
|
37
|
+
ascender#:= 37/3*unit#;
|
|
38
|
+
cap#:= 37/3*unit#;
|
|
39
|
+
number#:= 36/3*unit#;
|
|
40
|
+
xheight#:= 25/3*unit#;
|
|
41
|
+
descender#:= 12/4*unit#;
|
|
42
|
+
define_whole_vertical_pixels
|
|
43
|
+
(width,unit,u,smallu,ascender,cap,number,xheight,descender);
|
|
44
|
+
wpix(1.90u) (linethickness);
|
|
45
|
+
wpix(0.65u) (Sover_bot);
|
|
46
|
+
wpix(1.00u) (Aapex,Napex,Vapex,Wapex,Cover,Gover,Oover,Sover_top,Uover);
|
|
47
|
+
wpix(9.00u) (Uthin_bracket);
|
|
48
|
+
wpix(8.00u) (Kthin_diag_bracket,Xthin_diag_bracket,Ythin_diag_bracket);
|
|
49
|
+
wpix(7.00u) (k_thin_diag);
|
|
50
|
+
wpix(6.00u) (c_thin_stem_bracket);
|
|
51
|
+
wpix(5.00u) (c_thick_stem_bracket,c_inner_bracket,lc_thick_stem_bracket);
|
|
52
|
+
wpix(4.00u) (c_round_bracket);
|
|
53
|
+
adjpix(1.35u) (serif_thickness);
|
|
54
|
+
adjpix(1.30u) (Emid_tip,inbeak);
|
|
55
|
+
adjpix(1.50u) (Atip,Btopthin,Bmidthin,Ebot_tip,Ltip,Mapex,
|
|
56
|
+
Ntip,Ttip,Vtip,Wtip,Ztip,outbeak);
|
|
57
|
+
adjpix(1.65u) (Bbotthin,Gbotthin,Stopthin);
|
|
58
|
+
adjpix(1.75u) (Dtopthin,Ebotarm,Lthin,Tthin);
|
|
59
|
+
adjpix(1.80u) (Abar,Ctopthin,Dbotthin,Gtopthin,Jbotthin,Pmidarm,Sbotthin);
|
|
60
|
+
adjpix(1.90u) (Emidarm,Etoparm,Othin,Pthin,Rthin,Ydiag,Zthin);
|
|
61
|
+
adjpix(2.00u) (kthin,Mthin_diag,Wleftthin);
|
|
62
|
+
adjpix(2.10u) (Ctip);
|
|
63
|
+
adjpix(2.25u) (Athin,Kthin,Mthin_vert,Nthin,Uthin,Vthin,Wrightthin,Xthin);
|
|
64
|
+
adjpix(2.50u) (Hbar);
|
|
65
|
+
adjpix(2.60u) (Cbotthin);
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
%%%% Begin of changes for version 2.1
|
|
69
|
+
%(katex-fonts) Originally was pixels_per_inch*designsize < 1500:
|
|
70
|
+
if pixels_per_inch < 1500/designsize:
|
|
71
|
+
if pixels_per_inch*designsize < 1000:
|
|
72
|
+
if pixels_per_inch*designsize < 800:
|
|
73
|
+
if pixels_per_inch*designsize < 700:
|
|
74
|
+
minadjpix(0)(8.80u) (stem);
|
|
75
|
+
minadjpix(0)(6.80u) (kdiag);
|
|
76
|
+
minadjpix(0)(7.40u) (kstem);
|
|
77
|
+
minadjpix(0)(7.80u) (Jbulb,Mdiag);
|
|
78
|
+
minadjpix(0)(8.20u) (Kdiag);
|
|
79
|
+
minadjpix(0)(8.30u) (Gstem,Mstem);
|
|
80
|
+
minadjpix(0)(8.60u) (Lstem,Ustem,Ythick_diag);
|
|
81
|
+
minadjpix(0)(8.50u) (Bstem,Estem,Fstem,Ndiag,Rdiag,Xdiag,Zdiag);
|
|
82
|
+
minadjpix(0)(8.90u) (Btopcurve);
|
|
83
|
+
minadjpix(1)(9.30u) (Bbotcurve,Pcurve,Rcurve);
|
|
84
|
+
minadjpix(1)(9.50u) (Ccurve,Dcurve,Gcurve,Ocurve);
|
|
85
|
+
else:
|
|
86
|
+
minadjpix(1)(8.80u) (stem);
|
|
87
|
+
minadjpix(1)(6.80u) (kdiag);
|
|
88
|
+
minadjpix(1)(7.40u) (kstem);
|
|
89
|
+
minadjpix(1)(7.80u) (Jbulb,Mdiag);
|
|
90
|
+
minadjpix(1)(8.20u) (Kdiag);
|
|
91
|
+
minadjpix(1)(8.30u) (Gstem,Mstem);
|
|
92
|
+
minadjpix(1)(8.60u) (Lstem,Ustem,Ythick_diag);
|
|
93
|
+
minadjpix(1)(8.50u) (Bstem,Estem,Fstem,Ndiag,Rdiag,Xdiag,Zdiag);
|
|
94
|
+
minadjpix(1)(8.90u) (Btopcurve);
|
|
95
|
+
minadjpix(2)(9.30u) (Bbotcurve,Pcurve,Rcurve);
|
|
96
|
+
minadjpix(2)(9.50u) (Ccurve,Dcurve,Gcurve,Ocurve);
|
|
97
|
+
fi
|
|
98
|
+
else:
|
|
99
|
+
adjpix(3.0u) (Mapex);
|
|
100
|
+
minadjpix(1)(8.80u) (stem);
|
|
101
|
+
minadjpix(2)(6.80u) (kdiag);
|
|
102
|
+
minadjpix(2)(7.40u) (kstem);
|
|
103
|
+
minadjpix(2)(7.80u) (Jbulb);
|
|
104
|
+
minadjpix(1)(6.00u) (Mdiag);
|
|
105
|
+
minadjpix(2)(8.20u) (Kdiag);
|
|
106
|
+
minadjpix(2)(8.30u) (Gstem)
|
|
107
|
+
minadjpix(2)(8.30u) (Mstem);
|
|
108
|
+
minadjpix(2)(8.60u) (Lstem,Ustem,Ythick_diag);
|
|
109
|
+
minadjpix(2)(8.50u) (Bstem,Ndiag,Rdiag,Xdiag,Zdiag);
|
|
110
|
+
minadjpix(1)(8.50u) (Estem, Fstem);
|
|
111
|
+
minadjpix(2)(8.90u) (Btopcurve);
|
|
112
|
+
minadjpix(3)(9.30u) (Bbotcurve,Pcurve,Rcurve);
|
|
113
|
+
minadjpix(3)(9.50u) (Ccurve,Dcurve,Gcurve,Ocurve);
|
|
114
|
+
fi
|
|
115
|
+
else:
|
|
116
|
+
adjpix(3.0u) (Mapex);
|
|
117
|
+
minadjpix(2)(8.80u) (stem);
|
|
118
|
+
minadjpix(3)(6.80u) (kdiag);
|
|
119
|
+
minadjpix(3)(7.40u) (kstem);
|
|
120
|
+
minadjpix(3)(7.80u) (Jbulb);
|
|
121
|
+
minadjpix(1)(5.00u) (Mdiag);
|
|
122
|
+
minadjpix(3)(8.20u) (Kdiag);
|
|
123
|
+
minadjpix(3)(8.30u) (Gstem);
|
|
124
|
+
minadjpix(2)(8.30u) (Mstem);
|
|
125
|
+
minadjpix(3)(8.60u) (Lstem,Ustem,Ythick_diag);
|
|
126
|
+
minadjpix(3)(8.50u) (Estem,Fstem,Ndiag,Rdiag,Xdiag,Zdiag);
|
|
127
|
+
minadjpix(2)(8.50u) (Bstem);
|
|
128
|
+
minadjpix(3)(8.90u) (Btopcurve);
|
|
129
|
+
minadjpix(3)(9.30u) (Bbotcurve,Pcurve,Rcurve);
|
|
130
|
+
minadjpix(3)(9.50u) (Ccurve,Dcurve,Gcurve,Ocurve)
|
|
131
|
+
fi
|
|
132
|
+
else:
|
|
133
|
+
minadjpix(4)(8.80u) (stem);
|
|
134
|
+
minadjpix(4)(6.80u) (kdiag);
|
|
135
|
+
minadjpix(4)(7.40u) (kstem);
|
|
136
|
+
minadjpix(4)(7.80u) (Jbulb,Mdiag);
|
|
137
|
+
minadjpix(4)(8.20u) (Kdiag);
|
|
138
|
+
minadjpix(4)(8.30u) (Gstem,Mstem);
|
|
139
|
+
minadjpix(4)(8.60u) (Lstem,Ustem,Ythick_diag);
|
|
140
|
+
minadjpix(4)(8.50u) (Bstem,Estem,Fstem,Ndiag,Rdiag,Xdiag,Zdiag);
|
|
141
|
+
minadjpix(4)(8.90u) (Btopcurve);
|
|
142
|
+
minadjpix(5)(9.30u) (Bbotcurve,Pcurve,Rcurve);
|
|
143
|
+
minadjpix(5)(9.50u) (Ccurve,Dcurve,Gcurve,Ocurve)
|
|
144
|
+
fi;
|
|
145
|
+
%%%% end of changes for version 2.1
|
|
146
|
+
|
|
147
|
+
boolean lowres; lowres:=width<50;
|
|
148
|
+
highres_lowres(pullin) (.85)(1); % Emidarm
|
|
149
|
+
highres_lowres(pulleven) (1)(1.3); % Etoparm,Tarms,Zarms
|
|
150
|
+
highres_lowres(pullout) (1.1)(1); % Ebotarm,Lbotarm
|
|
151
|
+
highres_lowres(bracket0) (.0)(0); % Ntopleft
|
|
152
|
+
highres_lowres(bracket3) (.3)(0); % Nthinstems
|
|
153
|
+
highres_lowres(bracket01) (.0)(.1); % Uthin
|
|
154
|
+
highres_lowres(bracket32) (.3)(.2); % Vstems
|
|
155
|
+
highres_lowres(bracket4) (.4)(0); % P-all,R-all,I-all,F-all
|
|
156
|
+
highres_lowres(bracket42) (.4)(.2); % Xdiag
|
|
157
|
+
|
|
158
|
+
bool(ctrls):=false;
|
|
159
|
+
entasis:=inlimit(0)(0,1);
|
|
160
|
+
serif_constant_amt:=0pt;
|
|
161
|
+
join_radius:=1;
|
|
162
|
+
bool(softpath):=true;
|
|
163
|
+
|
|
164
|
+
c_thick_stem_bracket:=min(.5cap-eps,c_thick_stem_bracket);
|
|
165
|
+
rulepen:=pensquare scaled 1;
|
|
166
|
+
extra_beginchar:=extra_beginchar&"save t,p,ref; path p[],p[]',p[]'',ref[];";
|
|
167
|
+
extra_beginchar:=extra_beginchar&"pickup pencircle scaled linethickness;";
|
|
168
|
+
|
|
169
|
+
for x:="R":
|
|
170
|
+
wanted[byte x]:=true; endfor % test these characters
|
|
171
|
+
let iff=always_iff; % tests all chars in the file
|
|
172
|
+
|
|
173
|
+
font_normal_space .3width#; % TeX fontdimen 2 normal word space
|
|
174
|
+
font_normal_stretch .15width#; % TeX fontdimen 3 interword stretch
|
|
175
|
+
font_normal_shrink .1width#; % TeX fontdimen 4 interword shrink
|
|
176
|
+
font_x_height xheight#; % Tex fontdinem 5 for accents
|
|
177
|
+
font_quad width#; % TeX fontdimen 6 quad width
|
|
178
|
+
font_extra_space .1width#; % TeX fontdimen 7 extra space(period)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
input xbcaps
|
|
182
|
+
bye % changed from "end" 26 Aug 93; bnb
|
package/src/fonts.less
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@font-folder: "../fonts";
|
|
2
|
+
@use-ttf: true;
|
|
3
|
+
@use-woff: true;
|
|
4
|
+
@use-woff2: true;
|
|
5
|
+
|
|
6
|
+
.use-woff2(@family, @family-suffix) when (@use-woff2 = true) {
|
|
7
|
+
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff2') format('woff2')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.use-woff(@family, @family-suffix) when (@use-woff = true) {
|
|
11
|
+
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.woff') format('woff')
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.use-ttf(@family, @family-suffix) when (@use-ttf = true) {
|
|
15
|
+
src+: url('@{font-folder}/KaTeX_@{family}-@{family-suffix}.ttf') format('truetype')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.generate-suffix(@weight, @style) when (@weight = normal) and (@style = normal) {
|
|
19
|
+
@suffix: 'Regular';
|
|
20
|
+
}
|
|
21
|
+
.generate-suffix(@weight, @style) when (@weight = normal) and (@style = italic) {
|
|
22
|
+
@suffix: 'Italic';
|
|
23
|
+
}
|
|
24
|
+
.generate-suffix(@weight, @style) when (@weight = bold) and (@style = normal) {
|
|
25
|
+
@suffix: 'Bold';
|
|
26
|
+
}
|
|
27
|
+
.generate-suffix(@weight, @style) when (@weight = bold) and (@style = italic) {
|
|
28
|
+
@suffix: 'BoldItalic';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.font-face(@family, @weight, @style) {
|
|
32
|
+
.generate-suffix(@weight, @style);
|
|
33
|
+
@font-face {
|
|
34
|
+
font-family: 'KaTeX_@{family}';
|
|
35
|
+
.use-woff2(@family, @suffix);
|
|
36
|
+
.use-woff(@family, @suffix);
|
|
37
|
+
.use-ttf(@family, @suffix);
|
|
38
|
+
font-weight: @weight;
|
|
39
|
+
font-style: @style;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.font-face('AMS', normal, normal);
|
|
44
|
+
.font-face('Caligraphic', bold, normal);
|
|
45
|
+
.font-face('Caligraphic', normal, normal);
|
|
46
|
+
.font-face('Fraktur', bold, normal);
|
|
47
|
+
.font-face('Fraktur', normal, normal);
|
|
48
|
+
.font-face('Main', bold, normal);
|
|
49
|
+
.font-face('Main', bold, italic);
|
|
50
|
+
.font-face('Main', normal, italic);
|
|
51
|
+
.font-face('Main', normal, normal);
|
|
52
|
+
//.font-face('Math', bold, normal);
|
|
53
|
+
.font-face('Math', bold, italic);
|
|
54
|
+
.font-face('Math', normal, italic);
|
|
55
|
+
//.font-face('Math', normal, normal);
|
|
56
|
+
.font-face('SansSerif', bold, normal);
|
|
57
|
+
.font-face('SansSerif', normal, italic);
|
|
58
|
+
.font-face('SansSerif', normal, normal);
|
|
59
|
+
.font-face('Script', normal, normal);
|
|
60
|
+
.font-face('Size1', normal, normal);
|
|
61
|
+
.font-face('Size2', normal, normal);
|
|
62
|
+
.font-face('Size3', normal, normal);
|
|
63
|
+
.font-face('Size4', normal, normal);
|
|
64
|
+
.font-face('Typewriter', normal, normal);
|
package/src/functions/accent.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @flow
|
|
2
|
-
import defineFunction from "../defineFunction";
|
|
2
|
+
import defineFunction, {normalizeArgument} from "../defineFunction";
|
|
3
3
|
import buildCommon from "../buildCommon";
|
|
4
4
|
import mathMLTree from "../mathMLTree";
|
|
5
5
|
import utils from "../utils";
|
|
@@ -218,7 +218,7 @@ defineFunction({
|
|
|
218
218
|
numArgs: 1,
|
|
219
219
|
},
|
|
220
220
|
handler: (context, args) => {
|
|
221
|
-
const base = args[0];
|
|
221
|
+
const base = normalizeArgument(args[0]);
|
|
222
222
|
|
|
223
223
|
const isStretchy = !NON_STRETCHY_ACCENT_REGEX.test(context.funcName);
|
|
224
224
|
const isShifty = !isStretchy ||
|
|
@@ -250,6 +250,7 @@ defineFunction({
|
|
|
250
250
|
numArgs: 1,
|
|
251
251
|
allowedInText: true,
|
|
252
252
|
allowedInMath: false,
|
|
253
|
+
argTypes: ["primitive"],
|
|
253
254
|
},
|
|
254
255
|
handler: (context, args) => {
|
|
255
256
|
const base = args[0];
|
package/src/functions/arrow.js
CHANGED
|
@@ -30,6 +30,8 @@ defineFunction({
|
|
|
30
30
|
// The next 3 functions are here to support the mhchem extension.
|
|
31
31
|
// Direct use of these functions is discouraged and may break someday.
|
|
32
32
|
"\\xrightleftarrows", "\\xrightequilibrium", "\\xleftequilibrium",
|
|
33
|
+
// The next 3 functions are here only to support the {CD} environment.
|
|
34
|
+
"\\\\cdrightarrow", "\\\\cdleftarrow", "\\\\cdlongequal",
|
|
33
35
|
],
|
|
34
36
|
props: {
|
|
35
37
|
numArgs: 1,
|
|
@@ -57,7 +59,8 @@ defineFunction({
|
|
|
57
59
|
let newOptions = options.havingStyle(style.sup());
|
|
58
60
|
const upperGroup = buildCommon.wrapFragment(
|
|
59
61
|
html.buildGroup(group.body, newOptions, options), options);
|
|
60
|
-
|
|
62
|
+
const arrowPrefix = group.label.slice(0, 2) === "\\x" ? "x" : "cd";
|
|
63
|
+
upperGroup.classes.push(arrowPrefix + "-arrow-pad");
|
|
61
64
|
|
|
62
65
|
let lowerGroup;
|
|
63
66
|
if (group.below) {
|
|
@@ -65,7 +68,7 @@ defineFunction({
|
|
|
65
68
|
newOptions = options.havingStyle(style.sub());
|
|
66
69
|
lowerGroup = buildCommon.wrapFragment(
|
|
67
70
|
html.buildGroup(group.below, newOptions, options), options);
|
|
68
|
-
lowerGroup.classes.push("
|
|
71
|
+
lowerGroup.classes.push(arrowPrefix + "-arrow-pad");
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
const arrowBody = stretchy.svgSpan(group, options);
|
|
@@ -112,6 +115,9 @@ defineFunction({
|
|
|
112
115
|
},
|
|
113
116
|
mathmlBuilder(group, options) {
|
|
114
117
|
const arrowNode = stretchy.mathMLnode(group.label);
|
|
118
|
+
arrowNode.setAttribute(
|
|
119
|
+
"minsize", group.label.charAt(0) === "x" ? "1.75em" : "3.0em"
|
|
120
|
+
);
|
|
115
121
|
let node;
|
|
116
122
|
|
|
117
123
|
if (group.body) {
|
package/src/functions/color.js
CHANGED
|
@@ -4,6 +4,8 @@ import buildCommon from "../buildCommon";
|
|
|
4
4
|
import mathMLTree from "../mathMLTree";
|
|
5
5
|
import {assertNodeType} from "../parseNode";
|
|
6
6
|
|
|
7
|
+
import type {AnyParseNode} from '../parseNode';
|
|
8
|
+
|
|
7
9
|
import * as html from "../buildHTML";
|
|
8
10
|
import * as mml from "../buildMathML";
|
|
9
11
|
|
|
@@ -38,7 +40,6 @@ defineFunction({
|
|
|
38
40
|
props: {
|
|
39
41
|
numArgs: 2,
|
|
40
42
|
allowedInText: true,
|
|
41
|
-
greediness: 3,
|
|
42
43
|
argTypes: ["color", "original"],
|
|
43
44
|
},
|
|
44
45
|
handler({parser}, args) {
|
|
@@ -48,7 +49,7 @@ defineFunction({
|
|
|
48
49
|
type: "color",
|
|
49
50
|
mode: parser.mode,
|
|
50
51
|
color,
|
|
51
|
-
body: ordargument(body),
|
|
52
|
+
body: (ordargument(body): AnyParseNode[]),
|
|
52
53
|
};
|
|
53
54
|
},
|
|
54
55
|
htmlBuilder,
|
|
@@ -61,7 +62,6 @@ defineFunction({
|
|
|
61
62
|
props: {
|
|
62
63
|
numArgs: 1,
|
|
63
64
|
allowedInText: true,
|
|
64
|
-
greediness: 3,
|
|
65
65
|
argTypes: ["color"],
|
|
66
66
|
},
|
|
67
67
|
handler({parser, breakOnTokenText}, args) {
|
|
@@ -74,7 +74,7 @@ defineFunction({
|
|
|
74
74
|
parser.gullet.macros.set("\\current@color", color);
|
|
75
75
|
|
|
76
76
|
// Parse out the implicit body that should be colored.
|
|
77
|
-
const body = parser.parseExpression(true, breakOnTokenText);
|
|
77
|
+
const body: AnyParseNode[] = parser.parseExpression(true, breakOnTokenText);
|
|
78
78
|
|
|
79
79
|
return {
|
|
80
80
|
type: "color",
|
package/src/functions/cr.js
CHANGED
|
@@ -5,17 +5,12 @@ import defineFunction from "../defineFunction";
|
|
|
5
5
|
import buildCommon from "../buildCommon";
|
|
6
6
|
import mathMLTree from "../mathMLTree";
|
|
7
7
|
import {calculateSize} from "../units";
|
|
8
|
-
import ParseError from "../ParseError";
|
|
9
8
|
import {assertNodeType} from "../parseNode";
|
|
10
9
|
|
|
11
|
-
// \\
|
|
12
|
-
// same signature, we implement them as one megafunction, with newRow
|
|
13
|
-
// indicating whether we're in the \cr case, and newLine indicating whether
|
|
14
|
-
// to break the line in the \newline case.
|
|
15
|
-
|
|
10
|
+
// \DeclareRobustCommand\\{...\@xnewline}
|
|
16
11
|
defineFunction({
|
|
17
12
|
type: "cr",
|
|
18
|
-
names: ["
|
|
13
|
+
names: ["\\\\"],
|
|
19
14
|
props: {
|
|
20
15
|
numArgs: 0,
|
|
21
16
|
numOptionalArgs: 1,
|
|
@@ -23,25 +18,16 @@ defineFunction({
|
|
|
23
18
|
allowedInText: true,
|
|
24
19
|
},
|
|
25
20
|
|
|
26
|
-
handler({parser
|
|
21
|
+
handler({parser}, args, optArgs) {
|
|
27
22
|
const size = optArgs[0];
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
parser.settings.useStrictBehavior(
|
|
33
|
-
"newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " +
|
|
34
|
-
"does nothing in display mode")) {
|
|
35
|
-
newLine = false;
|
|
36
|
-
} else {
|
|
37
|
-
newLine = true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
23
|
+
const newLine = !parser.settings.displayMode ||
|
|
24
|
+
!parser.settings.useStrictBehavior(
|
|
25
|
+
"newLineInDisplayMode", "In LaTeX, \\\\ or \\newline " +
|
|
26
|
+
"does nothing in display mode");
|
|
40
27
|
return {
|
|
41
28
|
type: "cr",
|
|
42
29
|
mode: parser.mode,
|
|
43
30
|
newLine,
|
|
44
|
-
newRow,
|
|
45
31
|
size: size && assertNodeType(size, "size").value,
|
|
46
32
|
};
|
|
47
33
|
},
|
|
@@ -50,10 +36,6 @@ defineFunction({
|
|
|
50
36
|
// not within tabular/array environments.
|
|
51
37
|
|
|
52
38
|
htmlBuilder(group, options) {
|
|
53
|
-
if (group.newRow) {
|
|
54
|
-
throw new ParseError(
|
|
55
|
-
"\\cr valid only within a tabular/array environment");
|
|
56
|
-
}
|
|
57
39
|
const span = buildCommon.makeSpan(["mspace"], [], options);
|
|
58
40
|
if (group.newLine) {
|
|
59
41
|
span.classes.push("newline");
|
package/src/functions/def.js
CHANGED
|
@@ -88,41 +88,65 @@ defineFunction({
|
|
|
88
88
|
props: {
|
|
89
89
|
numArgs: 0,
|
|
90
90
|
allowedInText: true,
|
|
91
|
+
primitive: true,
|
|
91
92
|
},
|
|
92
93
|
handler({parser, funcName}) {
|
|
93
|
-
let
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
let tok = parser.gullet.popToken();
|
|
95
|
+
const name = tok.text;
|
|
96
|
+
if (/^(?:[\\{}$&#^_]|EOF)$/.test(name)) {
|
|
97
|
+
throw new ParseError("Expected a control sequence", tok);
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
// Count argument specifiers, and check they are in the order #1 #2 ...
|
|
99
|
+
|
|
99
100
|
let numArgs = 0;
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
101
|
+
let insert;
|
|
102
|
+
const delimiters = [[]];
|
|
103
|
+
// <parameter text> contains no braces
|
|
104
|
+
while (parser.gullet.future().text !== "{") {
|
|
105
|
+
tok = parser.gullet.popToken();
|
|
106
|
+
if (tok.text === "#") {
|
|
107
|
+
// If the very last character of the <parameter text> is #, so that
|
|
108
|
+
// this # is immediately followed by {, TeX will behave as if the {
|
|
109
|
+
// had been inserted at the right end of both the parameter text
|
|
110
|
+
// and the replacement text.
|
|
111
|
+
if (parser.gullet.future().text === "{") {
|
|
112
|
+
insert = parser.gullet.future();
|
|
113
|
+
delimiters[numArgs].push("{");
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// A parameter, the first appearance of # must be followed by 1,
|
|
118
|
+
// the next by 2, and so on; up to nine #’s are allowed
|
|
119
|
+
tok = parser.gullet.popToken();
|
|
120
|
+
if (!(/^[1-9]$/.test(tok.text))) {
|
|
121
|
+
throw new ParseError(`Invalid argument number "${tok.text}"`);
|
|
122
|
+
}
|
|
123
|
+
if (parseInt(tok.text) !== numArgs + 1) {
|
|
124
|
+
throw new ParseError(
|
|
125
|
+
`Argument number "${tok.text}" out of order`);
|
|
126
|
+
}
|
|
127
|
+
numArgs++;
|
|
128
|
+
delimiters.push([]);
|
|
129
|
+
} else if (tok.text === "EOF") {
|
|
130
|
+
throw new ParseError("Expected a macro definition");
|
|
131
|
+
} else {
|
|
132
|
+
delimiters[numArgs].push(tok.text);
|
|
115
133
|
}
|
|
116
|
-
arg = parser.gullet.consumeArgs(1)[0];
|
|
117
134
|
}
|
|
135
|
+
// replacement text, enclosed in '{' and '}' and properly nested
|
|
136
|
+
let {tokens} = parser.gullet.consumeArg();
|
|
137
|
+
if (insert) {
|
|
138
|
+
tokens.unshift(insert);
|
|
139
|
+
}
|
|
140
|
+
|
|
118
141
|
if (funcName === "\\edef" || funcName === "\\xdef") {
|
|
119
|
-
|
|
120
|
-
|
|
142
|
+
tokens = parser.gullet.expandTokens(tokens);
|
|
143
|
+
tokens.reverse(); // to fit in with stack order
|
|
121
144
|
}
|
|
122
145
|
// Final arg is the expansion of the macro
|
|
123
146
|
parser.gullet.macros.set(name, {
|
|
124
|
-
tokens
|
|
147
|
+
tokens,
|
|
125
148
|
numArgs,
|
|
149
|
+
delimiters,
|
|
126
150
|
}, funcName === globalMap[funcName]);
|
|
127
151
|
|
|
128
152
|
return {
|
|
@@ -145,6 +169,7 @@ defineFunction({
|
|
|
145
169
|
props: {
|
|
146
170
|
numArgs: 0,
|
|
147
171
|
allowedInText: true,
|
|
172
|
+
primitive: true,
|
|
148
173
|
},
|
|
149
174
|
handler({parser, funcName}) {
|
|
150
175
|
const name = checkControlSequence(parser.gullet.popToken());
|
|
@@ -168,6 +193,7 @@ defineFunction({
|
|
|
168
193
|
props: {
|
|
169
194
|
numArgs: 0,
|
|
170
195
|
allowedInText: true,
|
|
196
|
+
primitive: true,
|
|
171
197
|
},
|
|
172
198
|
handler({parser, funcName}) {
|
|
173
199
|
const name = checkControlSequence(parser.gullet.popToken());
|
|
@@ -81,6 +81,7 @@ defineFunction({
|
|
|
81
81
|
],
|
|
82
82
|
props: {
|
|
83
83
|
numArgs: 1,
|
|
84
|
+
argTypes: ["primitive"],
|
|
84
85
|
},
|
|
85
86
|
handler: (context, args) => {
|
|
86
87
|
const delim = checkDelimiter(args[0], context);
|
|
@@ -124,6 +125,10 @@ defineFunction({
|
|
|
124
125
|
node.setAttribute("fence", "false");
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
node.setAttribute("stretchy", "true");
|
|
129
|
+
node.setAttribute("minsize", delimiter.sizeToMaxHeight[group.size] + "em");
|
|
130
|
+
node.setAttribute("maxsize", delimiter.sizeToMaxHeight[group.size] + "em");
|
|
131
|
+
|
|
127
132
|
return node;
|
|
128
133
|
},
|
|
129
134
|
});
|
|
@@ -141,6 +146,7 @@ defineFunction({
|
|
|
141
146
|
names: ["\\right"],
|
|
142
147
|
props: {
|
|
143
148
|
numArgs: 1,
|
|
149
|
+
primitive: true,
|
|
144
150
|
},
|
|
145
151
|
handler: (context, args) => {
|
|
146
152
|
// \left case below triggers parsing of \right in
|
|
@@ -166,6 +172,7 @@ defineFunction({
|
|
|
166
172
|
names: ["\\left"],
|
|
167
173
|
props: {
|
|
168
174
|
numArgs: 1,
|
|
175
|
+
primitive: true,
|
|
169
176
|
},
|
|
170
177
|
handler: (context, args) => {
|
|
171
178
|
const delim = checkDelimiter(args[0], context);
|
|
@@ -299,6 +306,7 @@ defineFunction({
|
|
|
299
306
|
names: ["\\middle"],
|
|
300
307
|
props: {
|
|
301
308
|
numArgs: 1,
|
|
309
|
+
primitive: true,
|
|
302
310
|
},
|
|
303
311
|
handler: (context, args) => {
|
|
304
312
|
const delim = checkDelimiter(args[0], context);
|