1 #LyX 1.5.0svn 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
29 \paperpagestyle default
30 \tracking_changes false
38 A Better Decimal-Alignment Solution
41 \begin_layout Standard
43 An alternative way to have decimal alignment in tables is through the dcolumn
45 Add the following to the LateX preamble:
48 \begin_layout LyX-Code
55 \begin_layout LyX-Code
59 newcolumntype{d}[1]{D{.}{.}{#1}}
62 \begin_layout Standard
64 To have a column decimally aligned, enter in the
66 Special Column Alignment
75 \begin_layout LyX-Code
77 d{number of decimals of the data}
80 \begin_layout Standard
82 In the following table we entered
90 \begin_layout Standard
93 \begin_inset VSpace 0.3cm
99 \begin_layout Standard
103 <lyxtabular version="3" rows="5" columns="2">
105 <column alignment="center" valignment="top" width="0pt">
106 <column alignment="right" valignment="top" leftline="true" width="0pt" special="d{4}">
107 <row bottomline="true">
108 <cell alignment="center" valignment="top" topline="true" usebox="none">
111 \begin_layout Standard
118 <cell multicolumn="1" alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
121 \begin_layout Standard
130 <cell alignment="center" valignment="top" topline="true" usebox="none">
133 \begin_layout Standard
139 <cell multicolumn="1" alignment="right" valignment="top" leftline="true" usebox="none">
142 \begin_layout Standard
151 <cell alignment="center" valignment="top" topline="true" usebox="none">
154 \begin_layout Standard
160 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
163 \begin_layout Standard
172 <cell alignment="center" valignment="top" topline="true" usebox="none">
175 \begin_layout Standard
181 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
184 \begin_layout Standard
193 <cell alignment="center" valignment="top" topline="true" usebox="none">
196 \begin_layout Standard
202 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
205 \begin_layout Standard
220 \begin_layout Standard
223 \begin_inset VSpace 0.3cm
230 \begin_layout Standard
232 To create extra column space just increase the number of decimals in
237 Setting the multicolumn attribute for a single cell makes it insensitive
238 to the decimal alignment which comes in handy as well.
239 A drawback of this method is that math mode is not allowed in a column
240 with decimal alignment except if the multicolumn attribute is set.
243 \begin_layout Standard
245 This method offers the same flexibility as the
250 One could, for example, change the alignment separator, and have different
251 alignment separators for different columns by defining multiple column
252 types in the preamble.
253 The syntax is as follows:
256 \begin_layout LyX-Code
258 D{inputsep}{outputsep}{decimal places}
261 \begin_layout Standard
263 The interested reader is directed towards the
267 package documentation for more details.