language patch from dekel

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4150 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-05-10 12:58:07 +00:00
parent 11127801c4
commit b593556d91
4 changed files with 25 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2002-05-10 Dekel Tsur <dekelts@tau.ac.il>
* buffer.C (makeLaTeXFile): Put language options after loading babel.
* LaTeXFeatures.C (getBabelOptions): New method.
2002-05-08 Lars Gullik Bjønnes <larsbj@birdstep.com>
* BufferView_pimpl.C (Dispatch): work around missing argument for

View File

@ -311,14 +311,22 @@ string const LaTeXFeatures::getMacros() const
// floats
getFloatDefinitions(macros);
return macros.str().c_str();
}
string const LaTeXFeatures::getBabelOptions() const
{
ostringstream tmp;
for (LanguageList::const_iterator cit = UsedLanguages.begin();
cit != UsedLanguages.end(); ++cit)
if (!(*cit)->latex_options().empty())
macros << (*cit)->latex_options() << '\n';
tmp << (*cit)->latex_options() << '\n';
if (!params.language->latex_options().empty())
macros << params.language->latex_options() << '\n';
tmp << params.language->latex_options() << '\n';
return macros.str().c_str();
return tmp.str().c_str();
}

View File

@ -50,6 +50,8 @@ public:
string const getPackages() const;
/// The macros definitions needed by the document
string const getMacros() const;
///
string const getBabelOptions() const;
/// The definitions needed by the document's textclass
string const getTClassPreamble() const;
/// The sgml definitions needed by the document (dobook/linuxdoc)

View File

@ -2446,8 +2446,6 @@ void Buffer::makeLaTeXFile(string const & fname,
+ params.preamble + '\n';
}
preamble += "\\makeatother\n";
// Itemize bullet settings need to be last in case the user
// defines their own bullets that use a package included
// in the user-defined preamble -- ARRae
@ -2489,8 +2487,6 @@ void Buffer::makeLaTeXFile(string const & fname,
texrow.newline();
}
ofs << preamble;
// We try to load babel late, in case it interferes
// with other packages.
if (use_babel) {
@ -2500,10 +2496,14 @@ void Buffer::makeLaTeXFile(string const & fname,
tmp = string("\\usepackage[") +
language_options.str().c_str() +
"]{babel}";
ofs << tmp << "\n";
texrow.newline();
preamble += tmp + "\n";
preamble += features.getBabelOptions();
}
preamble += "\\makeatother\n";
ofs << preamble;
// make the body.
ofs << "\\begin{document}\n";
texrow.newline();