From: Juergen Spitzmueller Date: Mon, 24 Sep 2012 11:56:37 +0000 (+0200) Subject: properly validate unicode-math X-Git-Tag: 2.1.0beta1~1497 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=398b1a450aa28ffd9f89634e30fd1dba9a4f8a5b;p=features.git properly validate unicode-math --- diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index c99b467282..e3dcb87986 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -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 diff --git a/src/Encoding.cpp b/src/Encoding.cpp index 6447e33eec..3325301a7c 100644 --- a/src/Encoding.cpp +++ b/src/Encoding.cpp @@ -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()) {