void LaTeXFeatures::useLayout(docstring const & layoutname)
{
// Some code to avoid loops in dependency definition
+ // FIXME THREAD
static int level = 0;
const int maxlevel = 30;
if (level > maxlevel) {
bool LaTeXFeatures::hasOnlyPolyglossiaLanguages() const
{
+ // first the main language
+ if (params_.language->polyglossia().empty())
+ return false;
+ // now the secondary languages
LanguageList::const_iterator const begin = UsedLanguages_.begin();
for (LanguageList::const_iterator cit = begin;
cit != UsedLanguages_.end();
bool LaTeXFeatures::hasPolyglossiaExclusiveLanguages() const
{
+ // first the main language
+ if (params_.language->isPolyglossiaExclusive())
+ return true;
+ // now the secondary languages
LanguageList::const_iterator const begin = UsedLanguages_.begin();
for (LanguageList::const_iterator cit = begin;
cit != UsedLanguages_.end();
"fancybox",
"calc",
"units",
- "tipa",
- "tipx",
- "tone",
"framed",
"soul",
"textcomp",
"multicol",
"multirow",
"tfrupee",
- "shapepar"
+ "shapepar",
+ "rsphrase",
+ "algorithm2e",
+ "sectionbox",
+ "tcolorbox"
};
char const * bibliofeatures[] = {
// 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)
+ // The tipa package and its extensions (tipx, tone) must not
+ // be loaded with non-TeX fonts, since fontspec includes the
+ // respective macros
+ if (mustProvide("tipa") && !params_.useNonTeXFonts)
+ packages << "\\usepackage{tipa}\n";
+ if (mustProvide("tipx") && !params_.useNonTeXFonts)
+ packages << "\\usepackage{tipx}\n";
+ if (mustProvide("tone") && !params_.useNonTeXFonts)
+ packages << "\\usepackage{tone}\n";
+
+ // 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
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
if (mustProvide("setspace") && !isProvided("SetSpace"))
packages << "\\usepackage{setspace}\n";
- // esint must be after amsmath and wasysym, since it will redeclare
- // inconsistent integral symbols
+ // we need to assure that mhchem is loaded before esint
+ // because esint must be loaded AFTER amslatex and 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";
+
+ // esint must be after amsmath (and packages requiring amsmath, like mhchem)
+ // and wasysym, since it will redeclare inconsistent integral symbols
if (mustProvide("esint") &&
params_.use_package("esint") != BufferParams::package_off)
packages << "\\usepackage{esint}\n";
packages << "\\PassOptionsToPackage{normalem}{ulem}\n"
"\\usepackage{ulem}\n";
- if (mustProvide("mhchem") &&
- params_.use_package("mhchem") != BufferParams::package_off)
- packages << "\\PassOptionsToPackage{version=3}{mhchem}\n"
- "\\usepackage{mhchem}\n";
-
if (mustProvide("nomencl")) {
// Make it work with the new and old version of the package,
// but don't use the compatibility option since it is
// effect. (Lgb)
}
if (cit->second)
- os << "\n\\newsubfloat{" << from_ascii(fl.floattype()) << "}\n";
+ // The subfig package is loaded later
+ os << "\n\\AtBeginDocument{\\newsubfloat{" << from_ascii(fl.floattype()) << "}}\n";
}
}