Author: baum
Date: Sat Nov 12 18:54:50 2011
New Revision: 40176
URL: http://www.lyx.org/trac/changeset/40176

Log:
tabular*

Modified:
   lyx-devel/trunk/src/tex2lyx/TODO.txt
   lyx-devel/trunk/src/tex2lyx/table.cpp
   lyx-devel/trunk/src/tex2lyx/test/test-insets.tex
   lyx-devel/trunk/src/tex2lyx/tex2lyx.1in
   lyx-devel/trunk/src/tex2lyx/tex2lyx.h
   lyx-devel/trunk/src/tex2lyx/text.cpp

Modified: lyx-devel/trunk/src/tex2lyx/TODO.txt
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/TODO.txt        Sat Nov 12 04:03:15 2011        
(r40175)
+++ lyx-devel/trunk/src/tex2lyx/TODO.txt        Sat Nov 12 18:54:50 2011        
(r40176)
@@ -65,6 +65,5 @@
 407    vertical offset for multirows        InsetTabular
 409    XeTeX                                \use_non_tex_fonts
 411    support for polyglossia              \language_package  (the cases of 
no package, of babel and of custom package is supported)
-412    tabular*                             InsetTabular
 415    undertilde.sty                       fonts
 

Modified: lyx-devel/trunk/src/tex2lyx/table.cpp
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/table.cpp       Sat Nov 12 04:03:15 2011        
(r40175)
+++ lyx-devel/trunk/src/tex2lyx/table.cpp       Sat Nov 12 18:54:50 2011        
(r40176)
@@ -770,9 +770,10 @@
 } // anonymous namespace
 
 
-void handle_tabular(Parser & p, ostream & os, bool is_long_tabular,
-                   Context & context)
+void handle_tabular(Parser & p, ostream & os, string const & name,
+                    string const & tabularwidth, Context & context)
 {
+       bool const is_long_tabular(name == "longtable");
        string tabularvalignment("middle");
        string posopts = p.getOpt();
        if (!posopts.empty()) {
@@ -1114,7 +1115,8 @@
           << write_attribute("rotate", false)
           << write_attribute("islongtable", is_long_tabular);
        if (!is_long_tabular)
-               os << write_attribute("tabularvalignment", tabularvalignment);
+               os << write_attribute("tabularvalignment", tabularvalignment)
+                  << write_attribute("tabularwidth", tabularwidth);
        os << ">\n";
 
        //cerr << "// after header\n";

Modified: lyx-devel/trunk/src/tex2lyx/test/test-insets.tex
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/test/test-insets.tex    Sat Nov 12 04:03:15 
2011        (r40175)
+++ lyx-devel/trunk/src/tex2lyx/test/test-insets.tex    Sat Nov 12 18:54:50 
2011        (r40176)
@@ -258,6 +258,13 @@
 Lots of lines& like this.
 \end{longtable}
 
+\begin{tabular*} % some comment
+{0.8\columnwidth}[b]{lr}
+two\\
+lonely&lines
+\end{tabular*}
+
+
 \section{Macros}
 
 LyX supports several kinds of macros:

Modified: lyx-devel/trunk/src/tex2lyx/tex2lyx.1in
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/tex2lyx.1in     Sat Nov 12 04:03:15 2011        
(r40175)
+++ lyx-devel/trunk/src/tex2lyx/tex2lyx.1in     Sat Nov 12 18:54:50 2011        
(r40176)
@@ -206,8 +206,6 @@
 course show up in the LyX window. Check Document->Settings->LaTeX Preamble to 
see the result.
 .SS "What tex2lyx Can't Handle --- But it's \s-1OK\s0"
 .IP "\(bu" 4
-tabular* tables
-.IP "\(bu" 4
 some spacing commands (\f(CW\ehspace\fR, \f(CW\epagebreak\fR and 
\f(CW\elinebreak\fR)
 .IP "\(bu" 4
 \f(CW\ecentering\fR, \f(CW\eraggedleft\fR, \f(CW\eraggedright\fR

Modified: lyx-devel/trunk/src/tex2lyx/tex2lyx.h
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/tex2lyx.h       Sat Nov 12 04:03:15 2011        
(r40175)
+++ lyx-devel/trunk/src/tex2lyx/tex2lyx.h       Sat Nov 12 18:54:50 2011        
(r40176)
@@ -71,8 +71,8 @@
 
 
 /// in table.cpp
-void handle_tabular(Parser & p, std::ostream & os, bool is_long_tabular,
-                   Context & context);
+void handle_tabular(Parser & p, std::ostream & os, std::string const & name,
+                    std::string const & width, Context & context);
 
 
 /// in tex2lyx.cpp

Modified: lyx-devel/trunk/src/tex2lyx/text.cpp
==============================================================================
--- lyx-devel/trunk/src/tex2lyx/text.cpp        Sat Nov 12 04:03:15 2011        
(r40175)
+++ lyx-devel/trunk/src/tex2lyx/text.cpp        Sat Nov 12 18:54:50 2011        
(r40176)
@@ -1152,11 +1152,16 @@
                end_inset(os);
        }
 
-       else if (name == "tabular" || name == "longtable") {
+       else if (unstarred_name == "tabular" || name == "longtable") {
                eat_whitespace(p, os, parent_context, false);
+               string width = "0pt";
+               if (name == "tabular*") {
+                       width = lyx::translate_len(p.getArg('{', '}'));
+                       eat_whitespace(p, os, parent_context, false);
+               }
                parent_context.check_layout(os);
                begin_inset(os, "Tabular ");
-               handle_tabular(p, os, name == "longtable", parent_context);
+               handle_tabular(p, os, name, width, parent_context);
                end_inset(os);
                p.skip_spaces();
        }

Reply via email to