A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/KaTeX/KaTeX/commit/22189018b63c9312ec4ad126804514a7390d60b5 below:

italic sans-serif in math mode via `\mathsfit` command (#3998) · KaTeX/KaTeX@2218901 · GitHub

File tree Expand file treeCollapse file tree 10 files changed

+34

-14

lines changed

Filter options

Expand file treeCollapse file tree 10 files changed

+34

-14

lines changed Original file line number Diff line number Diff line change

@@ -595,18 +595,18 @@ For color definition, KaTeX color functions will accept the standard HTML [pred

595 595

**Font**

596 596 597 597

||||

598 -

|:------------------------------|:------------------------------|:-----

599 -

|$\mathrm{Ab0}$ `\mathrm{Ab0}` |$\mathbf{Ab0}$ `\mathbf{Ab0}` |$\mathsf{Ab0}$ `\mathsf{Ab0}`

600 -

|$\mathnormal{Ab0}$ `\mathnormal{Ab0}`|$\textbf{Ab0}$ `\textbf{Ab0}` |$\textsf{Ab0}$ `\textsf{Ab0}`

601 -

|$\textrm{Ab0}$ `\textrm{Ab0}` |$\bf Ab0$ `\bf Ab0` |$\sf Ab0$ `\sf Ab0`

602 -

|$\rm Ab0$ `\rm Ab0` |$\bold{Ab0}$ `\bold{Ab0}` |$\Bbb{AB}$ `\Bbb{AB}`

603 -

|$\textnormal{Ab0}$ `\textnormal{Ab0}`|$\boldsymbol{Ab0}$ `\boldsymbol{Ab}`|$\mathbb{AB}$ `\mathbb{AB}`

604 -

|$\text{Ab0}$ `\text{Ab0}` |$\bm{Ab0}$ `\bm{Ab0}` |$\frak{Ab0}$ `\frak{Ab0}`

605 -

|$\textup{Ab0}$ `\textup{Ab0}` |$\textmd{Ab0}$ `\textmd{Ab0}` |$\mathfrak{Ab0}$ `\mathfrak{Ab0}`

606 -

|$\mathit{Ab0}$ `\mathit{Ab0}` |$\mathtt{Ab0}$ `\mathtt{Ab0}` |$\mathcal{AB0}$ `\mathcal{AB0}`

607 -

|$\textit{Ab0}$ `\textit{Ab0}` |$\texttt{Ab0}$ `\texttt{Ab0}` |$\cal AB0$ `\cal AB0`

608 -

|$\it Ab0$ `\it Ab0` |$\tt Ab0$ `\tt Ab0` |$\mathscr{AB}$ `\mathscr{AB}`

609 -

|$\emph{Ab0}$ `\emph{Ab0}` | ||

598 +

|:------------------------------------|:-----------------------------------|:--------------------------------|

599 +

|$\mathrm{Ab0}$ `\mathrm{Ab0}` |$\mathbf{Ab0}$ `\mathbf{Ab0}` |$\mathsf{Ab0}$ `\mathsf{Ab0}` |

600 +

|$\mathnormal{Ab0}$ `\mathnormal{Ab0}`|$\textbf{Ab0}$ `\textbf{Ab0}` |$\textsf{Ab0}$ `\textsf{Ab0}` |

601 +

|$\textrm{Ab0}$ `\textrm{Ab0}` |$\bf Ab0$ `\bf Ab0` |$\sf Ab0$ `\sf Ab0` |

602 +

|$\rm Ab0$ `\rm Ab0` |$\bold{Ab0}$ `\bold{Ab0}` |$\mathsfit{Ab0}$ `\mathsfit{Ab0}`|

603 +

|$\textnormal{Ab0}$ `\textnormal{Ab0}`|$\boldsymbol{Ab0}$ `\boldsymbol{Ab}`|$\Bbb{AB}$ `\Bbb{AB}` |

604 +

|$\text{Ab0}$ `\text{Ab0}` |$\bm{Ab0}$ `\bm{Ab0}` |$\mathbb{AB}$ `\mathbb{AB}` |

605 +

|$\textup{Ab0}$ `\textup{Ab0}` |$\textmd{Ab0}$ `\textmd{Ab0}` |$\frak{Ab0}$ `\frak{Ab0}` |

606 +

|$\mathit{Ab0}$ `\mathit{Ab0}` |$\mathtt{Ab0}$ `\mathtt{Ab0}` |$\mathfrak{Ab0}$ `\mathfrak{Ab0}`|

607 +

|$\textit{Ab0}$ `\textit{Ab0}` |$\texttt{Ab0}$ `\texttt{Ab0}` |$\mathcal{AB0}$ `\mathcal{AB0}` |

608 +

|$\it Ab0$ `\it Ab0` |$\tt Ab0$ `\tt Ab0` |$\cal AB0$ `\cal AB0` |

609 +

|$\emph{Ab0}$ `\emph{Ab0}` | |$\mathscr{AB}$ `\mathscr{AB}` |

610 610 611 611

One can stack font family, font weight, and font shape by using the `\textXX` versions of the font functions. So `\textsf{\textbf{H}}` will produce $\textsf{\textbf{H}}$. The other versions do not stack, e.g., `\mathsf{\mathbf{H}}` will produce $\mathsf{\mathbf{H}}$.

612 612 Original file line number Diff line number Diff line change

@@ -700,7 +700,10 @@ const fontMap: {[string]: {| variant: FontVariant, fontName: string |}} = {

700 700

variant: "italic",

701 701

fontName: "Math-Italic",

702 702

},

703 - 703 +

"mathsfit": {

704 +

variant: "sans-serif-italic",

705 +

fontName: "SansSerif-Italic",

706 +

},

704 707

// "boldsymbol" is missing because they require the use of multiple fonts:

705 708

// Math-BoldItalic and Main-Bold. This is handled by a special case in

706 709

// makeOrd which ends up calling boldsymbol.

Original file line number Diff line number Diff line change

@@ -98,6 +98,8 @@ export const getVariant = function(

98 98

return "bold";

99 99

} else if (font === "mathbb") {

100 100

return "double-struck";

101 +

} else if (font === "mathsfit") {

102 +

return "sans-serif-italic";

101 103

} else if (font === "mathfrak") {

102 104

return "fraktur";

103 105

} else if (font === "mathscr" || font === "mathcal") {

Original file line number Diff line number Diff line change

@@ -33,7 +33,7 @@ defineFunction({

33 33

type: "font",

34 34

names: [

35 35

// styles, except \boldsymbol defined below

36 -

"\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal",

36 +

"\\mathrm", "\\mathit", "\\mathbf", "\\mathnormal", "\\mathsfit",

37 37 38 38

// families

39 39

"\\mathbb", "\\mathcal", "\\mathfrak", "\\mathscr", "\\mathsf",

Original file line number Diff line number Diff line change

@@ -158,6 +158,7 @@ $display-margin: 1em 0 !default;

158 158

font-weight: bold;

159 159

}

160 160 161 +

.mathsfit,

161 162

.mathitsf,

162 163

.textitsf {

163 164

font-family: KaTeX_SansSerif;

Original file line number Diff line number Diff line change

@@ -2048,6 +2048,19 @@ describe("A MathML font tree-builder", function() {

2048 2048

expect(markup).toContain("<mo>+</mo>");

2049 2049

});

2050 2050 2051 +

it("should render \\mathsfit{" + contents + "} with the correct mathvariants", function() {

2052 +

const tex = `\\mathsfit{${contents}}`;

2053 +

const tree = getParsed(tex);

2054 +

const markup = buildMathML(tree, tex, defaultOptions).toMarkup();

2055 +

expect(markup).toContain("<mi mathvariant=\"sans-serif-italic\">A</mi>");

2056 +

expect(markup).toContain("<mi mathvariant=\"sans-serif-italic\">x</mi>");

2057 +

expect(markup).toContain("<mn mathvariant=\"sans-serif-italic\">2</mn>");

2058 +

expect(markup).toContain("<mi mathvariant=\"sans-serif-italic\">\u03c9</mi>"); // \omega

2059 +

expect(markup).toContain("<mi mathvariant=\"sans-serif-italic\">\u03A9</mi>"); // \Omega

2060 +

expect(markup).toContain("<mi mathvariant=\"sans-serif-italic\">\u0131</mi>"); // \imath

2061 +

expect(markup).toContain("<mo>+</mo>");

2062 +

});

2063 + 2051 2064

it("should render a combination of font and color changes", function() {

2052 2065

let tex = r`\textcolor{blue}{\mathbb R}`;

2053 2066

let tree = getParsed(tex);

Original file line number Diff line number Diff line change

@@ -253,6 +253,7 @@ MathNormal: \mathnormal{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}

253 253

MathOp: a\mathop+b\mathop:c\mathop{\delta}e\mathop{\textrm{and}}f\mathrel{\mathop{:}}=g\sin h

254 254

MathRm: \mathrm{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}

255 255

MathSf: \mathsf{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}

256 +

MathSfIt: \mathsfit{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}

256 257

MathScr: \mathscr{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}

257 258

MathtoolsMatrix: \begin{matrix*}[l] a & -1 \\ -1 & d \end{matrix*} \; \begin{pmatrix*}[r] a & -1 \\ -1 & d \end{pmatrix*}

258 259

MathTt: \mathtt{Ax2k\breve{a}\omega\Omega\imath+\KaTeX}

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4