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-12 23:58:32 +02:00
parent e20389ed6b
commit 10e1f90883
16 changed files with 2453 additions and 21 deletions

View File

@ -384,6 +384,7 @@ dist_fonts_DATA = \
fonts/cmmi10.ttf \
fonts/cmr10.ttf \
fonts/cmsy10.ttf \
fonts/dsrom10.ttf \
fonts/esint10.ttf \
fonts/eufm10.ttf \
fonts/msam10.ttf \

View File

@ -463,6 +463,69 @@ concrete
fonts.
\end_layout
\begin_layout Subsection
Doublestroke
\end_layout
\begin_layout Description
Found:
\begin_inset Info
type "package"
arg "dsfont"
\end_inset
\end_layout
\begin_layout Description
CTAN:
\family typewriter
fonts/doublestroke
\end_layout
\begin_layout Description
Notes: The package doublestroke provides a font based on Computer Modern
Roman useful for typesetting (through the command
\family typewriter
\backslash
mathds
\family default
) the mathematical symbols for the natural numbers (
\begin_inset Formula $\mathds{N}$
\end_inset
), whole numbers (
\begin_inset Formula $\mathds{Z}$
\end_inset
), rational numbers (
\begin_inset Formula $\mathds{Q}$
\end_inset
), real numbers (
\begin_inset Formula $\mathds{R}$
\end_inset
) and complex numbers (
\begin_inset Formula $\mathds{C}$
\end_inset
); coverage includes all Roman capital letters,
\begin_inset Formula $\mathds{1}$
\end_inset
,
\begin_inset Formula $\mathds{h}$
\end_inset
and
\begin_inset Formula $\mathds{k}$
\end_inset
.
\end_layout
\begin_layout Subsection
EC fonts
\end_layout

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

@ -412,6 +412,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

@ -58,7 +58,7 @@ namespace {
char const * GUIFamilyNames[NUM_FAMILIES + 2 /* default & error */] =
{ N_("Roman"), N_("Sans Serif"), N_("Typewriter"), N_("Symbol"),
"cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "rsfs", "stmry",
"cmr", "cmsy", "cmm", "cmex", "msa", "msb", "ds", "eufrak", "rsfs", "stmry",
"wasy", "esint", N_("Inherit"), N_("Ignore") };
char const * GUISeriesNames[NUM_SERIES + 2 /* default & error */] =
@ -82,7 +82,7 @@ char const * GUIMiscNames[5] =
char const * LaTeXFamilyNames[NUM_FAMILIES + 2] =
{ "textrm", "textsf", "texttt", "error1", "error2", "error3", "error4",
"error5", "error6", "error7", "error8", "error9", "error10", "error11",
"error12", "error13" };
"error12", "error13", "error14" };
char const * LaTeXSeriesNames[NUM_SERIES + 2] =
{ "textmd", "textbf", "error4", "error5" };

View File

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

View File

@ -39,7 +39,7 @@ namespace lyx {
//
char const * LyXFamilyNames[NUM_FAMILIES + 2 /* default & error */] =
{ "roman", "sans", "typewriter", "symbol",
"cmr", "cmsy", "cmm", "cmex", "msa", "msb", "eufrak", "rsfs", "stmry",
"cmr", "cmsy", "cmm", "cmex", "msa", "msb", "ds", "eufrak", "rsfs", "stmry",
"wasy", "esint", "default", "error" };
char const * LyXSeriesNames[NUM_SERIES + 2 /* default & error */] =
@ -443,6 +443,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

@ -1020,7 +1020,8 @@ char const * simplefeatures[] = {
"todonotes",
"forest",
"varwidth",
"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 {
@ -77,6 +77,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-*-*-*-*-*-*-*-*-*-*-*" },

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"
@ -203,9 +207,11 @@ void InsetMathFont::mathmlize(MathStream & 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"
@ -217,17 +223,11 @@ void InsetMathFont::mathmlize(MathStream & os) const
variant = "monospace";
// no support at present for textipa, textsc, noun
if (!variant.empty()) {
if (tag == "mathbb") {
os << MTag("mstyle", "class='mathbb' mathvariant='" + variant + "'")
<< cell(0)
<< ETag("mstyle");
} else {
os << MTag("mstyle", "mathvariant='" + variant + "'")
<< cell(0)
<< ETag("mstyle");
}
} else
if (!variant.empty())
os << MTag("mstyle", "mathvariant='" + variant + "'")
<< cell(0)
<< ETag("mstyle");
else
os << cell(0);
}

View File

@ -272,6 +272,8 @@ void initSymbols()
tmp.requires = "wasysym";
else if (tmp.inset == "mathscr")
tmp.requires = "mathrsfs";
else if (tmp.inset == "mathds")
tmp.requires = "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,

View File

@ -22,6 +22,8 @@ What's new
- Improve UI of math matrix dialog UI (bug 11888).
- Add support for the doublestroke package in mathed (bug 11887).
* MISCELLANEOUS