mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Load AMS packages before newtxmath (#8824)
This commit is contained in:
parent
967e0db9e0
commit
d1a77eadc1
@ -1445,9 +1445,13 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
|
||||
os << '{' << from_ascii(tclass.latexname()) << "}\n";
|
||||
// end of \documentclass defs
|
||||
|
||||
// if we use fontspec, we have to load the AMS packages here
|
||||
// if we use fontspec or newtxmath, we have to load the AMS packages here
|
||||
string const ams = features.loadAMSPackages();
|
||||
if (useNonTeXFonts && !ams.empty())
|
||||
bool const ot1 = (font_encoding() == "default" || font_encoding() == "OT1");
|
||||
bool const use_newtxmath =
|
||||
theLaTeXFonts().getLaTeXFont(from_ascii(fonts_math)).getUsedPackage(
|
||||
ot1, false, false) == "newtxmath";
|
||||
if ((useNonTeXFonts || use_newtxmath) && !ams.empty())
|
||||
os << from_ascii(ams);
|
||||
|
||||
if (useNonTeXFonts) {
|
||||
|
@ -851,10 +851,15 @@ string const LaTeXFeatures::getPackages() const
|
||||
// The rest of these packages are somewhat more complicated
|
||||
// than those above.
|
||||
|
||||
// if fontspec is used, AMS packages have to be loaded before
|
||||
// fontspec (in BufferParams)
|
||||
// if fontspec or newtxmath is used, AMS packages have to be loaded
|
||||
// before fontspec (in BufferParams)
|
||||
string const amsPackages = loadAMSPackages();
|
||||
if (!params_.useNonTeXFonts && !amsPackages.empty())
|
||||
bool const ot1 = (params_.font_encoding() == "default" || params_.font_encoding() == "OT1");
|
||||
bool const use_newtxmath =
|
||||
theLaTeXFonts().getLaTeXFont(from_ascii(params_.fonts_math)).getUsedPackage(
|
||||
ot1, false, false) == "newtxmath";
|
||||
|
||||
if (!params_.useNonTeXFonts && !use_newtxmath && !amsPackages.empty())
|
||||
packages << amsPackages;
|
||||
|
||||
// fixltx2e must be loaded after amsthm, since amsthm produces an error with
|
||||
@ -863,9 +868,9 @@ string const LaTeXFeatures::getPackages() const
|
||||
if (mustProvide("fixltx2e"))
|
||||
packages << "\\usepackage{fixltx2e}\n";
|
||||
|
||||
if (mustProvide("cancel") &&
|
||||
params_.use_package("cancel") != BufferParams::package_off)
|
||||
packages << "\\usepackage{cancel}\n";
|
||||
if (mustProvide("cancel") &&
|
||||
params_.use_package("cancel") != BufferParams::package_off)
|
||||
packages << "\\usepackage{cancel}\n";
|
||||
// wasysym is a simple feature, but it must be after amsmath if both
|
||||
// are used
|
||||
// wasysym redefines some integrals (e.g. iint) from amsmath. That
|
||||
|
@ -193,6 +193,15 @@ docstring const LaTeXFont::getUsedFont(bool ot1, bool complete, bool nomath)
|
||||
}
|
||||
|
||||
|
||||
docstring const LaTeXFont::getUsedPackage(bool ot1, bool complete, bool nomath)
|
||||
{
|
||||
docstring const usedfont = getUsedFont(ot1, complete, nomath);
|
||||
if (usedfont.empty())
|
||||
return docstring();
|
||||
return theLaTeXFonts().getLaTeXFont(usedfont).package();
|
||||
}
|
||||
|
||||
|
||||
string const LaTeXFont::getAvailablePackage(bool dryrun)
|
||||
{
|
||||
if (package_.empty())
|
||||
|
@ -82,6 +82,8 @@ public:
|
||||
int const & scale = 100);
|
||||
/// Return the actually used font
|
||||
docstring const getUsedFont(bool ot1, bool complete, bool nomath);
|
||||
/// Return the actually used package
|
||||
docstring const getUsedPackage(bool ot1, bool complete, bool nomath);
|
||||
///
|
||||
bool read(Lexer & lex);
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user