* please keep this in sync with known_coded_languages line by line!
*/
const char * const known_languages[] = {"acadian", "afrikaans", "albanian",
-"american", "arabic", "arabtex", "austrian", "bahasa", "bahasai", "bahasam",
-"basque", "belarusian", "brazil", "brazilian", "breton", "british", "bulgarian",
-"canadian", "canadien", "catalan", "croatian", "czech", "danish", "dutch",
-"english", "esperanto", "estonian", "farsi", "finnish", "francais", "french",
-"frenchb", "frenchle", "frenchpro", "galician", "german", "germanb", "greek",
-"hebrew", "hungarian", "icelandic", "indon", "indonesian", "interlingua",
+"american", "arabic", "arabtex", "australian", "austrian", "bahasa", "bahasai",
+"bahasam", "basque", "belarusian", "brazil", "brazilian", "breton", "british",
+"bulgarian", "canadian", "canadien", "catalan", "croatian", "czech", "danish",
+"dutch", "english", "esperanto", "estonian", "farsi", "finnish", "francais",
+"french", "frenchb", "frenchle", "frenchpro", "galician", "german", "germanb",
+"greek", "hebrew", "hungarian", "icelandic", "indon", "indonesian", "interlingua",
"irish", "italian", "kazakh", "latin", "latvian", "lithuanian", "lowersorbian",
"lsorbian", "magyar", "malay", "meyalu", "mongolian", "naustrian", "newzealand",
"ngerman", "ngermanb", "norsk", "nynorsk", "polutonikogreek", "polish",
* please keep this in sync with known_languages line by line!
*/
const char * const known_coded_languages[] = {"french", "afrikaans", "albanian",
-"american", "arabic_arabi", "arabic_arabtex", "austrian", "bahasa", "bahasa", "bahasam",
-"basque", "belarusian", "brazilian", "brazilian", "breton", "british", "bulgarian",
-"canadian", "canadien", "catalan", "croatian", "czech", "danish", "dutch",
-"english", "esperanto", "estonian", "farsi", "finnish", "french", "french",
-"french", "french", "french", "galician", "german", "german", "greek",
-"hebrew", "magyar", "icelandic", "bahasa", "bahasa", "interlingua",
+"american", "arabic_arabi", "arabic_arabtex", "australian", "austrian", "bahasa", "bahasa",
+"bahasam", "basque", "belarusian", "brazilian", "brazilian", "breton", "british",
+"bulgarian", "canadian", "canadien", "catalan", "croatian", "czech", "danish",
+"dutch", "english", "esperanto", "estonian", "farsi", "finnish", "french",
+"french", "french", "french", "french", "galician", "german", "german",
+"greek", "hebrew", "magyar", "icelandic", "bahasa", "bahasa", "interlingua",
"irish", "italian", "kazakh", "latin", "latvian", "lithuanian", "lowersorbian",
-"lowersorbian", "magyar", "bahasam", "bahasam", "mongolian", "naustrian", "english",
+"lowersorbian", "magyar", "bahasam", "bahasam", "mongolian", "naustrian", "newzealand",
"ngerman", "ngerman", "norsk", "nynorsk", "polutonikogreek", "polish",
"portuguese", "portuguese", "romanian", "russian", "russian", "samin",
"scottish", "serbian", "serbian-latin", "slovak", "slovene", "spanish",
0};
/// languages with english quotes (.lyx names)
-const char * const known_english_quotes_languages[] = {"american", "bahasa",
-"bahasam", "brazilian", "canadian", "chinese-simplified", "english",
-"esperanto", "hebrew", "irish", "korean", "portuguese", "scottish", "thai", 0};
+const char * const known_english_quotes_languages[] = {"american", "australian",
+"bahasa", "bahasam", "brazilian", "canadian", "chinese-simplified", "english",
+"esperanto", "hebrew", "irish", "korean", "newzealand", "portuguese", "scottish",
+"thai", 0};
/// languages with french quotes (.lyx names)
const char * const known_french_quotes_languages[] = {"albanian",
"fontbook", "fontwrap", "mathspec", "philokalia", "polyglossia", "unisugar",
"xeCJK", "xecolor", "xecyr", "xeindex", "xepersian", "xunicode", 0};
+/// packages that are automatically skipped if loaded by LyX
+const char * const known_lyx_packages[] = {"array", "booktabs", "calc",
+"color", "float", "graphicx", "hhline", "ifthen", "longtable", "makeidx",
+"multirow", "nomencl", "pdfpages", "rotfloat", "splitidx", "setspace",
+"subscript", "textcomp", "ulem", "url", "varioref", "verbatim", "wrapfig", 0};
+
// codes used to remove packages that are loaded automatically by LyX.
// Syntax: package_beg_sep<name>package_mid_sep<package loading code>package_end_sep
const char package_beg_sep = '\001';
h_html_css_as_file = "0";
h_html_math_output = "0";
h_inputencoding = "auto";
+ h_justification = "true";
h_language = "english";
h_language_package = "none";
//h_listings_params;
h_tocdepth = "3";
h_tracking_changes = "false";
h_use_bibtopic = "false";
+ h_use_indices = "false";
h_use_geometry = "false";
h_use_amsmath = "1";
h_use_default_options = "false";
h_font_sc = "true";
}
- if (name == "mathpazo")
+ else if (name == "mathpazo")
h_font_roman = "palatino";
- if (name == "mathptmx")
+ else if (name == "mathptmx")
h_font_roman = "times";
// sansserif fonts
else if (is_known(name, known_old_language_packages)) {
// known language packages from the times before babel
// if they are found and not also babel, they will be used as
- // cutom language package
+ // custom language package
h_language_package = "\\usepackage{" + name + "}";
}
- else if (name == "makeidx")
- ; // ignore this
-
else if (name == "prettyref")
- ; // ignore this
-
- else if (name == "varioref")
- ; // ignore this
-
- else if (name == "verbatim")
- ; // ignore this
-
- else if (name == "nomencl")
- ; // ignore this
-
- else if (name == "textcomp")
- ; // ignore this
+ ; // ignore this FIXME: Use the package separator mechanism instead
else if (name == "lyxskak") {
// ignore this and its options
- if (!options.empty())
- options.clear();
+ const char * const o[] = {"ps", "mover", 0};
+ delete_opt(options, o);
}
- else if (name == "url")
- ; // ignore this
-
- else if (name == "array" || name == "booktabs" ||
- name == "color" || name == "hhline" ||
- name == "longtable" || name == "subscript" ||
- name == "ulem") {
+ else if (is_known(name, known_lyx_packages) && options.empty()) {
if (!in_lyx_preamble)
h_preamble << package_beg_sep << name
<< package_mid_sep << "\\usepackage{"
- << name << '}' << package_end_sep;
+ << name << "}\n" << package_end_sep;
}
- else if (name == "graphicx")
- ; // ignore this
-
- else if (name == "setspace")
- ; // ignore this
-
else if (name == "geometry")
handle_geometry(options);
- else if (name == "rotfloat")
- ; // ignore this
-
- else if (name == "wrapfig")
- ; // ignore this
-
else if (name == "subfig")
- ; // ignore this
+ ; // ignore this FIXME: Use the package separator mechanism instead
else if (is_known(name, known_languages))
h_language = name;
}
-bool Preamble::writeLyXHeader(ostream & os)
+bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
{
// translate from babel to LyX names
h_language = babel2lyx(h_language);
else if (is_known(h_language, known_english_quotes_languages))
h_quotes_language = "english";
+ if (contains(h_float_placement, "H"))
+ registerAutomaticallyLoadedPackage("float");
+ if (h_spacing != "single" && h_spacing != "default")
+ registerAutomaticallyLoadedPackage("setspace");
+
// output the LyX file settings
os << "#LyX file created by tex2lyx " << PACKAGE_VERSION << "\n"
<< "\\lyxformat " << LYX_FORMAT << '\n'
<< "\\begin_document\n"
<< "\\begin_header\n"
<< "\\textclass " << h_textclass << "\n";
- string const raw = h_preamble.str();
+ string const raw = subdoc ? empty_string() : h_preamble.str();
if (!raw.empty()) {
os << "\\begin_preamble\n";
for (string::size_type i = 0; i < raw.size(); ++i) {
<< "\\use_undertilde " << h_use_undertilde << "\n"
<< "\\cite_engine " << h_cite_engine << "\n"
<< "\\use_bibtopic " << h_use_bibtopic << "\n"
+ << "\\use_indices " << h_use_indices << "\n"
<< "\\paperorientation " << h_paperorientation << '\n'
<< "\\suppress_date " << h_suppress_date << '\n'
+ << "\\justification " << h_justification << '\n'
<< "\\use_refstyle " << h_use_refstyle << '\n';
if (!h_fontcolor.empty())
os << "\\fontcolor " << h_fontcolor << '\n';
<< authors_
<< "\\end_header\n\n"
<< "\\begin_body\n";
- // clear preamble for subdocuments
- h_preamble.str("");
return true;
}