namespace {
enum OpenEncoding {
- none,
- inputenc,
- CJK
+ none,
+ inputenc,
+ CJK
};
static int open_encoding_ = none;
os << "\\L{";
}
// With CJK, the CJK tag has to be closed first (see below)
- if (runparams.encoding->package() != Encoding::CJK) {
+ if (runparams.encoding->package() != Encoding::CJK
+ && !par_lang.empty()) {
os << from_ascii(subst(
lang_begin_command,
"$$lang",
os << "%\n";
}
// With CJK, the CJK tag had to be closed first (see above)
- if (runparams.encoding->package() == Encoding::CJK) {
+ if (runparams.encoding->package() == Encoding::CJK
+ && !par_lang.empty()) {
os << from_ascii(subst(
lang_begin_command,
"$$lang",
|| (runparams.isLastPar && par_language->babel() != outer_language->babel()));
if (closing_rtl_ltr_environment
- || (runparams.isLastPar && par_language->babel() != outer_language->babel())) {
+ || (runparams.isLastPar
+ && ((!use_polyglossia && par_language->babel() != outer_language->babel())
+ || (use_polyglossia && par_language->polyglossia() != outer_language->polyglossia())))) {
// Since \selectlanguage write the language to the aux file,
// we need to reset the language at the end of footnote or
// float.