]> git.lyx.org Git - features.git/commitdiff
Handle unknown table column specifiers (bug #9311)
authorGeorg Baum <baum@lyx.org>
Sat, 3 Jan 2015 16:06:39 +0000 (17:06 +0100)
committerGeorg Baum <baum@lyx.org>
Sat, 3 Jan 2015 16:06:39 +0000 (17:06 +0100)
Previously tex2lyx did ignore table columns if the column specifier was
unknown. This can lead to data loss, and now it does not ignore these columns,
but assumes that the column specifiers use only once character. This can still
lead to data loss, but less often.

src/tex2lyx/table.cpp
src/tex2lyx/test/test-insets.lyx.lyx
src/tex2lyx/test/test-insets.tex
status.21x

index eed7bb91c81ad92db450fa87f925cd14c46344f5..75a031746528e155b828dd72f33dae196b17d024 100644 (file)
@@ -434,9 +434,13 @@ void handle_colalign(Parser & p, vector<ColInfo> & colinfo,
                                                        '}';
                                        colinfo.push_back(next);
                                        next = ColInfo();
-                               } else
-                                       cerr << "Ignoring column specification"
-                                               " '" << t << "'." << endl;
+                               } else {
+                                       // unknown column specifier, assume no arguments
+                                       ci2special(next);
+                                       next.special += t.character();
+                                       colinfo.push_back(next);
+                                       next = ColInfo();
+                               }
                                break;
                        }
        }
index 25f372b5ddd1b1ba5fa7db4824ee6e709045a11e..cadde5b483de130f028e352b314ee759c2e141be 100644 (file)
@@ -4974,6 +4974,325 @@ in % of pixel size
 \end_inset
 
 
+\end_layout
+
+\begin_layout Standard
+A table using dcolumn:
+\end_layout
+
+\begin_layout Standard
+
+\begin_inset Float table
+wide false
+sideways false
+status open
+
+
+\begin_layout Standard
+
+\begin_inset Tabular 
+<lyxtabular version="3" rows="4" columns="5">
+<features rotate="0" tabularvalignment="middle" tabularwidth="0pt">
+<column alignment="center" valignment="top">
+<column alignment="center" valignment="top">
+<column alignment="none" valignment="top" special="d">
+<column alignment="none" valignment="top" special="d">
+<column alignment="none" valignment="top" special="d">
+<row>
+<cell alignment="center" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+One
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+Two
+\end_layout
+
+\end_inset
+</cell>
+<cell multicolumn="1" alignment="none" valignment="top" usebox="none" special="c">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+Three
+\family default
+
+\end_layout
+
+\end_inset
+</cell>
+<cell multicolumn="1" alignment="none" valignment="top" usebox="none" special="c">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+Four
+\family default
+
+\end_layout
+
+\end_inset
+</cell>
+<cell multicolumn="1" alignment="none" valignment="top" usebox="none" special="c">
+\begin_inset Text
+
+\begin_layout Standard
+
+\family roman
+Five
+\family default
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+one
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+two
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\begin_inset Box Frameless
+position "c"
+hor_pos "c"
+has_inner_box 1
+inner_pos "c"
+use_parbox 0
+use_makebox 1
+width ""
+special "none"
+height "1in"
+height_special "totalheight"
+status open
+
+
+\begin_layout Standard
+three
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\begin_inset Box Frameless
+position "c"
+hor_pos "c"
+has_inner_box 1
+inner_pos "c"
+use_parbox 0
+use_makebox 1
+width ""
+special "none"
+height "1in"
+height_special "totalheight"
+status open
+
+
+\begin_layout Standard
+four
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" topline="true" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+
+\begin_inset Box Frameless
+position "c"
+hor_pos "c"
+has_inner_box 1
+inner_pos "c"
+use_parbox 0
+use_makebox 1
+width ""
+special "none"
+height "1in"
+height_special "totalheight"
+status open
+
+
+\begin_layout Standard
+five
+\end_layout
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+He
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+2
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+2.77234 
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+45672. 
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+0.69 
+\end_layout
+
+\end_inset
+</cell>
+</row>
+<row>
+<cell alignment="center" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+C
+\begin_inset Foot
+status collapsed
+
+
+\begin_layout Standard
+Some tables require footnotes.
+\end_layout
+
+\end_inset
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="center" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+C
+\begin_inset Foot
+status collapsed
+
+
+\begin_layout Standard
+Some tables need more than one footnote.
+\end_layout
+
+\end_inset
+
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+12537.64 
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+37.66345 
+\end_layout
+
+\end_inset
+</cell>
+<cell alignment="none" valignment="top" usebox="none">
+\begin_inset Text
+
+\begin_layout Standard
+86.37 
+\end_layout
+
+\end_inset
+</cell>
+</row>
+</lyxtabular>
+
+\end_inset
+
+
+\end_layout
+
+\end_inset
+
+
 \end_layout
 
 \begin_layout Section
index 5fd393030788a0f4e54a13295768fae6e0d09980..e6249fc6655977232c64eca76ba6cab06ed96f9b 100644 (file)
@@ -34,6 +34,7 @@
 \usepackage{booktabs}
 \usepackage{multirow}
 \usepackage{hhline}
+\usepackage{dcolumn}
 \usepackage{pdfpages}
 \usepackage{textcomp}
 \usepackage{amssymb}
@@ -452,6 +453,23 @@ in \% of pixel size & 76.3 & 95.9 & 92.3\tabularnewline
 \end{tabular}
 \end{table}
 
+A table using dcolumn:
+
+\begin{table} 
+\begin{tabular}{ccddd} 
+One&Two& 
+\multicolumn{1}{c}{\textrm{Three}}& 
+\multicolumn{1}{c}{\textrm{Four}}& 
+\multicolumn{1}{c}{\textrm{Five}}\\ 
+\hline 
+one&two&\mbox{three}&\mbox{four}&\mbox{five}\\ 
+He&2& 2.77234 & 45672. & 0.69 \\ 
+C\footnote{Some tables require footnotes.} 
+&C\footnote{Some tables need more than one footnote.} 
+& 12537.64 & 37.66345 & 86.37 \\ 
+\end{tabular} 
+\end{table}
+
 
 \section{Macros}
 
index d83eb4b660917ab5f19b227945cd00a9a6aa1035..db7e55f4112a9b3fb4d54f8a0c6e574b6a9486a0 100644 (file)
@@ -182,6 +182,8 @@ What's new
 
 * TEX2LYX
 
+- Do not ignore table columns with unknown column specifiers (bug 9311).
+
 
 
 * ADVANCED FIND AND REPLACE