properly validate unicode-math

This commit is contained in:
Juergen Spitzmueller 2012-09-24 13:56:37 +02:00
parent 8bf5d4b461
commit 398b1a450a
2 changed files with 8 additions and 4 deletions

View File

@ -1259,6 +1259,9 @@ void BufferParams::validate(LaTeXFeatures & features) const
|| useNonTeXFonts))
features.require("polyglossia");
if (useNonTeXFonts && fonts_math != "auto")
features.require("unicode-math");
if (!language->requires().empty())
features.require(language->requires());
}
@ -1421,10 +1424,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
if (useNonTeXFonts) {
os << "\\usepackage{fontspec}\n";
if (fonts_math != "auto" && features.isAvailable("unicode-math")) {
features.require("unicode-math");
if (features.mustProvide("unicode-math")
&& features.isAvailable("unicode-math"))
os << "\\usepackage{unicode-math}\n";
}
}
// font selection must be done before loading fontenc.sty

View File

@ -697,9 +697,11 @@ void Encodings::validate(char_type c, LaTeXFeatures & features, bool for_mathed)
bool const use_text = (for_mathed && isTextCmd(c)) ||
(!for_mathed && !it->second.textcommand.empty());
bool const plain_utf8 = (features.runparams().encoding->name() == "utf8-plain");
bool const unicode_math = (features.isRequired("unicode-math")
&& features.isAvailable("unicode-math"));
// with utf8-plain, we only load packages when in mathed (see #7766)
// and if we do not use unicode-math
if ((math_mode && !features.isRequired("unicode-math"))
if ((math_mode && !unicode_math)
|| (use_math && !plain_utf8)) {
if (!it->second.mathpreamble.empty()) {
if (it->second.mathfeature()) {