X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fbufferparams.C;h=e4d23afe0b17614abefc3cacf998cf8e2f6b135b;hb=35204f8f33d7400a5fefeffea533fb4cb4097211;hp=bd7167a3fb4d724af26a725224c92f2eb015715e;hpb=49070b4c004594c295b80c6612e368b62f5d44f3;p=lyx.git diff --git a/src/bufferparams.C b/src/bufferparams.C index bd7167a3fb..e4d23afe0b 100644 --- a/src/bufferparams.C +++ b/src/bufferparams.C @@ -174,23 +174,22 @@ SidesTranslator const & sidestranslator() } +// LaTeX packages +typedef Translator PackageTranslator; -// AMS -typedef Translator AMSTranslator; - -AMSTranslator const init_amstranslator() +PackageTranslator const init_packagetranslator() { - AMSTranslator translator(0, BufferParams::AMS_OFF); - translator.addPair(1, BufferParams::AMS_AUTO); - translator.addPair(2, BufferParams::AMS_ON); + PackageTranslator translator(0, BufferParams::package_off); + translator.addPair(1, BufferParams::package_auto); + translator.addPair(2, BufferParams::package_on); return translator; } -AMSTranslator const & amstranslator() +PackageTranslator const & packagetranslator() { - static AMSTranslator translator = init_amstranslator(); + static PackageTranslator translator = init_packagetranslator(); return translator; } @@ -297,7 +296,8 @@ BufferParams::BufferParams() papersize = PAPER_DEFAULT; orientation = ORIENTATION_PORTRAIT; use_geometry = false; - use_amsmath = AMS_AUTO; + use_amsmath = package_auto; + use_esint = package_auto; cite_engine = biblio::ENGINE_BASIC; use_bibtopic = false; trackChanges = false; @@ -482,7 +482,11 @@ string const BufferParams::readToken(LyXLex & lex, string const & token) } else if (token == "\\use_amsmath") { int use_ams; lex >> use_ams; - use_amsmath = amstranslator().find(use_ams); + use_amsmath = packagetranslator().find(use_ams); + } else if (token == "\\use_esint") { + int useesint; + lex >> useesint; + use_esint = packagetranslator().find(useesint); } else if (token == "\\cite_engine") { string engine; lex >> engine; @@ -632,6 +636,7 @@ void BufferParams::writeFile(ostream & os) const os << "\\papersize " << string_papersize[papersize] << "\n\\use_geometry " << convert(use_geometry) << "\n\\use_amsmath " << use_amsmath + << "\n\\use_esint " << use_esint << "\n\\cite_engine " << citeenginetranslator().find(cite_engine) << "\n\\use_bibtopic " << convert(use_bibtopic) << "\n\\paperorientation " << string_orientation[orientation] @@ -1012,13 +1017,13 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // Now insert the LyX specific LaTeX commands... // The optional packages; - string lyxpreamble(features.getPackages()); + docstring lyxpreamble(from_ascii(features.getPackages())); // this might be useful... lyxpreamble += "\n\\makeatletter\n"; // Some macros LyX will need - string tmppreamble(features.getMacros()); + docstring tmppreamble(from_ascii(features.getMacros())); if (!tmppreamble.empty()) { lyxpreamble += "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% " @@ -1036,9 +1041,10 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, /* the user-defined preamble */ if (!preamble.empty()) { + // FIXME UNICODE lyxpreamble += "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% " "User specified LaTeX commands.\n" - + preamble + '\n'; + + from_utf8(preamble) + '\n'; } // Itemize bullet settings need to be last in case the user @@ -1047,11 +1053,11 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // Actually it has to be done much later than that // since some packages like frenchb make modifications // at \begin{document} time -- JMarc - string bullets_def; + docstring bullets_def; for (int i = 0; i < 4; ++i) { if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) { if (bullets_def.empty()) - bullets_def="\\AtBeginDocument{\n"; + bullets_def += "\\AtBeginDocument{\n"; bullets_def += " \\def\\labelitemi"; switch (i) { // `i' is one less than the item to modify @@ -1067,9 +1073,8 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, bullets_def += 'v'; break; } - // FIXME UNICODE bullets_def += '{' + - lyx::to_ascii(user_defined_bullet(i).getText()) + user_defined_bullet(i).getText() + "}\n"; } } @@ -1081,8 +1086,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // with other packages. // Jurabib has to be called after babel, though. if (use_babel && !features.isRequired("jurabib")) { - lyxpreamble += babelCall(language_options.str()) + '\n'; - lyxpreamble += features.getBabelOptions(); + // FIXME UNICODE + lyxpreamble += from_utf8(babelCall(language_options.str())) + '\n'; + lyxpreamble += from_utf8(features.getBabelOptions()); } lyxpreamble += "\\makeatother\n"; @@ -1103,8 +1109,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, texrow.newline(); } - // FIXME UNICODE - os << from_utf8(lyxpreamble); + os << lyxpreamble; return use_babel; }