From 9149deb9fe395aca6004f26798fbf606756e73b9 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Wed, 14 Aug 2019 14:49:38 +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. --- lib/languages | 5 ++--- src/insets/InsetGraphics.cpp | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/languages b/lib/languages index 9cadbe7b45..ca08344f80 100644 --- a/lib/languages +++ b/lib/languages @@ -1007,6 +1007,7 @@ Language latin GuiName "Latin" BabelName latin PolyglossiaName latin + ActiveChars ^= Encoding iso8859-15 FontEncoding T1|OT1 LangCode la_LA @@ -1471,13 +1472,11 @@ Language turkish BabelName turkish PolyglossiaName turkish QuoteStyle english + ActiveChars = Encoding iso8859-9 FontEncoding T1|OT1 LangCode tr_TR DateFormats "d MMMM yyyy|dd.MMM.yyyy|dd.MM.yyyy" - 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 c05075583b..04edf265a8 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -841,18 +841,25 @@ 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, '=') && contains(runparams.active_chars, '=')) { + // We have a language that makes = active. Deactivate locally + // for keyval option parsing (#2005). + before = "\\begingroup\\catcode`\\=12"; + after = "\\endgroup"; + } + + 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()) -- 2.39.5