Author: baum
Date: Sun Nov  6 19:56:26 2011
New Revision: 40148
URL: http://www.lyx.org/trac/changeset/40148

Log:
Import optional argument of tabular (vertical alignment)

Modified:
   lyx-devel/branches/BRANCH_2_0_X/   (props changed)
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/   (props changed)
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/table.cpp
   lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/test/test-structure.tex
   lyx-devel/branches/BRANCH_2_0_X/status.20x

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt        Sun Nov  6 
19:54:15 2011        (r40147)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/TODO.txt        Sun Nov  6 
19:56:26 2011        (r40148)
@@ -37,7 +37,6 @@
 332    ?                                    InsetGraphics groupId
 336    ?                                    \font_cjk
 343    ?                                    \use_default_options
-347    tabular valign                       InsetTabular
 350    ?                                    \default_output_format
 353    \printsubindex                       InsetIndex
 354    \printindex*, \printsubindex*        InsetIndex

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/table.cpp
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/table.cpp       Sun Nov  6 
19:54:15 2011        (r40147)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/table.cpp       Sun Nov  6 
19:56:26 2011        (r40148)
@@ -773,14 +773,20 @@
 void handle_tabular(Parser & p, ostream & os, bool is_long_tabular,
                    Context & context)
 {
+       string tabularvalignment("middle");
        string posopts = p.getOpt();
        if (!posopts.empty()) {
                // FIXME: Convert this to ERT
                if (is_long_tabular)
-                       cerr << "horizontal longtable";
+                       cerr << "horizontal longtable positioning '"
+                            << posopts << "' ignored\n";
+               else if (posopts == "[t]")
+                       tabularvalignment = "top";
+               else if (posopts == "[b]")
+                       tabularvalignment = "bottom";
                else
-                       cerr << "vertical tabular";
-               cerr << " positioning '" << posopts << "' ignored\n";
+                       cerr << "vertical tabular positioning '"
+                            << posopts << "' ignored\n";
        }
 
        vector<ColInfo> colinfo;
@@ -1106,8 +1112,10 @@
           << "\" columns=\"" << colinfo.size() << "\">\n";
        os << "<features"
           << write_attribute("rotate", false)
-          << write_attribute("islongtable", is_long_tabular)
-          << ">\n";
+          << write_attribute("islongtable", is_long_tabular);
+       if (!is_long_tabular)
+               os << write_attribute("tabularvalignment", tabularvalignment);
+       os << ">\n";
 
        //cerr << "// after header\n";
        for (size_t col = 0; col < colinfo.size(); ++col) {

Modified: lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/test/test-structure.tex
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/test/test-structure.tex Sun Nov 
 6 19:54:15 2011        (r40147)
+++ lyx-devel/branches/BRANCH_2_0_X/src/tex2lyx/test/test-structure.tex Sun Nov 
 6 19:56:26 2011        (r40148)
@@ -101,7 +101,7 @@
 \caption{rotated table, spanning all columns}
 
 \centering{}%
-\begin{tabular}{|c|c|}
+\begin{tabular}[b]{|c|c|}
 \hline 
 a  & b\tabularnewline
 \hline 

Modified: lyx-devel/branches/BRANCH_2_0_X/status.20x
==============================================================================
--- lyx-devel/branches/BRANCH_2_0_X/status.20x  Sun Nov  6 19:54:15 2011        
(r40147)
+++ lyx-devel/branches/BRANCH_2_0_X/status.20x  Sun Nov  6 19:56:26 2011        
(r40148)
@@ -160,6 +160,8 @@
 
 - Fix LaTeX import of theorem environment with optional argument (bug 6834).
 
+- Fix LaTeX import of tabular environment with optional argument.
+
 - Store the autosave files of unnamed buffers in the correct directory
   and make sure they are not left behind after saving (bug 7793).
 

Reply via email to