diff --git a/src/macros.js b/src/macros.js index 8efcdd76..5eb44849 100644 --- a/src/macros.js +++ b/src/macros.js @@ -659,6 +659,15 @@ defineMacro("\\mod", "\\allowbreak" + "\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}" + "{\\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 diff --git a/test/katex-spec.js b/test/katex-spec.js index 33a74599..6d9ac0d1 100644 --- a/test/katex-spec.js +++ b/test/katex-spec.js @@ -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() { it("should parse comments at the end of a line", () => { expect("a^2 + b^2 = c^2 % Pythagoras' Theorem\n").toParse(); diff --git a/test/screenshotter/images/Pmb-chrome.png b/test/screenshotter/images/Pmb-chrome.png new file mode 100644 index 00000000..3a6c3cd9 Binary files /dev/null and b/test/screenshotter/images/Pmb-chrome.png differ diff --git a/test/screenshotter/images/Pmb-firefox.png b/test/screenshotter/images/Pmb-firefox.png new file mode 100644 index 00000000..0ecd74ac Binary files /dev/null and b/test/screenshotter/images/Pmb-firefox.png differ diff --git a/test/screenshotter/ss_data.yaml b/test/screenshotter/ss_data.yaml index c5ebb093..1c07fa82 100644 --- a/test/screenshotter/ss_data.yaml +++ b/test/screenshotter/ss_data.yaml @@ -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)\\ \text{a \phantom{123} b \hphantom{45678} c \vphantom{101112} d} \end{array} +Pmb: \mu\pmb{\mu}\pmb{=}\mu\pmb{+}\mu PrimeSpacing: f'+f_2'+f^{f'} 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}}