#LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
\lyxformat 245
\begin_document
\begin_header
\textclass article
\begin_preamble
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\end_preamble
\language english
\inputencoding latin1
\fontscheme default
\graphics default
\paperfontsize default
\spacing single
\papersize default
\use_geometry false
\use_amsmath 0
\cite_engine basic
\use_bibtopic false
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\defskip medskip
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes true
\end_header

\begin_body

\begin_layout Title

A Better Decimal-Alignment Solution
\end_layout

\begin_layout Standard

An alternative way to have decimal alignment in tables is through the dcolumn
 package.
 Add the following to the LateX preamble:
\end_layout

\begin_layout LyX-Code


\backslash
usepackage{dcolumn} 
\end_layout

\begin_layout LyX-Code


\backslash
newcolumntype{d}[1]{D{.}{.}{#1}}
\end_layout

\begin_layout Standard

To have a column decimally aligned, enter in the 
\family sans
Special Column Alignment
\family default
 box of the 
\family sans
Table extra
\family default
 form the following:
\end_layout

\begin_layout LyX-Code

d{number of decimals of the data}
\end_layout

\begin_layout Standard

In the following table we entered 
\family typewriter
d{4}
\family default
:
\end_layout


\begin_layout Standard


\begin_inset VSpace 0.3cm
\end_inset


\end_layout

\begin_layout Standard
\align center

\begin_inset  Tabular
<lyxtabular version="3" rows="5" columns="2">
<features>
<column alignment="center" valignment="top" width="0pt">
<column alignment="right" valignment="top" leftline="true" width="0pt" special="d{4}">
<row bottomline="true">
<cell alignment="center" valignment="top" topline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

Expression
\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

Value 
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell multicolumn="1" alignment="right" valignment="top" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

3.1416
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

36.462
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

80663.
\end_layout

\end_inset
</cell>
</row>
<row>
<cell alignment="center" valignment="top" topline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

\end_layout

\end_inset
</cell>
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
\begin_inset Text

\begin_layout Standard

1.3402e18
\end_layout

\end_inset
</cell>
</row>
</lyxtabular>

\end_inset


\end_layout

\begin_layout Standard


\begin_inset VSpace 0.3cm
\end_inset


\end_layout


\begin_layout Standard

To create extra column space just increase the number of decimals in 
\family typewriter
d{}
\family default
.
 Setting the multicolumn attribute for a single cell makes it insensitive
 to the decimal alignment which comes in handy as well.
 A drawback of this method is that math mode is not allowed in a column
 with decimal alignment except if the multicolumn attribute is set.
\end_layout

\begin_layout Standard

This method offers the same flexibility as the 
\family typewriter
dcolumn
\family default
 package.
 One could, for example, change the alignment separator, and have different
 alignment separators for different columns by defining multiple column
 types in the preamble.
 The syntax is as follows: 
\end_layout

\begin_layout LyX-Code

D{inputsep}{outputsep}{decimal places}
\end_layout

\begin_layout Standard

The interested reader is directed towards the 
\family typewriter
dcolumn
\family default
 package documentation for more details.
\end_layout

\end_body
\end_document
