]> git.lyx.org Git - features.git/commitdiff
tex2lyx: support V table column type
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 27 Aug 2018 10:12:56 +0000 (12:12 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 27 Aug 2018 10:12:56 +0000 (12:12 +0200)
src/tex2lyx/TODO.txt
src/tex2lyx/table.cpp

index 2996e71de90efbc484f24084d59f76f71ee46106..365e7915dbac314000015a6ab2d2bf3eaa6ecbf8 100644 (file)
@@ -34,8 +34,7 @@ Format LaTeX feature                        LyX feature
 443    unicode-math.sty                     InsetMath*
 453    automatic stmaryrd loading           \use_package stmaryrd
 457    automatic stackrel loading           \use_package stackrel
-555    V column type (varwidth package)     Automatically detected with newlines, paragraph breaks and environment content in cells of rows
-563    InsetArgument listpreamble:<nr>      All content between \begin{env} and first \item of a list 
+563    InsetArgument listpreamble:1         All content between \begin{env} and first \item of a list 
 
 
 
index 217014c36ab7cdf03a4cead5d07b864b00db7f3c..01c7a541780e4d661628a1985c89fe243917a777 100644 (file)
@@ -39,7 +39,7 @@ namespace {
 class ColInfo {
 public:
        ColInfo() : align('n'), valign('n'), rightlines(0), leftlines(0),
-               varwidth(false), decimal_point('\0') {}
+               varwidth(false), decimal_point('\0'), vcolumn(false) {}
        /// column alignment
        char align;
        /// vertical alignment
@@ -56,6 +56,8 @@ public:
        bool varwidth;
        /// decimal separator
        char decimal_point;
+       /// V column type
+       bool vcolumn;
 };
 
 
@@ -298,7 +300,9 @@ void ci2special(ColInfo & ci)
                        ci.special += ">{\\centering" + arraybackslash + "}";
                        break;
                }
-               if (ci.varwidth)
+               if (ci.vcolumn)
+                       ci.special += 'V';
+               else if (ci.varwidth)
                        ci.special += 'X';
                else if (ci.valign == 'n')
                        ci.special += 'p';
@@ -384,6 +388,21 @@ void handle_colalign(Parser & p, vector<ColInfo> & colinfo,
                                colinfo.push_back(next);
                                next = ColInfo();
                                break;
+                       case 'V': {
+                               // V column type (varwidth package)
+                               string const s = trimSpaceAndEol(p.verbatim_item());
+                               // V{\linewidth} is treated as a normal column
+                               // (which allows for line breaks). The V type is
+                               // automatically set by LyX in this case
+                               if (s != "\\linewidth" || !next.special.empty()) {
+                                       next.vcolumn = true;
+                                       next.width = s;
+                                       ci2special(next);
+                               }
+                               colinfo.push_back(next);
+                               next = ColInfo();
+                               break;
+                       }
                        case 'p':
                        case 'b':
                        case 'm':