"See section 3.1.2.2 (Class Availability) of the\n"
"User's Guide for more information."), desc, prereqs);
frontend::Alert::warning(_("Document class not available"),
- msg);
+ msg, true);
}
} else if (token == "\\begin_preamble") {
readPreamble(lex);
// are doing!
if (features.mustProvide("fix-cm"))
os << "\\RequirePackage{fix-cm}\n";
+ // Likewise for fixltx2e. If other packages conflict with this policy,
+ // treat it as a package bug (and report it!)
+ // See http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=latex/4407
+ if (features.mustProvide("fixltx2e"))
+ os << "\\RequirePackage{fixltx2e}\n";
os << "\\documentclass";
// XeTeX and LuaTeX (with OS fonts) do not need fontenc
if (!useNonTeXFonts && !features.isProvided("fontenc")
&& font_encoding() != "default") {
- vector<string> fontencs;
- // primary language font encoding and default encoding
- if (ascii_lowercase(language->fontenc()) != "none") {
- vector<string> fencs = getVectorFromString(font_encoding());
- fontencs.insert(fontencs.end(), fencs.begin(), fencs.end());
- fencs = getVectorFromString(language->fontenc());
- vector<string>::const_iterator fit = fencs.begin();
- for (; fit != fencs.end(); ++fit) {
- if (find(fontencs.begin(), fontencs.end(), *fit) == fontencs.end())
- fontencs.push_back(*fit);
- }
- }
+ // get main font encodings
+ vector<string> fontencs = font_encodings();
// get font encodings of secondary languages
features.getFontEncodings(fontencs);
if (!fontencs.empty()) {
+ atlyxpreamble + "\\makeatother\n\n";
// We try to load babel late, in case it interferes with other packages.
- // Jurabib, hyperref, varioref and listings (bug 8995) have to be
+ // Jurabib, hyperref, varioref, bicaption and listings (bug 8995) have to be
// called after babel, though.
if (use_babel && !features.isRequired("jurabib")
&& !features.isRequired("hyperref")
features.needBabelLangOptions())) + '\n';
lyxpreamble += from_utf8(features.getBabelPostsettings());
}
+ if (features.isRequired("bicaption"))
+ lyxpreamble += "\\usepackage{bicaption}\n";
if (!listings_params.empty() || features.isRequired("listings"))
lyxpreamble += "\\usepackage{listings}\n";
if (!listings_params.empty()) {
string const BufferParams::font_encoding() const
{
- return (fontenc == "global") ? lyxrc.fontenc : fontenc;
+ return font_encodings().empty() ? "default" : font_encodings().back();
+}
+
+
+vector<string> const BufferParams::font_encodings() const
+{
+ string doc_fontenc = (fontenc == "global") ? lyxrc.fontenc : fontenc;
+
+ vector<string> fontencs;
+
+ // "default" means "no explicit font encoding"
+ if (doc_fontenc != "default") {
+ fontencs = getVectorFromString(doc_fontenc);
+ if (!language->fontenc().empty()
+ && ascii_lowercase(language->fontenc()) != "none") {
+ vector<string> fencs = getVectorFromString(language->fontenc());
+ vector<string>::const_iterator fit = fencs.begin();
+ for (; fit != fencs.end(); ++fit) {
+ if (find(fontencs.begin(), fontencs.end(), *fit) == fontencs.end())
+ fontencs.push_back(*fit);
+ }
+ }
+ }
+
+ return fontencs;
}
// inputenc must be omitted.
// see http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html
if ((!encodings.empty() || package == Encoding::inputenc)
- && !features.isRequired("japanese")) {
+ && !features.isRequired("japanese")
+ && !features.isProvided("inputenc")) {
os << "\\usepackage[";
set<string>::const_iterator it = encodings.begin();
set<string>::const_iterator const end = encodings.end();
break;
case Encoding::inputenc:
// do not load inputenc if japanese is used
- if (features.isRequired("japanese"))
+ // or if the class provides inputenc
+ if (features.isRequired("japanese")
+ || features.isProvided("inputenc"))
break;
os << "\\usepackage[" << from_ascii(encoding().latexName())
<< "]{inputenc}\n";