From 9716e79624a4d39b03f037dbc7cbfb093ff3f2bc Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Sat, 17 Dec 2022 15:04:54 +0100 Subject: [PATCH] inputenc only expects one option File switches with documents are done via \inputencoding. Other than with fontenc, these do not need to be laoded via options beforehand. Also, out current code loaded the additional languages' encoding last, which might result in wrong encoding settings. --- src/BufferParams.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index f1425b8335..71390d7479 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -3394,35 +3394,15 @@ void BufferParams::writeEncodingPreamble(otexstream & os, Encoding::Package const package = language->encoding()->package(); - // Create list of inputenc options: - set encoding_set; - // luainputenc fails with more than one encoding - if (features.runparams().flavor != Flavor::LuaTeX - && features.runparams().flavor != Flavor::DviLuaTeX) - // list all input encodings used in the document - encoding_set = features.getEncodingSet(doc_encoding); - // The "japanese" babel-language requires the pLaTeX engine // which conflicts with "inputenc". // See http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg129680.html - if ((!encoding_set.empty() || package == Encoding::inputenc) + if (package == Encoding::inputenc && !features.isRequired("japanese") && !features.isProvided("inputenc")) { - os << "\\usepackage["; - set::const_iterator it = encoding_set.begin(); - set::const_iterator const end = encoding_set.end(); - if (it != end) { - os << from_ascii(*it); - ++it; - } - for (; it != end; ++it) - os << ',' << from_ascii(*it); - if (package == Encoding::inputenc) { - if (!encoding_set.empty()) - os << ','; - os << from_ascii(doc_encoding); - } - if (features.runparams().flavor == Flavor::LuaTeX + os << "\\usepackage[" + << from_ascii(doc_encoding); + if (features.runparams().flavor == Flavor::LuaTeX || features.runparams().flavor == Flavor::DviLuaTeX) os << "]{luainputenc}\n"; else -- 2.39.2