X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=lib%2Fexamples%2Fdecimal.lyx;h=0e28e018a1e466eb80e47d38a94b6c61dddaac53;hb=fc7171926a961e7461d40168cc96ef73f1978905;hp=3cfcc9ac36f82a9268e05dbb7e2b3e5cfb4a24d8;hpb=1e341fda014f8cfc47651f8d5a02fd43c924ca9b;p=lyx.git diff --git a/lib/examples/decimal.lyx b/lib/examples/decimal.lyx index 3cfcc9ac36..0e28e018a1 100644 --- a/lib/examples/decimal.lyx +++ b/lib/examples/decimal.lyx @@ -1,5 +1,7 @@ -#LyX 1.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 2.16 +#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} @@ -10,148 +12,260 @@ \fontscheme default \graphics default \paperfontsize default -\spacing single -\papersize Default -\paperpackage a4 -\use_geometry 0 +\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 -\quotes_times 2 \papercolumns 1 \papersides 1 \paperpagestyle default +\tracking_changes false +\output_changes true +\end_header -\layout Title +\begin_body + +\begin_layout Title A Better Decimal-Alignment Solution -\layout Standard +\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: -\layout LyX-Code +\end_layout + +\begin_layout LyX-Code -\backslash +\backslash usepackage{dcolumn} -\layout LyX-Code +\end_layout +\begin_layout LyX-Code -\backslash + +\backslash newcolumntype{d}[1]{D{.}{.}{#1}} -\layout Standard +\end_layout + +\begin_layout Standard To have a column decimally aligned, enter in the -\family sans +\family sans Special Column Alignment -\family default +\family default box of the -\family sans +\family sans Table extra -\family default +\family default form the following: -\layout LyX-Code +\end_layout + +\begin_layout LyX-Code d{number of decimals of the data} -\layout Standard +\end_layout + +\begin_layout Standard In the following table we entered -\family typewriter +\family typewriter d{4} -\family default +\family default : -\layout Standard -\added_space_top 0.3cm \added_space_bottom 0.3cm \align center \LyXTable -multicol5 -5 2 0 0 -1 -1 -1 -1 -0 1 0 0 -0 0 0 0 -0 0 0 0 -0 0 0 0 -0 0 0 0 -8 0 0 "" "" -4 1 0 "" "d{4}" -0 8 1 0 0 0 0 "" "" -1 8 0 1 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -1 4 0 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" -0 8 1 0 0 0 0 "" "" +\end_layout + + +\begin_layout Standard + + +\begin_inset VSpace 0.3cm +\end_inset + + +\end_layout + +\begin_layout Standard +\align center + +\begin_inset Tabular + + + + + + +\begin_inset Text + +\begin_layout Standard Expression -\newline +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard + Value -\newline +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard -\begin_inset Formula \( \pi \) -\end_inset +\end_layout +\end_inset + + +\begin_inset Text + +\begin_layout Standard -\newline 3.1416 -\newline +\end_layout + +\end_inset + + + + +\begin_inset Text -\begin_inset Formula \( \pi ^{\pi } \) -\end_inset +\begin_layout Standard +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard -\newline 36.462 -\newline +\end_layout + +\end_inset + + + + +\begin_inset Text -\begin_inset Formula \( (\pi ^{\pi })^{\pi } \) -\end_inset +\begin_layout Standard +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard -\newline 80663. -\newline +\end_layout + +\end_inset + + + + +\begin_inset Text -\begin_inset Formula \( \pi ^{\pi ^{\pi }} \) -\end_inset +\begin_layout Standard +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard -\newline 1.3402e18 -\layout Standard +\end_layout + +\end_inset + + + + +\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 +\family typewriter d{} -\family default +\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. -\layout Standard +\end_layout + +\begin_layout Standard This method offers the same flexibility as the -\family typewriter +\family typewriter dcolumn -\family default +\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: -\layout LyX-Code +\end_layout + +\begin_layout LyX-Code D{inputsep}{outputsep}{decimal places} -\layout Standard +\end_layout + +\begin_layout Standard The interested reader is directed towards the -\family typewriter +\family typewriter dcolumn -\family default +\family default package documentation for more details. -\the_end +\end_layout + +\end_body +\end_document