Fix bug #6377: Tex2lyx error with multiple languages.

We have to set the language again when a new paragraph is started. Otherwise the n'th paragraph in a certain language is set to the document language.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33727 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-03-12 18:36:19 +00:00
parent 7d30e34b08
commit 487e9ad92a
3 changed files with 9 additions and 8 deletions

View File

@ -50,7 +50,8 @@ bool operator==(TeXFont const & f1, TeXFont const & f2)
f1.size == f2.size &&
f1.family == f2.family &&
f1.series == f2.series &&
f1.shape == f2.shape;
f1.shape == f2.shape &&
f1.language == f2.language;
}
@ -65,6 +66,8 @@ void output_font_change(ostream & os, TeXFont const & oldfont,
os << "\n\\shape " << newfont.shape << '\n';
if (oldfont.size != newfont.size)
os << "\n\\size " << newfont.size << '\n';
if (oldfont.language != newfont.language)
os << "\n\\lang " << newfont.language << '\n';
}

View File

@ -40,11 +40,13 @@ public:
family = "default";
series = "default";
shape = "default";
language = "default";
}
std::string size;
std::string family;
std::string series;
std::string shape;
std::string language;
};

View File

@ -1121,8 +1121,6 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
Context & context)
{
Layout const * newlayout = 0;
// store the current selectlanguage to be used after \foreignlanguage
string selectlang;
// Store the latest bibliographystyle (needed for bibtex inset)
string bibliographystyle;
bool const use_natbib = used_packages.find("natbib") != used_packages.end();
@ -2215,10 +2213,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
// save the language for the case that a
// \foreignlanguage is used
//FIXME: this is wrong, the language should
// be saved in the context. (JMarc)
selectlang = subst(p.verbatim_item(), "\n", " ");
os << "\\lang " << selectlang << "\n";
context.font.language = subst(p.verbatim_item(), "\n", " ");
os << "\\lang " << context.font.language << "\n";
}
else if (t.cs() == "foreignlanguage") {
@ -2229,7 +2225,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
// has to be parsed (like for \textsf, for
// example).
// set back to last selectlanguage
os << "\n\\lang " << selectlang << "\n";
os << "\n\\lang " << context.font.language << "\n";
}
else if (t.cs() == "inputencoding") {