Georg Baum wrote:

> Jean-Marc Lasgouttes wrote:
> 
>>>>>>> "Georg" == Georg Baum
>>>>>>>
<[EMAIL PROTECTED]>
>>>>>>> writes:
>> 
>> Georg> Jean-Marc, bug 1542 is only fixed partially in 1.3 (we got a
>> Georg> new report two days ago): If you enter "&" in math mode it is
>> Georg> saved as "&", but it should be saved as "\&". Backporting the
>> Georg> fix from 1.4 is trivial, do you want me to do it?
>> 
>> Yes, please.
> 
> It turned out that the fix in 1.4 is incomplete: If you insert an '&'
> inside an mbox or textrm it is blue instead of black, but this is not the
> biggest problem: If you'll read such a file again you have suddenly a
> space behind the ampersand. The attached patch (against 1.4) fixes that,
> but I am not 100% sure wether it is correct.

It was not: spaces after & were swallowed. But I remember now that
text-in-math is waiting for the new mbox inset in 1.5 and is partly broken
both in 1.3 and 1.4 . Since this patch is a monotonous improvement over the
current situation (& in text-in-math always resulted in invalid latex
before, now it is correct in some cases and swallows spaces if there are
any) I suggest to apply the attached patch to 1.3.

OK?


Georg
Index: status.13x
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/Attic/status.13x,v
retrieving revision 1.1.2.240
diff -u -p -r1.1.2.240 status.13x
--- status.13x	7 Apr 2005 10:20:36 -0000	1.1.2.240
+++ status.13x	8 Apr 2005 12:25:45 -0000
@@ -50,6 +50,8 @@ What's new
 - Fix crash when reading equations containing more columns than allowed 
   [bug 1542].
 
+- Store typed '&' characters in math as '\&' [bug 1542].
+
 - Make sure that the amsmath package is used in LaTeX output when
   using the AMS-specific array environments and over/under arrows in
   equations.
Index: lib/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.363.2.103
diff -u -p -r1.363.2.103 ChangeLog
--- lib/ChangeLog	25 Mar 2005 16:27:41 -0000	1.363.2.103
+++ lib/ChangeLog	8 Apr 2005 12:03:54 -0000
@@ -1,3 +1,7 @@
+2005-04-08  Georg Baum  <[EMAIL PROTECTED]>
+
+	* lib/symbols: treat & as special character (fixes bug 1542 completely)
+
 2005-03-25  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* layouts/revtex4.layout: indicate that the revtex4 class provides
Index: lib/symbols
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/symbols,v
retrieving revision 1.40.2.1
diff -u -p -r1.40.2.1 symbols
--- lib/symbols	28 Mar 2003 17:52:28 -0000	1.40.2.1
+++ lib/symbols	8 Apr 2005 12:03:55 -0000
@@ -766,6 +768,7 @@ exp                lyxblacktext  0   0 f
 }                  mathnormal    0   0 special  x
 $                  mathnormal    0   0 special  x
 %                  mathnormal    0   0 special  x
+&                  mathnormal    0   0 special  x
 # don't remove the space from the beginning of the next line
  #                 mathnormal    0   0 special  x
 
Index: src/mathed/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/ChangeLog,v
retrieving revision 1.299.2.20
diff -u -p -r1.299.2.20 ChangeLog
--- src/mathed/ChangeLog	30 Mar 2005 09:16:05 -0000	1.299.2.20
+++ src/mathed/ChangeLog	8 Apr 2005 12:04:05 -0000
@@ -1,3 +1,8 @@
+2005-04-08  Georg Baum  <[EMAIL PROTECTED]>
+
+	* math_cursor.C (interpret): treat & as special character (fixes
+	bug 1542 completely)
+
 2005-03-30  Georg Baum  <[EMAIL PROTECTED]>
 
 	* math_amsarrayinset.[Ch] (validate): new, require amsmath
Index: src/mathed/math_cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/Attic/math_cursor.C,v
retrieving revision 1.333.2.2
diff -u -p -r1.333.2.2 math_cursor.C
--- src/mathed/math_cursor.C	7 Dec 2004 10:49:50 -0000	1.333.2.2
+++ src/mathed/math_cursor.C	8 Apr 2005 12:04:05 -0000
@@ -1234,8 +1246,8 @@ bool MathCursor::interpret(char c)
 		return true;
 	}
 
-	if (c == '$') {
-		insert(createMathInset("$"));
+	if (c == '$' || c == '&') {
+		insert(createMathInset(string(1, c)));
 		return true;
 	}
 

Reply via email to