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:
Ron Kok
2018-07-22 14:46:12 -07:00
committed by Erik Demaine
parent 74fb394bb5
commit b43ed4b645
5 changed files with 21 additions and 0 deletions

View File

@@ -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

View File

@@ -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();

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@@ -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}}