]> git.lyx.org Git - lyx.git/commitdiff
Re-fix #2005
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 15 Aug 2019 07:20:40 +0000 (09:20 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Thu, 15 Aug 2019 07:20:40 +0000 (09:20 +0200)
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
src/insets/InsetGraphics.cpp
status.23x

index 2d3358254bcfc7fb161e7d4763590f50c05c2a53..b9580222608a33567dedc840db0c950bd422f2a4 100644 (file)
@@ -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,
index 3e4d423c87e77d529ccd990616c1f7a09149285d..b603d2c5fda9d7fc6ef53389f232eb3ae5ff5dcb 100644 (file)
@@ -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<Language const *> 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())
index c0bd645c883d9b10dae7b7db78dc5ca58b38277c..398e647e2ad4391700683553f1580ec8c11f40ab 100644 (file)
@@ -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).