The attached patch allows reLyX to recognise 'm' column descriptors in 
tables. Applying it would squash bug. (I forget which number because 
bugzilla is currently refusing connections.) 

'm' column descriptors are functionally equivalent to 'p' ones, but this 
patch simply adds to the 'special' field so that the LaTeX exported by LyX 
is identical to the LaTeX it imported.

The user has no visual feedback about this fixed width column, but it 
strikes me that we could actually have the best of both worlds if I also 
set the pwidth field. Ie, invariant LaTeX _and_ visual feedback.

Shall I do this?
Jean-Marc, is this something that you'd like to see in 1.3.x too?
-- 
Angus
Index: lib/reLyX//RelyxTable.pm
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/reLyX/RelyxTable.pm,v
retrieving revision 1.5
diff -u -p -r1.5 RelyxTable.pm
--- lib/reLyX//RelyxTable.pm	5 Feb 2003 11:27:51 -0000	1.5
+++ lib/reLyX//RelyxTable.pm	5 Feb 2003 12:14:47 -0000
@@ -68,7 +68,7 @@ sub parse_cols {
     while (@group) {
 
 	$tok = shift(@group);
-	# Each $tok will consist of /^[clr|]*[p*@]?$/
+	# Each $tok will consist of /^[clr|]*[mp*@]?$/
 	# (Except first may have | and/or @ expressions before it)
 	# p*@ will end the $tok since after it comes a group in braces
 	# @ will be a TT::Token, everything else will be in TT::Text
@@ -86,13 +86,14 @@ sub parse_cols {
 	@new_cols = ($description =~ /[clr]\|*/g);
 	push @cols, @new_cols;
 
-	# parse a p or * or @ if necessary
+	# parse a 'p', an 'm', a '*' or a '@' as necessary
 	# use exact_print in case there's weird stuff in the @ descriptions
 	$description = substr($description,-1);
-	if ($description eq 'p') {
+	# The m and p descriptors have identical form.
+	if ($description eq 'p' || $description eq 'm') {
 	    $tok = shift(@group);
-	    my $pdes = $description . $tok->exact_print; # "p{foo}"
-	    push @cols, $pdes;
+	    my $des = $description . $tok->exact_print; # 'p{foo}' or 'm{foo}'
+	    push @cols, $des;
 
 	} elsif ($description eq '@') {
 	    $tok = shift(@group);
@@ -376,8 +377,11 @@ package RelyxTable::Column;
 	$col->{"pwidth"} = "";
 	$col->{"special"} = "";
 
-	# Any special (@) column should be handled differently
-	if ($description =~ /\@/) {
+	# LyX cannot handle '@' or 'm' columns in a WYSIWYG manner, so
+	# just place these descriptors in the 'special' field.
+	# They will not be shown on the screen but will be exported back
+	# to LaTeX again.
+	if ($description =~ /\@/ || $description =~ /^m/ ) {
 	   # Just put the whole description in "special" field --- this
 	   # corresponds the the "extra" field in LyX table popup
 	   # Note that LyX ignores alignment, r/l lines for a special column

Reply via email to