Skip to content

Commit

Permalink
implemented \boldsymbol for +
Browse files Browse the repository at this point in the history
  • Loading branch information
aterenin committed Dec 9, 2017
1 parent 165809d commit 1cf74f0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/buildCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,13 @@ const mathsym = function(
// Have a special case for when the value = \ because the \ is used as a
// textord in unsupported command errors but cannot be parsed as a regular
// text ordinal and is therefore not present as a symbol in the symbols
// table for text
if (value === "\\" || symbols[mode][value].font === "main") {
// table for text, as well as a special case for boldsymbol because it
// can be used for bold + and -
const font = (options && options.font) ? options.font : "";
if (utils.contains(boldsymbolLetters, value) && font === "boldsymbol") {
return makeSymbol(value, "Main-Bold", mode, options,
classes.concat(["mathbf"]));
} else if (value === "\\" || symbols[mode][value].font === "main") {
return makeSymbol(value, "Main-Regular", mode, options, classes);
} else {
return makeSymbol(
Expand Down
7 changes: 6 additions & 1 deletion src/buildMathML.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,15 @@ groupTypes.textord = function(group, options) {
return node;
};

groupTypes.bin = function(group) {
groupTypes.bin = function(group, options) {
const node = new mathMLTree.MathNode(
"mo", [makeText(group.value, group.mode)]);

const variant = getVariant(group, options);
if (variant === "bold-italic") {
node.setAttribute("mathvariant", variant);
}

return node;
};

Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/mathml-spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ exports[`A MathML builder should render boldsymbol with the correct mathvariants
<mi mathvariant="bold-italic">
ı
</mi>
<mo>
<mo mathvariant="bold-italic">
+
</mo>
</mrow>
Expand Down
Binary file modified test/screenshotter/images/BoldSymbol-chrome.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/screenshotter/images/BoldSymbol-firefox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/screenshotter/ss_data.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ BinCancellation: |
\end{array}
BinomTest: \dbinom{a}{b}\tbinom{a}{b}^{\binom{a}{b}+17}
BoldSpacing: \mathbf{A}^2+\mathbf{B}_3*\mathscr{C}'
BoldSymbol: \sum_{\boldsymbol{\alpha}}^{\boldsymbol{\beta}} \boldsymbol{\omega}+ \int_{\boldsymbol{\alpha}}^{\boldsymbol{\beta}} \boldsymbol{\Omega}+\boldsymbol{A}+\boldsymbol{x}
BoldSymbol: \sum_{\boldsymbol{\alpha}}^{\boldsymbol{\beta}} \boldsymbol{\omega}+ \int_{\boldsymbol{\alpha}}^{\boldsymbol{\beta}} \boldsymbol{\Omega}+\boldsymbol{Ax2k\omega\Omega\imath+}
Boxed: \boxed{F=ma} \quad \boxed{ac}\color{magenta}{\boxed{F}}\boxed{F=mg}
Cases: |
f(a,b)=\begin{cases}
Expand Down

0 comments on commit 1cf74f0

Please sign in to comment.