Handle unknown table column specifiers (bug #9311)

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.
This commit is contained in:
Georg Baum 2015-01-03 17:06:39 +01:00
parent d762e720d8
commit 9c54ee6f0d
4 changed files with 346 additions and 3 deletions

View 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;
}
}

View 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

View 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}

View File

@ -182,6 +182,8 @@ What's new
* TEX2LYX
- Do not ignore table columns with unknown column specifiers (bug 9311).
* ADVANCED FIND AND REPLACE