The branch, 2.0.x, has been updated.

- Log -----------------------------------------------------------------

commit 63caef55052207982b9df95862bfd8b174696e7c
Author: Enrico Forestieri <[email protected]>
Date:   Tue Aug 21 04:04:54 2012 +0200

    Fix bug #8306: LyX incorrectly imports mhchem commands outside math mode
    
    Those commands can also be used in text mode but tex2lyx tries to
    translate their argument causing havoc. So, import the whole commands
    as ERT.
    
    (cherry picked from commit ac92f2a79b85fac329a4d50def73cce9453d7073)

diff --git a/lib/syntax.default b/lib/syntax.default
index 0d235f1..62c4eea 100644
--- a/lib/syntax.default
+++ b/lib/syntax.default
@@ -400,6 +400,8 @@ $$
 \bottomfraction
 \caption[]{}
 \cc{}
+\ce{}
+\cf{}
 \ccname
 \centering
 \centerline{translate}
diff --git a/status.20x b/status.20x
index 9f07dc6..2b90afa 100644
--- a/status.20x
+++ b/status.20x
@@ -119,6 +119,8 @@ What's new
 - Fix support for mhchem upward arrows, which in mathed are rendered as
   empty (brace insets) superscripts (bug 8305).
 
+- Fix tex2lyx import of mhchem commands outside math mode (bug 8306).
+
 
 * USER INTERFACE
 

commit 0e33060337266bbc49a1af348913e57ae0e8ef86
Author: Enrico Forestieri <[email protected]>
Date:   Tue Aug 21 01:30:51 2012 +0200

    Fix bug #8305: ^ symbol does not render into upward arrow when using mhchem
    
    The mhchem package treats the caret both as a shorthand for \uparrow or
    as a superscript operator according to whether it is surrounded by
    spaces or not. The \ce and \cf insets allow inserting spaces but there
    is no provision for inserting a space after the caret, which is always
    considered by LyX as a superscript operator. The solution here is to
    insert a space after the caret if the superscript is empty or an empty
    brace inset.
    
    Mathed does not allow empty superscripts, so an empty brace has to be
    inserted when working in LyX. On the other hand, when importing latex
    code, an empty superscript is retained.
    
    This has no effect whatsoever for normal latex code, as a space after
    the caret is ignored. In any case, the output is only changed if an
    empty brace inset is used as superscript. Specifically, the output is
    changed from "^{{}}" to "^ {}".
    
    (cherry picked from commit f251e0189279147cbf20c4b4ad4ba4256396fd44)

diff --git a/src/mathed/InsetMathScript.cpp b/src/mathed/InsetMathScript.cpp
index 046b679..f60b090 100644
--- a/src/mathed/InsetMathScript.cpp
+++ b/src/mathed/InsetMathScript.cpp
@@ -15,6 +15,7 @@
 #include "DispatchResult.h"
 #include "FuncRequest.h"
 #include "FuncStatus.h"
+#include "InsetMathBrace.h"
 #include "InsetMathFont.h"
 #include "InsetMathScript.h"
 #include "InsetMathSymbol.h"
@@ -547,8 +548,16 @@ void InsetMathScript::write(WriteStream & os) const
        if (hasDown() /*&& down().size()*/)
                os << "_{" << down() << '}';
 
-       if (hasUp() /*&& up().size()*/)
-               os << "^{" << up() << '}';
+       if (hasUp() /*&& up().size()*/) {
+               // insert space if up() is empty or an empty brace inset
+               // (see bug 8305)
+               if (os.latex() && (up().size() == 0 ||
+                   (up().size() == 1 && up().back()->asBraceInset() &&
+                    up().back()->asBraceInset()->cell(0).empty())))
+                       os << "^ {}";
+               else
+                       os << "^{" << up() << '}';
+       }
 
        if (lock_ && !os.latex())
                os << "\\lyxlock ";
diff --git a/status.20x b/status.20x
index b69d477..9f07dc6 100644
--- a/status.20x
+++ b/status.20x
@@ -116,6 +116,9 @@ What's new
 
 - Fix LaTeX output of IPA tone symbols.
 
+- Fix support for mhchem upward arrows, which in mathed are rendered as
+  empty (brace insets) superscripts (bug 8305).
+
 
 * USER INTERFACE
 

-----------------------------------------------------------------------

Summary of changes:
 lib/syntax.default             |    2 ++
 src/mathed/InsetMathScript.cpp |   13 +++++++++++--
 status.20x                     |    5 +++++
 3 files changed, 18 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
The LyX Source Repository

Reply via email to