LaTeXFeatures.cpp: fix bug #9266 also for branch

mhchem loads amsmath and needs therefore be loaded after it but before packages that redefine commands of amsmath. We already take care of esint but not of wasysym
This commit is contained in:
Uwe Stöhr 2014-10-26 13:44:42 +01:00
parent d85bc320e7
commit 515a4f0fee
2 changed files with 19 additions and 15 deletions

View File

@ -891,19 +891,7 @@ string const LaTeXFeatures::getPackages() const
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
// leads to inconsistent integrals. We only load this package if
// the document does not contain integrals (then isRequired("esint")
// is false) or if esint is used, since esint redefines all relevant
// integral symbols from wasysym and amsmath.
// See http://www.lyx.org/trac/ticket/1942
if (mustProvide("wasysym") &&
params_.use_package("wasysym") != BufferParams::package_off &&
(params_.use_package("esint") != BufferParams::package_off || !isRequired("esint")))
packages << "\\usepackage{wasysym}\n";
// accents must be loaded after amsmath
if (mustProvide("accents") &&
params_.use_package("accents") != BufferParams::package_off)
@ -961,14 +949,27 @@ string const LaTeXFeatures::getPackages() const
if (mustProvide("setspace") && !isProvided("SetSpace"))
packages << "\\usepackage{setspace}\n";
// we need to assure that mhchem is loaded before esint
// because esint must be loaded AFTER amslatex and mhchem loads amlatex
// we need to assure that mhchem is loaded before esint and every other
// package that redefines command of amsmath because mhchem loads amlatex
// (this info is from the author of mhchem from June 2013)
if (mustProvide("mhchem") &&
params_.use_package("mhchem") != BufferParams::package_off)
packages << "\\PassOptionsToPackage{version=3}{mhchem}\n"
"\\usepackage{mhchem}\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
// leads to inconsistent integrals. We only load this package if
// the document does not contain integrals (then isRequired("esint")
// is false) or if esint is used, since esint redefines all relevant
// integral symbols from wasysym and amsmath.
// See http://www.lyx.org/trac/ticket/1942
if (mustProvide("wasysym") &&
params_.use_package("wasysym") != BufferParams::package_off &&
(params_.use_package("esint") != BufferParams::package_off || !isRequired("esint")))
packages << "\\usepackage{wasysym}\n";
// esint must be after amsmath (and packages requiring amsmath, like mhchem)
// and wasysym, since it will redeclare inconsistent integral symbols
if (mustProvide("esint") &&

View File

@ -65,6 +65,9 @@ What's new
- Fix incorrect output of ampersands when multiple keys are given for a
citation (bug 9296).
- Fix export of documents that use the LaTeX-packages mhchem and wasysym
(bug 9266).
* LYX2LYX