2006-05-05 10:21:25 +00:00
|
|
|
#LyX 1.4.1 created this file. For more info see http://www.lyx.org/
|
|
|
|
\lyxformat 245
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_document
|
|
|
|
\begin_header
|
2000-06-13 17:10:47 +00:00
|
|
|
\textclass article
|
|
|
|
\begin_preamble
|
|
|
|
\usepackage{dcolumn}
|
|
|
|
\newcolumntype{d}[1]{D{.}{.}{#1}}
|
|
|
|
\end_preamble
|
2000-11-03 11:21:37 +00:00
|
|
|
\language english
|
2000-06-13 17:10:47 +00:00
|
|
|
\inputencoding latin1
|
|
|
|
\fontscheme default
|
|
|
|
\graphics default
|
|
|
|
\paperfontsize default
|
2003-01-17 13:50:11 +00:00
|
|
|
\spacing single
|
2005-07-18 09:42:29 +00:00
|
|
|
\papersize default
|
|
|
|
\use_geometry false
|
2000-06-13 17:10:47 +00:00
|
|
|
\use_amsmath 0
|
2005-07-18 09:42:29 +00:00
|
|
|
\cite_engine basic
|
|
|
|
\use_bibtopic false
|
2000-06-13 17:10:47 +00:00
|
|
|
\paperorientation portrait
|
|
|
|
\secnumdepth 3
|
|
|
|
\tocdepth 3
|
|
|
|
\paragraph_separation indent
|
|
|
|
\defskip medskip
|
|
|
|
\quotes_language english
|
|
|
|
\papercolumns 1
|
|
|
|
\papersides 1
|
|
|
|
\paperpagestyle default
|
2005-07-18 09:42:29 +00:00
|
|
|
\tracking_changes false
|
|
|
|
\output_changes true
|
|
|
|
\end_header
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_body
|
|
|
|
|
|
|
|
\begin_layout Title
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
A Better Decimal-Alignment Solution
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
An alternative way to have decimal alignment in tables is through the dcolumn
|
|
|
|
package.
|
|
|
|
Add the following to the LateX preamble:
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout LyX-Code
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\backslash
|
2000-06-13 17:10:47 +00:00
|
|
|
usepackage{dcolumn}
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout LyX-Code
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
|
|
|
|
\backslash
|
2000-06-13 17:10:47 +00:00
|
|
|
newcolumntype{d}[1]{D{.}{.}{#1}}
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
To have a column decimally aligned, enter in the
|
2005-07-18 09:42:29 +00:00
|
|
|
\family sans
|
2000-06-13 17:10:47 +00:00
|
|
|
Special Column Alignment
|
2005-07-18 09:42:29 +00:00
|
|
|
\family default
|
2000-06-13 17:10:47 +00:00
|
|
|
box of the
|
2005-07-18 09:42:29 +00:00
|
|
|
\family sans
|
2000-06-13 17:10:47 +00:00
|
|
|
Table extra
|
2005-07-18 09:42:29 +00:00
|
|
|
\family default
|
2000-06-13 17:10:47 +00:00
|
|
|
form the following:
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout LyX-Code
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
d{number of decimals of the data}
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
In the following table we entered
|
2005-07-18 09:42:29 +00:00
|
|
|
\family typewriter
|
2000-06-13 17:10:47 +00:00
|
|
|
d{4}
|
2005-07-18 09:42:29 +00:00
|
|
|
\family default
|
2000-06-13 17:10:47 +00:00
|
|
|
:
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
|
|
|
|
\begin_layout Standard
|
|
|
|
|
|
|
|
|
|
|
|
\begin_inset VSpace 0.3cm
|
|
|
|
\end_inset
|
|
|
|
|
|
|
|
|
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout Standard
|
|
|
|
\align center
|
2002-03-21 22:18:42 +00:00
|
|
|
|
|
|
|
\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
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
Expression
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
<cell multicolumn="1" alignment="center" valignment="top" bottomline="true" leftline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2002-03-21 22:18:42 +00:00
|
|
|
|
2000-06-13 17:10:47 +00:00
|
|
|
Value
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<cell alignment="center" valignment="top" topline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
<cell multicolumn="1" alignment="right" valignment="top" leftline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
3.1416
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<cell alignment="center" valignment="top" topline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
36.462
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<cell alignment="center" valignment="top" topline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
|
|
|
|
|
|
|
\end_layout
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
80663.
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<cell alignment="center" valignment="top" topline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
|
|
|
|
|
|
|
\end_layout
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
<cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
|
|
|
|
\begin_inset Text
|
2000-06-13 17:10:47 +00:00
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
1.3402e18
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_inset
|
2002-03-21 22:18:42 +00:00
|
|
|
</cell>
|
|
|
|
</row>
|
|
|
|
</lyxtabular>
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_inset
|
|
|
|
|
|
|
|
|
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout Standard
|
2002-03-21 22:18:42 +00:00
|
|
|
|
|
|
|
|
2005-07-18 09:42:29 +00:00
|
|
|
\begin_inset VSpace 0.3cm
|
|
|
|
\end_inset
|
|
|
|
|
|
|
|
|
|
|
|
\end_layout
|
|
|
|
|
|
|
|
|
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
To create extra column space just increase the number of decimals in
|
2005-07-18 09:42:29 +00:00
|
|
|
\family typewriter
|
2000-06-13 17:10:47 +00:00
|
|
|
d{}
|
2005-07-18 09:42:29 +00:00
|
|
|
\family default
|
2000-06-13 17:10:47 +00:00
|
|
|
.
|
|
|
|
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.
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
This method offers the same flexibility as the
|
2005-07-18 09:42:29 +00:00
|
|
|
\family typewriter
|
2000-06-13 17:10:47 +00:00
|
|
|
dcolumn
|
2005-07-18 09:42:29 +00:00
|
|
|
\family default
|
2000-06-13 17:10:47 +00:00
|
|
|
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:
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout LyX-Code
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
D{inputsep}{outputsep}{decimal places}
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\begin_layout Standard
|
2000-06-13 17:10:47 +00:00
|
|
|
|
|
|
|
The interested reader is directed towards the
|
2005-07-18 09:42:29 +00:00
|
|
|
\family typewriter
|
2000-06-13 17:10:47 +00:00
|
|
|
dcolumn
|
2005-07-18 09:42:29 +00:00
|
|
|
\family default
|
2000-06-13 17:10:47 +00:00
|
|
|
package documentation for more details.
|
2005-07-18 09:42:29 +00:00
|
|
|
\end_layout
|
|
|
|
|
|
|
|
\end_body
|
|
|
|
\end_document
|