Am Samstag, 19. Februar 2005 13:38 schrieb Paul Smith:
> Dear All
> 
> I am sending you another example showing a bug of tex2lyx. Please,
> recall that I am not a subscriber of your list.

This is in fact a bug of LyX: \| after \left or \right in mathed is parsed 
as |. The attached patch fixes that. OK to apply?


Georg
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/mathed/ChangeLog lyx-1.4-cvs/src/mathed/ChangeLog
--- lyx-1.4-clean/src/mathed/ChangeLog	2005-02-15 18:35:30.000000000 +0100
+++ lyx-1.4-cvs/src/mathed/ChangeLog	2005-02-20 12:59:16.000000000 +0100
@@ -1,3 +1,8 @@
+2005-02-20  Georg Baum  <[EMAIL PROTECTED]>
+
+	* math_parser.C (parse1): Don't parse "\|" following a "\left" or
+	"\right" as "|"
+
 2005-02-14  Angus Leeming  <[EMAIL PROTECTED]>
 
 	* math_rootinset.C (idxUpDown): Silence an MSVC compiler warning
diff -p -r -U 3 -X excl.tmp lyx-1.4-clean/src/mathed/math_parser.C lyx-1.4-cvs/src/mathed/math_parser.C
--- lyx-1.4-clean/src/mathed/math_parser.C	2005-02-15 18:35:30.000000000 +0100
+++ lyx-1.4-cvs/src/mathed/math_parser.C	2005-02-20 13:04:20.000000000 +0100
@@ -1048,11 +1048,15 @@ void Parser::parse1(MathGridInset & grid
 
 		else if (t.cs() == "left") {
 			skipSpaces();
-			string l = getToken().asString();
+			Token const & tl = getToken();
+			// \| and \Vert are equivalent, and MathDelimInset
+			// can't handle \|
+			string const l = tl.cs() == "|" ? "Vert" : tl.asString();
 			MathArray ar;
 			parse(ar, FLAG_RIGHT, mode);
 			skipSpaces();
-			string r = getToken().asString();
+			Token const & tr = getToken();
+			string const r = tr.cs() == "|" ? "Vert" : tr.asString();
 			cell->push_back(MathAtom(new MathDelimInset(l, r, ar)));
 		}
 
@@ -1083,8 +1087,8 @@ void Parser::parse1(MathGridInset & grid
 			}
 
 			else if (name == "split" || name == "cases" ||
-					 name == "gathered" || name == "aligned" ||
-				   name == "alignedat") {
+			         name == "gathered" || name == "aligned" ||
+			         name == "alignedat") {
 				cell->push_back(createMathInset(name));
 				parse2(cell->back(), FLAG_END, mode, false);
 			}

Reply via email to