UNPKG

12.9 kBtext/lessView Raw
1/* stylelint-disable font-family-no-missing-generic-family-keyword */
2@import "../submodules/katex-fonts/fonts.less";
3
4// The mu unit is defined as 1/18 em
5@mu: 1/18em;
6
7// The version is dynamically set from package.json via webpack.common.js
8@version: "";
9
10.katex {
11 font: normal 1.21em KaTeX_Main, Times New Roman, serif;
12 line-height: 1.2;
13
14 // Protect elements inside .katex from inheriting text-indent.
15 text-indent: 0;
16
17 // Prevent a rendering bug that misplaces \vec in Chrome.
18 text-rendering: auto;
19
20 // Prevent background resetting on elements in Windows's high-contrast
21 // mode, while still allowing background/foreground setting on root .katex
22 * { -ms-high-contrast-adjust: none !important; }
23
24 .katex-version::after {
25 content: @version;
26 }
27
28 .katex-mathml {
29 // Accessibility hack to only show to screen readers
30 // Found at: http://a11yproject.com/posts/how-to-hide-content/
31 position: absolute;
32 clip: rect(1px, 1px, 1px, 1px);
33 padding: 0;
34 border: 0;
35 height: 1px;
36 width: 1px;
37 overflow: hidden;
38 }
39
40 .katex-html {
41 /* \newline is an empty block at top level, between .base elements */
42 > .newline {
43 display: block;
44 }
45 }
46
47 .base {
48 position: relative;
49 display: inline-block;
50 white-space: nowrap;
51
52 // Fix width of containers of negative spaces, working around Chrome bug.
53 width: min-content;
54 }
55
56 .strut {
57 display: inline-block;
58 }
59
60 // Text font weights
61 .textbf {
62 font-weight: bold;
63 }
64
65 // Text font shapes.
66 .textit {
67 font-style: italic;
68 }
69
70 // Text font families.
71 .textrm {
72 font-family: KaTeX_Main;
73 }
74
75 .textsf {
76 font-family: KaTeX_SansSerif;
77 }
78
79 .texttt {
80 font-family: KaTeX_Typewriter;
81 }
82
83 // Math fonts.
84 .mathdefault {
85 font-family: KaTeX_Math;
86 font-style: italic;
87 }
88
89 .mathit {
90 font-family: KaTeX_Main;
91 font-style: italic;
92 }
93
94 .mathrm {
95 font-style: normal;
96 }
97
98 .mathbf {
99 font-family: KaTeX_Main;
100 font-weight: bold;
101 }
102
103 .boldsymbol {
104 font-family: KaTeX_Math;
105 font-weight: bold;
106 font-style: italic;
107 }
108
109 .amsrm {
110 font-family: KaTeX_AMS;
111 }
112
113 .mathbb,
114 .textbb {
115 font-family: KaTeX_AMS;
116 }
117
118 .mathcal {
119 font-family: KaTeX_Caligraphic;
120 }
121
122 .mathfrak,
123 .textfrak {
124 font-family: KaTeX_Fraktur;
125 }
126
127 .mathtt {
128 font-family: KaTeX_Typewriter;
129 }
130
131 .mathscr,
132 .textscr {
133 font-family: KaTeX_Script;
134 }
135
136 .mathsf,
137 .textsf {
138 font-family: KaTeX_SansSerif;
139 }
140
141 .mathboldsf,
142 .textboldsf {
143 font-family: KaTeX_SansSerif;
144 font-weight: bold;
145 }
146
147 .mathitsf,
148 .textitsf {
149 font-family: KaTeX_SansSerif;
150 font-style: italic;
151 }
152
153 .mainrm {
154 font-family: KaTeX_Main;
155 font-style: normal;
156 }
157
158 // This value is also used in fontMetrics.js, if you change it make sure the
159 // values match.
160 @ptperem: 10;
161 @nulldelimiterspace: 1.2em / @ptperem;
162
163 @muspace: 0.055556em; // 1mu
164 @thinspace: 0.16667em; // 3mu
165 @mediumspace: 0.22222em; // 4mu
166 @thickspace: 0.27778em; // 5mu
167
168 .vlist-t {
169 display: inline-table;
170 table-layout: fixed;
171 }
172
173 .vlist-r {
174 display: table-row;
175 }
176
177 .vlist {
178 display: table-cell;
179 vertical-align: bottom;
180 position: relative;
181
182 > span {
183 display: block;
184 height: 0;
185 position: relative;
186
187 > span {
188 display: inline-block;
189 }
190
191 > .pstrut {
192 overflow: hidden;
193 width: 0;
194 }
195 }
196 }
197
198 .vlist-t2 {
199 margin-right: -2px;
200 }
201
202 .vlist-s {
203 // This cell solves Safari rendering problems. It has text content, so
204 // its baseline is used for the table. A very small font avoids line-box
205 // issues; absolute units prevent user font-size overrides from breaking
206 // rendering. Safari refuses to make the box zero-width, so we give it
207 // a known width and compensate with negative right margin on the
208 // inline-table. To prevent the "width: min-content" Chrome workaround
209 // from shrinking this box, we also set min-width.
210 display: table-cell;
211 vertical-align: bottom;
212 font-size: 1px;
213 width: 2px;
214 min-width: 2px;
215 }
216
217 .msupsub {
218 text-align: left;
219 }
220
221 .mfrac {
222 > span > span {
223 text-align: center;
224 }
225
226 .frac-line {
227 display: inline-block;
228 width: 100%;
229 border-bottom-style: solid;
230 }
231 }
232
233 // Prevent Chrome from disappearing frac-lines, rules, etc.
234 .mfrac .frac-line,
235 .overline .overline-line,
236 .underline .underline-line,
237 .hline,
238 .hdashline,
239 .rule {
240 min-height: 1px;
241 }
242
243 .mspace {
244 display: inline-block;
245 }
246
247 .llap,
248 .rlap,
249 .clap {
250 width: 0;
251 position: relative;
252
253 > .inner {
254 position: absolute;
255 }
256
257 > .fix {
258 display: inline-block;
259 }
260 }
261
262 .llap > .inner {
263 right: 0;
264 }
265
266 .rlap > .inner,
267 .clap > .inner {
268 left: 0;
269 }
270
271 .clap > .inner > span {
272 margin-left: -50%;
273 margin-right: 50%;
274 }
275
276 .rule {
277 display: inline-block;
278 border: solid 0;
279 position: relative;
280 }
281
282 .overline .overline-line,
283 .underline .underline-line,
284 .hline {
285 display: inline-block;
286 width: 100%;
287 border-bottom-style: solid;
288 }
289
290 .hdashline {
291 display: inline-block;
292 width: 100%;
293 border-bottom-style: dashed;
294 }
295
296 .sqrt {
297 > .root {
298 // These values are taken from the definition of `\r@@t`,
299 // `\mkern 5mu` and `\mkern -10mu`.
300 margin-left: 5*@mu;
301 margin-right: -10*@mu;
302 }
303 }
304
305 .sizing,
306 .fontsize-ensurer {
307 display: inline-block;
308
309 @size1: 0.5;
310 @size2: 0.6;
311 @size3: 0.7;
312 @size4: 0.8;
313 @size5: 0.9;
314 @size6: 1;
315 @size7: 1.2;
316 @size8: 1.44;
317 @size9: 1.728;
318 @size10: 2.074;
319 @size11: 2.488;
320
321 .generate-size-change(@from, @to) {
322 &.reset-size@{from}.size@{to} {
323 @sizeFromVariable: ~"size@{from}";
324 @sizeToVariable: ~"size@{to}";
325
326 font-size: (@@sizeToVariable / @@sizeFromVariable) * 1em;
327 }
328 }
329
330 .generate-to-size-change(@from, @currTo) when (@currTo =< 11) {
331 .generate-size-change(@from, @currTo);
332
333 .generate-to-size-change(@from, (@currTo + 1));
334 }
335
336 .generate-from-size-change(@currFrom) when (@currFrom =< 11) {
337 .generate-to-size-change(@currFrom, 1);
338
339 .generate-from-size-change((@currFrom + 1));
340 }
341
342 .generate-from-size-change(1);
343 }
344
345 .delimsizing {
346 &.size1 { font-family: KaTeX_Size1; }
347 &.size2 { font-family: KaTeX_Size2; }
348 &.size3 { font-family: KaTeX_Size3; }
349 &.size4 { font-family: KaTeX_Size4; }
350
351 &.mult {
352 .delim-size1 > span {
353 font-family: KaTeX_Size1;
354 }
355
356 .delim-size4 > span {
357 font-family: KaTeX_Size4;
358 }
359 }
360 }
361
362 .nulldelimiter {
363 display: inline-block;
364 width: @nulldelimiterspace;
365 }
366
367 .delimcenter {
368 position: relative;
369 }
370
371 .op-symbol {
372 position: relative;
373
374 &.small-op {
375 font-family: KaTeX_Size1;
376 }
377
378 &.large-op {
379 font-family: KaTeX_Size2;
380 }
381 }
382
383 .op-limits {
384 > .vlist-t {
385 text-align: center;
386 }
387 }
388
389 .accent {
390 > .vlist-t {
391 text-align: center;
392 }
393
394 .accent-body {
395 position: relative; // so that 'left' can shift the accent
396 }
397
398 // Accents that are not of the accent-full class have zero width
399 // (do not contribute to the width of the final symbol).
400 .accent-body:not(.accent-full) {
401 width: 0;
402 }
403 }
404
405 .overlay {
406 display: block;
407 }
408
409 .mtable {
410 .vertical-separator {
411 display: inline-block;
412 margin: 0 -0.025em;
413 border-right: 0.05em solid;
414 min-width: 1px; // Prevent Chrome from omitting a line.
415 }
416
417 .vs-dashed {
418 border-right: 0.05em dashed;
419 }
420
421 .arraycolsep {
422 display: inline-block;
423 }
424
425 .col-align-c > .vlist-t {
426 text-align: center;
427 }
428
429 .col-align-l > .vlist-t {
430 text-align: left;
431 }
432
433 .col-align-r > .vlist-t {
434 text-align: right;
435 }
436 }
437
438 .svg-align {
439 text-align: left;
440 }
441
442 svg {
443 display: block;
444 position: absolute; // absolute relative to parent
445 width: 100%;
446 height: inherit;
447
448 // We want to inherit colors from our environment
449 fill: currentColor;
450 stroke: currentColor;
451
452 // But path elements should not have an outline by default
453 // that would make them bigger than we expect.
454 path {
455 stroke: none;
456 }
457
458 // And we don't want to inherit any other style properties
459 // that could affect SVG rendering without affecting font
460 // rendering. So we reset these properties to their default
461 // values for every <svg> element.
462 // See https://www.w3.org/TR/SVG/painting.html
463 fill-rule: nonzero;
464 fill-opacity: 1;
465 stroke-width: 1;
466 stroke-linecap: butt;
467 stroke-linejoin: miter;
468 stroke-miterlimit: 4;
469 stroke-dasharray: none;
470 stroke-dashoffset: 0;
471 stroke-opacity: 1;
472 }
473
474 img {
475 border-style: none;
476 min-width: 0;
477 min-height: 0;
478 max-width: none;
479 max-height: none;
480 }
481
482 // Define CSS for image whose width will match its span width.
483 .stretchy {
484 width: 100%;
485 display: block;
486 position: relative;
487 overflow: hidden;
488
489 &::before,
490 &::after {
491 content: "";
492 }
493 }
494
495 // Hide the long tail of a stretchy SVG.
496 .hide-tail {
497 width: 100%; // necessary only to get IE to work properly
498 position: relative; // ditto
499 overflow: hidden; // This line applies to all browsers.
500 }
501
502 .halfarrow-left {
503 position: absolute;
504 left: 0;
505 width: 50.2%;
506 overflow: hidden;
507 }
508
509 .halfarrow-right {
510 position: absolute;
511 right: 0;
512 width: 50.2%;
513 overflow: hidden;
514 }
515
516 .brace-left {
517 position: absolute;
518 left: 0;
519 width: 25.1%;
520 overflow: hidden;
521 }
522
523 .brace-center {
524 position: absolute;
525 left: 25%;
526 width: 50%;
527 overflow: hidden;
528 }
529
530 .brace-right {
531 position: absolute;
532 right: 0;
533 width: 25.1%;
534 overflow: hidden;
535 }
536
537 // Lengthen the extensible arrows via padding.
538 .x-arrow-pad {
539 padding: 0 0.5em;
540 }
541
542 .x-arrow,
543 .mover,
544 .munder {
545 text-align: center;
546 }
547
548 .boxpad {
549 padding: 0 0.3em 0 0.3em; // \fboxsep = 3pt
550 }
551
552 .fbox,
553 .fcolorbox {
554 box-sizing: border-box;
555 border: 0.04em solid; // \fboxrule = 0.4pt
556 }
557
558 .cancel-pad {
559 padding: 0 0.2em 0 0.2em; // ref: cancel package \advance\dimen@ 2\p@ % "+2"
560 }
561
562 .cancel-lap {
563 margin-left: -0.2em; // \cancel does not affect horizontal spacing.
564 margin-right: -0.2em; // Apply negative margin to correct for 0.2em padding
565 } // inside the \cancel group.
566
567 .sout {
568 border-bottom-style: solid;
569 border-bottom-width: 0.08em;
570 }
571}
572
573.katex-display {
574 display: block;
575 margin: 1em 0;
576 text-align: center;
577
578 > .katex {
579 display: block;
580 text-align: center;
581 white-space: nowrap;
582
583 > .katex-html {
584 display: block;
585 position: relative;
586
587 > .tag {
588 position: absolute;
589 right: 0;
590 }
591 }
592 }
593}
594
595// Left-justified tags (default is right-justified)
596.katex-display.leqno > .katex > .katex-html > .tag {
597 left: 0;
598 right: auto;
599}
600
601// Flush-left display math
602.katex-display.fleqn > .katex {
603 text-align: left;
604}