Hi developpers.

First, thank you once again for your great job (& again & again ... never
too much).

I was a little bit upset by a limitation in tabular : if you need columns
of a given width (e.g. to format successive tables the same way), you
cannot set the H. alignement anymore, unless you do it cell by cell, or
you have to write the whole preamble using "special alignment".

So I modified the tabular.C (and the associated xforms panel) to use the
">{}" construction of the package array. To solve the problem with the
last column, I decided to used \tabularnewline instead of \\ as rows
terminator.
But it failed with latex->html translators, so I added a quick trick to
redefine \tabularnewline in this case (but at the beginning of  every
tabular, so I suppose it will fail when the tabular is preceded by a
\centering or \raggedxxx declaration, and is anyway dirty : should be
moved to the preamble).

Now my questions :
        -Do you think it may be usefull (i.e. do you agree to
check/modify/include it ) ? May be I can help a little bit if you give me
some indications on how to go further (see remarks below).
        - Do you think it is possible to generalize it ?

Remarks :
        - I was unable to find how to obtain a correct display on
screen (the text is still left aligned in its box, so left aligned in the
cell).
        - I didn't checked that it was safe for SGML.

Hope this may help a little bit (if not, forget it!).

Please, send your remarks ( even insults ) to my address too, as I am not
registered to the devel list.

Thank's a lot.

        Alain

-- 
 *******************************************************************
 *        Alain Castera                                            *
 * IPNL - UCB Lyon 1             | e-mail : [EMAIL PROTECTED] *
 * Bat. Paul Dirac               |      or        [EMAIL PROTECTED] *
 * Campus de la Doua             | Telephone :     (+33) 472448429 *
 * F69622 Villeurbanne CEDEX     | Fax :           (+33) 472448004 *
 *******************************************************************
--- src/tabular.C.orig  Fri Jan 18 11:14:57 2002
+++ src/tabular.C       Mon Jan 21 14:32:24 2002
@@ -646,8 +646,8 @@
     int const j = column_of_cell(cell);
 
     column_info[j].p_width = width;
-    if (flag) // do this only if there is a width
-       SetAlignment(cell, LYX_ALIGN_LEFT);
+//    if (flag) // do this only if there is a width
+//      SetAlignment(cell, LYX_ALIGN_LEFT);
     for (int i = 0; i < rows_; ++i) {
        int c = GetCellNumber(i, j);
        flag = !GetPWidth(c).empty(); // because of multicolumns!
@@ -2573,6 +2573,10 @@
     //+                      first the opening preamble                    +
     //+---------------------------------------------------------------------
 
+// added here to help latex->html converters (hecked with latex2html,tth,hevea)
+// should be moved elsewhere,i.e. in the (latex) preamble; AC
+       os << "\\providecommand{\\tabularnewline}{\\\\}\n";
+
     if (rotate) {
        os << "\\begin{sideways}\n";
        ++ret;
@@ -2585,8 +2589,22 @@
        if (column_info[i].left_line)
            os << '|';
        if (!column_info[i].align_special.empty()) {
+// we need a way to justify the text (i.e. just p,b,or m without extra)
            os << column_info[i].align_special;
        } else if (!column_info[i].p_width.empty()) {
+           os << ">{";
+            switch (column_info[i].alignment) {
+            case LYX_ALIGN_LEFT:
+                os << "\\raggedright";
+                break;
+            case LYX_ALIGN_RIGHT:
+                os << "\\raggedleft";
+                break;
+            case LYX_ALIGN_CENTER:
+                os << "\\centering";
+                break;
+            }
+           os << "}";
            switch (column_info[i].valignment) {
            case LYX_VALIGN_TOP:
                os << "p";
@@ -2671,7 +2689,7 @@
            }
            ++cell;
        }
-       os << "\\\\\n";
+       os << "\\tabularnewline\n";
        ++ret;
        ret += TeXBottomHLine(os, i);
        bret = ret;
--- src/frontends/xforms/FormTabular.C.orig     Fri Jan 18 11:54:39 2002
+++ src/frontends/xforms/FormTabular.C  Mon Jan 21 14:19:41 2002
@@ -335,7 +335,8 @@
        fl_set_button(column_options_->radio_align_left, 0);
        fl_set_button(column_options_->radio_align_right, 0);
        fl_set_button(column_options_->radio_align_center, 0);
-       if (!pwidth.empty() || (align == LYX_ALIGN_LEFT))
+//     if (!pwidth.empty() || (align == LYX_ALIGN_LEFT))
+       if (align == LYX_ALIGN_LEFT)
                fl_set_button(column_options_->radio_align_left, 1);
        else if (align == LYX_ALIGN_RIGHT)
                fl_set_button(column_options_->radio_align_right, 1);
@@ -352,12 +353,21 @@
        else
                fl_set_button(column_options_->radio_valign_top, 1);
        if (!pwidth.empty()) {
-               fl_deactivate_object(column_options_->radio_align_left);
-               fl_deactivate_object(column_options_->radio_align_right);
-               fl_deactivate_object(column_options_->radio_align_center);
-               fl_set_object_lcol(column_options_->radio_align_left, FL_INACTIVE);
-               fl_set_object_lcol(column_options_->radio_align_right, FL_INACTIVE);
-               fl_set_object_lcol(column_options_->radio_align_center, FL_INACTIVE);
+//             fl_deactivate_object(column_options_->radio_align_left);
+//             fl_deactivate_object(column_options_->radio_align_right);
+//             fl_deactivate_object(column_options_->radio_align_center);
+//             fl_set_object_lcol(column_options_->radio_align_left, FL_INACTIVE);
+//             fl_set_object_lcol(column_options_->radio_align_right, FL_INACTIVE);
+//             fl_set_object_lcol(column_options_->radio_align_center, FL_INACTIVE);
+                fl_activate_object(column_options_->radio_align_left);
+                fl_activate_object(column_options_->radio_align_right);
+                fl_activate_object(column_options_->radio_align_center);
+                fl_set_object_lcol(column_options_->radio_align_left, FL_BLACK);
+                fl_set_object_lcol(column_options_->radio_align_right, FL_BLACK)
+;
+                fl_set_object_lcol(column_options_->radio_align_center, FL_BLACK
+);
+
                fl_activate_object(column_options_->radio_valign_top);
                fl_activate_object(column_options_->radio_valign_bottom);
                fl_activate_object(column_options_->radio_valign_center);

Reply via email to