mirror of
https://github.com/Smaug123/KaTeX
synced 2025-10-08 12:38:39 +00:00
Support \pmb (#1418)
* Support \pmb * Fix lint error * Add phony screenshots * Screenshots take two * Screenshots take three * Simplify copies * Move determination of mclass from handler to htmlBuilder * Change to a macro definition * Update screenshots * Pick up review comments * Clean up nesting of braces * Update screenshot
This commit is contained in:
@@ -659,6 +659,15 @@ defineMacro("\\mod", "\\allowbreak" +
|
|||||||
"\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" +
|
"\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" +
|
||||||
"{\\rm mod}\\,\\,#1");
|
"{\\rm mod}\\,\\,#1");
|
||||||
|
|
||||||
|
// \pmb -- A simulation of bold.
|
||||||
|
// It works by typesetting three copies of the argument with small offsets.
|
||||||
|
// Ref: a rather lengthy macro in ambsy.sty
|
||||||
|
defineMacro("\\pmb", "\\html@mathml{\\@binrel{#1}{" +
|
||||||
|
"\\mathrlap{#1}" +
|
||||||
|
"\\mathrlap{\\mkern0.4mu\\raisebox{0.4mu}{$#1$}}" +
|
||||||
|
"{\\mkern0.8mu#1}" +
|
||||||
|
"}}{\\mathbf{#1}}");
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// LaTeX source2e
|
// LaTeX source2e
|
||||||
|
|
||||||
|
@@ -1535,6 +1535,17 @@ describe("A font parser", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("A \\pmb builder", function() {
|
||||||
|
it("should not fail", function() {
|
||||||
|
expect("\\pmb{\\mu}").toBuild();
|
||||||
|
expect("\\pmb{=}").toBuild();
|
||||||
|
expect("\\pmb{+}").toBuild();
|
||||||
|
expect("\\pmb{\\frac{x^2}{x_1}}").toBuild();
|
||||||
|
expect("\\pmb{}").toBuild();
|
||||||
|
expect("\\def\\x{1}\\pmb{\\x\\def\\x{2}}").toParseLike("\\pmb{1}");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("A comment parser", function() {
|
describe("A comment parser", function() {
|
||||||
it("should parse comments at the end of a line", () => {
|
it("should parse comments at the end of a line", () => {
|
||||||
expect("a^2 + b^2 = c^2 % Pythagoras' Theorem\n").toParse();
|
expect("a^2 + b^2 = c^2 % Pythagoras' Theorem\n").toParse();
|
||||||
|
BIN
test/screenshotter/images/Pmb-chrome.png
Normal file
BIN
test/screenshotter/images/Pmb-chrome.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
BIN
test/screenshotter/images/Pmb-firefox.png
Normal file
BIN
test/screenshotter/images/Pmb-firefox.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
@@ -274,6 +274,7 @@ Phantom: \begin{array}{l}
|
|||||||
\dfrac{1+\phantom{x^{\blue{2}}} = x}{1+x^{\blue{2}} = x} \left(\vphantom{\int_t} zzz \right) \left( X \hphantom{\frac{\frac X X}{X}} \right)\\
|
\dfrac{1+\phantom{x^{\blue{2}}} = x}{1+x^{\blue{2}} = x} \left(\vphantom{\int_t} zzz \right) \left( X \hphantom{\frac{\frac X X}{X}} \right)\\
|
||||||
\text{a \phantom{123} b \hphantom{45678} c \vphantom{101112} d}
|
\text{a \phantom{123} b \hphantom{45678} c \vphantom{101112} d}
|
||||||
\end{array}
|
\end{array}
|
||||||
|
Pmb: \mu\pmb{\mu}\pmb{=}\mu\pmb{+}\mu
|
||||||
PrimeSpacing: f'+f_2'+f^{f'}
|
PrimeSpacing: f'+f_2'+f^{f'}
|
||||||
PrimeSuper: x'^2+x'''^2+x'^2_3+x_3'^2
|
PrimeSuper: x'^2+x'''^2+x'^2_3+x_3'^2
|
||||||
Raisebox: \frac{a}{a\raisebox{0.5em}{b}} \cdot \frac{a\raisebox{-0.5em}{b}}{a} \cdot \sqrt{a\raisebox{0.5em}{b}} \cdot \sqrt{a\raisebox{-0.5em}{b}} \cdot \sqrt{a\raisebox{0.5em}{b}\raisebox{-0.5em}{b}}
|
Raisebox: \frac{a}{a\raisebox{0.5em}{b}} \cdot \frac{a\raisebox{-0.5em}{b}}{a} \cdot \sqrt{a\raisebox{0.5em}{b}} \cdot \sqrt{a\raisebox{-0.5em}{b}} \cdot \sqrt{a\raisebox{0.5em}{b}\raisebox{-0.5em}{b}}
|
||||||
|
Reference in New Issue
Block a user