From 1c2700eb113275516a4075ecea7b4c6b67f9abe8 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 15 Aug 2019 09:20:40 +0200 Subject: [PATCH] Re-fix #2005 Loading keyval does not work any longer. Fix it properly by de-activating the equal character locally if graphics options use it. We do this statically for Turkish and Latin in stable, as opposed to master (where we have the ActiveChars languages tag) --- lib/languages | 3 --- src/insets/InsetGraphics.cpp | 26 ++++++++++++++++++++------ status.23x | 3 +++ 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/lib/languages b/lib/languages index 2d3358254b..b958022260 100644 --- a/lib/languages +++ b/lib/languages @@ -1150,9 +1150,6 @@ Language turkish QuoteStyle english Encoding iso8859-9 LangCode tr_TR - PostBabelPreamble - \usepackage{xkeyval} - EndPostBabelPreamble End # turkmen must be loaded locally with babel options, diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 3e4d423c87..b603d2c5fd 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -60,6 +60,7 @@ TODO #include "FuncRequest.h" #include "FuncStatus.h" #include "InsetIterator.h" +#include "Language.h" #include "LaTeXFeatures.h" #include "Length.h" #include "Lexer.h" @@ -835,18 +836,31 @@ void InsetGraphics::latex(otexstream & os, string before; string after; - if (runparams.moving_arg) - before += "\\protect"; - - // We never use the starred form, we use the "clip" option instead. - before += "\\includegraphics"; - // Write the options if there are any. bool const ps = runparams.flavor == OutputParams::LATEX || runparams.flavor == OutputParams::DVILUATEX; string const opts = createLatexOptions(ps); LYXERR(Debug::GRAPHICS, "\tOpts = " << opts); + if (contains(opts, '=')) { + std::set langs = buffer().masterBuffer()->getLanguages(); + for (auto const lang : langs) { + if (lang->lang() == "turkish" || lang->lang() == "latin") { + // Turkish and Latin activate = (#2005). + // Deactivate locally for keyval option parsing + before = "\\begingroup\\catcode`\\=12"; + after = "\\endgroup"; + break; + } + } + } + + if (runparams.moving_arg) + before += "\\protect"; + + // We never use the starred form, we use the "clip" option instead. + before += "\\includegraphics"; + if (!opts.empty() && !message.empty()) before += ('[' + opts + ',' + message + ']'); else if (!opts.empty() || !message.empty()) diff --git a/status.23x b/status.23x index c0bd645c88..398e647e2a 100644 --- a/status.23x +++ b/status.23x @@ -58,6 +58,9 @@ What's new * DOCUMENT INPUT/OUTPUT +- (Re-)fix problems with activated equal sign and graphic options in Turkish + and Latin documents (bug 2005). + - Fix toprule with booktabs/longtable and captions (bug 11589). - Avoid adding spaces when parsing an array in a macro template (bug 10499). -- 2.39.5