Add support for the doublestroke package

This commit adds the mathed command \mathds that selects a
font more appropriate than \mathbb for typesetting the
mathematical symbols for the natural (N), whole numbers (Z),
rational numbers (Q), real numbers (R), complex numbers (C),
and some others.

As in the \mathbb case, only capital letters are supported,
but in addition one can also typeset a symbol often used for
representing the indicator function (\mathds{1}) and the
letters a, h, k.

Fixes bug #11887.
This commit is contained in:
Enrico Forestieri 2020-06-11 16:42:31 +02:00
parent 3af543455b
commit 5a80f7bb6a
12 changed files with 2377 additions and 6 deletions

2355
lib/fonts/dsrom10.sfd Normal file

File diff suppressed because it is too large Load Diff

BIN
lib/fonts/dsrom10.ttf Executable file

Binary file not shown.

BIN
lib/images/math/mathds.svgz Normal file

Binary file not shown.

View File

@ -118,6 +118,7 @@ Bigggr big none hiddensymbol
mathnormal font mathmode inherit medium up math
frak font mathmode
mathbb font mathmode
mathds font mathmode
mathbf font mathmode
mathcal font mathmode
mathfrak font mathmode

View File

@ -423,6 +423,7 @@ ToolbarSet
Item "Italic \\mathit" "math-insert \mathit"
Item "Typewriter \\mathtt" "math-insert \mathtt"
Item "Blackboard \\mathbb" "math-insert \mathbb"
Item "Double stroke \\mathds" "math-insert \mathds"
Item "Fraktur \\mathfrak" "math-insert \mathfrak"
Item "Calligraphic \\mathcal" "math-insert \mathcal"
Item "Formal Script \\mathscr" "math-insert \mathscr"

View File

@ -45,6 +45,8 @@ enum FontFamily {
///
MSB_FAMILY,
///
DS_FAMILY,
///
EUFRAK_FAMILY,
///
RSFS_FAMILY,

View File

@ -493,6 +493,7 @@ string getFamilyCSS(FontFamily const & f)
case CMEX_FAMILY:
case MSA_FAMILY:
case MSB_FAMILY:
case DS_FAMILY:
case EUFRAK_FAMILY:
case RSFS_FAMILY:
case STMARY_FAMILY:

View File

@ -1158,7 +1158,8 @@ char const * simplefeatures[] = {
"xskak",
"pict2e",
"drs",
"environ"
"environ",
"dsfont"
};
char const * bibliofeatures[] = {

View File

@ -36,8 +36,8 @@ using namespace std;
using namespace lyx::support;
QString const math_fonts[] = {"cmex10", "cmmi10", "cmr10", "cmsy10",
"esint10", "eufm10", "msam10", "msbm10", "rsfs10", "stmary10",
"wasy10"};
"dsrom10", "esint10", "eufm10", "msam10", "msbm10", "rsfs10",
"stmary10", "wasy10"};
int const num_math_fonts = sizeof(math_fonts) / sizeof(*math_fonts);
namespace lyx {
@ -78,6 +78,7 @@ SymbolFont symbol_fonts[] = {
{ CMEX_FAMILY, "cmex10", "-*-cmex10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ MSA_FAMILY, "msam10", "-*-msam10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ MSB_FAMILY, "msbm10", "-*-msbm10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ DS_FAMILY, "dsrom10", "-*-dsrom10-*-*-*-*-*-*-*-*-*-*-*-*" },
{ EUFRAK_FAMILY,"eufm10", "-*-eufm10-medium-*-*-*-*-*-*-*-*-*-*-*" },
{ RSFS_FAMILY, "rsfs10", "-*-rsfs10-medium-*-*-*-*-*-*-*-*-*-*-*" },
{ STMARY_FAMILY,"stmary10","-*-stmary10-medium-*-*-*-*-*-*-*-*-*-*-*" },
@ -91,6 +92,7 @@ SymbolFont symbol_fonts[] = {
{ CMEX_FAMILY, "cmex10"},
{ MSA_FAMILY, "msam10"},
{ MSB_FAMILY, "msbm10"},
{ DS_FAMILY, "dsrom10"},
{ EUFRAK_FAMILY,"eufm10"},
{ RSFS_FAMILY, "rsfs10"},
{ STMARY_FAMILY,"stmary10"},

View File

@ -134,6 +134,8 @@ void InsetMathFont::validate(LaTeXFeatures & features) const
features.require("tipa");
if (fontname == "ce" || fontname == "cf")
features.require("mhchem");
if (fontname == "mathds")
features.require("dsfont");
} else if (features.runparams().math_flavor == OutputParams::MathAsHTML) {
features.addCSSSnippet(
"span.normal{font: normal normal normal inherit serif;}\n"
@ -163,9 +165,11 @@ void InsetMathFont::htmlize(HtmlStream & os) const
variant = "normal";
else if (tag == "frak" || tag == "mathfrak")
variant = "fraktur";
else if (tag == "mathbb" || tag == "mathbf"
|| tag == "textbf")
else if (tag == "mathbf" || tag == "textbf")
variant = "bold";
else if (tag == "mathbb" || tag == "mathbbm"
|| tag == "mathds")
variant = "double-struck";
else if (tag == "mathcal")
variant = "script";
else if (tag == "mathit" || tag == "textsl"
@ -220,7 +224,7 @@ void InsetMathFont::mathmlize(MathStream & os) const
// no support at present for textipa, textsc, noun
if (!variant.empty()) {
if (tag == "mathbb") {
if (tag == "mathbb" || tag == "mathds") {
os << MTag("mstyle", "class='mathbb' mathvariant='" + variant + "'")
<< cell(0)
<< ETag("mstyle");

View File

@ -272,6 +272,8 @@ void initSymbols()
tmp.required = "wasysym";
else if (tmp.inset == "mathscr")
tmp.required = "mathrsfs";
else if (tmp.inset == "mathds")
tmp.required = "dsfont";
}
// symbol font is not available sometimes

View File

@ -775,6 +775,8 @@ fontinfo fontinfos[] = {
inh_shape, Color_math},
{"mathbb", MSB_FAMILY, inh_series,
inh_shape, Color_math},
{"mathds", DS_FAMILY, inh_series,
inh_shape, Color_math},
{"mathtt", TYPEWRITER_FAMILY, inh_series,
inh_shape, Color_math},
{"mathit", inh_family, inh_series,