]> git.lyx.org Git - lyx.git/blob - lib/examples/decimal.lyx
update to the aa class
[lyx.git] / lib / examples / decimal.lyx
1 #LyX 1.1 created this file. For more info see http://www.lyx.org/
2 \lyxformat 2.16
3 \textclass article
4 \begin_preamble
5 \usepackage{dcolumn}
6 \newcolumntype{d}[1]{D{.}{.}{#1}}
7 \end_preamble
8 \language english
9 \inputencoding latin1
10 \fontscheme default
11 \graphics default
12 \paperfontsize default
13 \spacing single 
14 \papersize Default
15 \paperpackage a4
16 \use_geometry 0
17 \use_amsmath 0
18 \paperorientation portrait
19 \secnumdepth 3
20 \tocdepth 3
21 \paragraph_separation indent
22 \defskip medskip
23 \quotes_language english
24 \quotes_times 2
25 \papercolumns 1
26 \papersides 1
27 \paperpagestyle default
28
29 \layout Title
30
31 A Better Decimal-Alignment Solution
32 \layout Standard
33
34 An alternative way to have decimal alignment in tables is through the dcolumn
35  package.
36  Add the following to the LateX preamble:
37 \layout LyX-Code
38
39
40 \backslash 
41 usepackage{dcolumn} 
42 \layout LyX-Code
43
44
45 \backslash 
46 newcolumntype{d}[1]{D{.}{.}{#1}}
47 \layout Standard
48
49 To have a column decimally aligned, enter in the 
50 \family sans 
51 Special Column Alignment
52 \family default 
53  box of the 
54 \family sans 
55 Table extra
56 \family default 
57  form the following:
58 \layout LyX-Code
59
60 d{number of decimals of the data}
61 \layout Standard
62
63 In the following table we entered 
64 \family typewriter 
65 d{4}
66 \family default 
67 :
68 \layout Standard
69 \added_space_top 0.3cm \added_space_bottom 0.3cm \align center \LyXTable
70 multicol5
71 5 2 0 0 -1 -1 -1 -1
72 0 1 0 0
73 0 0 0 0
74 0 0 0 0
75 0 0 0 0
76 0 0 0 0
77 8 0 0 "" ""
78 4 1 0 "" "d{4}"
79 0 8 1 0 0 0 0 "" ""
80 1 8 0 1 0 0 0 "" ""
81 0 8 1 0 0 0 0 "" ""
82 1 4 0 0 0 0 0 "" ""
83 0 8 1 0 0 0 0 "" ""
84 0 8 1 0 0 0 0 "" ""
85 0 8 1 0 0 0 0 "" ""
86 0 8 1 0 0 0 0 "" ""
87 0 8 1 0 0 0 0 "" ""
88 0 8 1 0 0 0 0 "" ""
89
90 Expression
91 \newline 
92 Value 
93 \newline 
94
95 \begin_inset Formula \( \pi  \)
96 \end_inset 
97
98
99 \newline 
100 3.1416
101 \newline 
102
103 \begin_inset Formula \( \pi ^{\pi } \)
104 \end_inset 
105
106
107 \newline 
108 36.462
109 \newline 
110
111 \begin_inset Formula \( (\pi ^{\pi })^{\pi } \)
112 \end_inset 
113
114
115 \newline 
116 80663.
117 \newline 
118
119 \begin_inset Formula \( \pi ^{\pi ^{\pi }} \)
120 \end_inset 
121
122
123 \newline 
124 1.3402e18
125 \layout Standard
126
127 To create extra column space just increase the number of decimals in 
128 \family typewriter 
129 d{}
130 \family default 
131 .
132  Setting the multicolumn attribute for a single cell makes it insensitive
133  to the decimal alignment which comes in handy as well.
134  A drawback of this method is that math mode is not allowed in a column
135  with decimal alignment except if the multicolumn attribute is set.
136 \layout Standard
137
138 This method offers the same flexibility as the 
139 \family typewriter 
140 dcolumn
141 \family default 
142  package.
143  One could, for example, change the alignment separator, and have different
144  alignment separators for different columns by defining multiple column
145  types in the preamble.
146  The syntax is as follows: 
147 \layout LyX-Code
148
149 D{inputsep}{outputsep}{decimal places}
150 \layout Standard
151
152 The interested reader is directed towards the 
153 \family typewriter 
154 dcolumn
155 \family default 
156  package documentation for more details.
157 \the_end