1 #LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
8 \newcolumntype{d}[1]{D{.}{.}{#1}}
14 \paperfontsize default
21 \paperorientation portrait
24 \paragraph_separation indent
26 \quotes_language english
30 \paperpagestyle default
31 \tracking_changes false
39 A Better Decimal-Alignment Solution
42 \begin_layout Standard
44 An alternative way to have decimal alignment in tables is through the dcolumn
46 Add the following to the LateX preamble:
49 \begin_layout LyX-Code
56 \begin_layout LyX-Code
60 newcolumntype{d}[1]{D{.}{.}{#1}}
63 \begin_layout Standard
65 To have a column decimally aligned, enter in the
67 Special Column Alignment
76 \begin_layout LyX-Code
78 d{number of decimals of the data}
81 \begin_layout Standard
83 In the following table we entered
91 \begin_layout Standard
94 \begin_inset VSpace 0.3cm
100 \begin_layout Standard
104 <lyxtabular version="3" rows="5" columns="2">
106 <column alignment="center" valignment="top" width="0pt">
107 <column alignment="right" valignment="top" leftline="true" width="0pt" special="d{4}">
108 <row bottomline="true">
109 <cell alignment="center" valignment="top" topline="true" usebox="none">
112 \begin_layout Standard
119 <cell multicolumn="1" alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
122 \begin_layout Standard
131 <cell alignment="center" valignment="top" topline="true" usebox="none">
134 \begin_layout Standard
140 <cell multicolumn="1" alignment="right" valignment="top" leftline="true" usebox="none">
143 \begin_layout Standard
152 <cell alignment="center" valignment="top" topline="true" usebox="none">
155 \begin_layout Standard
161 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
164 \begin_layout Standard
173 <cell alignment="center" valignment="top" topline="true" usebox="none">
176 \begin_layout Standard
182 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
185 \begin_layout Standard
194 <cell alignment="center" valignment="top" topline="true" usebox="none">
197 \begin_layout Standard
203 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
206 \begin_layout Standard
221 \begin_layout Standard
224 \begin_inset VSpace 0.3cm
231 \begin_layout Standard
233 To create extra column space just increase the number of decimals in
238 Setting the multicolumn attribute for a single cell makes it insensitive
239 to the decimal alignment which comes in handy as well.
240 A drawback of this method is that math mode is not allowed in a column
241 with decimal alignment except if the multicolumn attribute is set.
244 \begin_layout Standard
246 This method offers the same flexibility as the
251 One could, for example, change the alignment separator, and have different
252 alignment separators for different columns by defining multiple column
253 types in the preamble.
254 The syntax is as follows:
257 \begin_layout LyX-Code
259 D{inputsep}{outputsep}{decimal places}
262 \begin_layout Standard
264 The interested reader is directed towards the
268 package documentation for more details.