[EMAIL PROTECTED] wrote:

> tex2lyx bug.tex > tmp.lyx
> lyx2lyx -t221 tmp.lyx > bug.lyx
> unix2dos bug.lyx

I believe that the last step is not needed.

> The bug can be avoided by replacing \cr with \\ throughout.

And that is what you should do anyway. \cr is a tex construct, not latex. If
you look at the output, you will find small differences between \cr and \\.

There are actually two problems:

1. \cr in tables
2. \cr in math arrays. This could also be fixed in lyx, since tex2lyx writes
math stuff verbatim to the .lyx file.

The attached patch "fixes" tex2lyx. However, I am not sure wether we should
apply it, since the conversion is not 1:1. tex2lyx is rather a latex2lyx
converter, and we have probably other tex commands that don't work.

Opinions?


Georg
Index: src/tex2lyx/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/ChangeLog,v
retrieving revision 1.53
diff -u -r1.53 ChangeLog
--- src/tex2lyx/ChangeLog	28 Jun 2004 06:53:12 -0000	1.53
+++ src/tex2lyx/ChangeLog	23 Jul 2004 15:06:17 -0000
@@ -1,3 +1,8 @@
+2004-07-23  Georg Baum  <[EMAIL PROTECTED]>
+
+	* table.C (parse_table): recognize tex "\\cr" line ending
+	* math.C (parse_math): change tex "\\cr" line ending to "\\\\"
+
 2004-06-28  Georg Baum  <[EMAIL PROTECTED]>
 
 	* math.C, preamble.C, tex2lyx.[Ch], text.C: const fixes
Index: src/tex2lyx/math.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/math.C,v
retrieving revision 1.14
diff -u -r1.14 math.C
--- src/tex2lyx/math.C	28 Jun 2004 06:53:12 -0000	1.14
+++ src/tex2lyx/math.C	23 Jul 2004 15:06:17 -0000
@@ -216,6 +216,10 @@
 		else if (t.cs() == "ss")
 			os << "ß";
 
+		else if (t.cs() == "cr")
+			// lyx can't handle \\cr
+			os << "\\\\";
+
 		else
 			os << t.asInput();
 
Index: src/tex2lyx/table.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/tex2lyx/table.C,v
retrieving revision 1.24
diff -u -r1.24 table.C
--- src/tex2lyx/table.C	19 Nov 2003 10:35:50 -0000	1.24
+++ src/tex2lyx/table.C	23 Jul 2004 15:06:17 -0000
@@ -220,7 +220,7 @@
 			p.skip_spaces();
 		}
 
-		else if (t.cs() == "tabularnewline" || t.cs() == "\\") {
+		else if (t.cs() == "tabularnewline" || t.cs() == "\\" || t.cs() == "cr") {
 			// stuff before the line break
 			// and look ahead for stuff after the line break
 			os << HLINE << hlines << HLINE << LINE << read_hlines(p) << HLINE;

Reply via email to