[comp.text.tex] Difficulties with columns of numbers

tas@tasman.cc.utas.edu.au (Tasman Derk Van Ommen) (11/28/90)

Can ANYONE help me align columns of numbers....

I have two related but different problems:


1) How does one align a column of numbers which need to be right aligned
under a central heading?

e.g.        The Heading
                 27
                113
               1251
                  4
               etc.....

2) What do you do if you have a lot of numbers to be aligned on a decimal
point if the numbers have varying numbers of decimal places?

e.g.           10.7
                1.3
                0.75
                etc....


My only solutions so far (with much searching of Lamport's Book) are:

Problem 1.
     Use right aligned tabbing column
     Enclose the heading as follows    {\hfill The Heading \hfill}
     Put an empirical \makebox[numex]{} after EVERY number to push them
          back under the centre of the column.

Problem 2.
     Take those numbers like the 0.75 above and hide the extra decimal
     place as follows     0.7\makebox[0pt][l]{5}     hoping all the
     while that the 5 doesn't run into the next column too badly.

These are NASTY, clumsy to implement solutions to what should be a
simple problem.  How should I be doing this?

Tas van Ommen

P.S. This is reasonably urgent.  Mail me or post answers, I'm not fussy!
========================================================================
email:  tas@physvax.phys.utas.edu.au

duchier@cs.yale.edu (Denys Duchier) (11/28/90)

In article <tas.659768770@tasman> tas@tasman.cc.utas.edu.au (Tasman Derk Van Ommen) writes:
 >   1) How does one align a column of numbers which need to be right aligned
 >   under a central heading?
 >
 >   e.g.        The Heading
 >		    27
 >		   113
 >		  1251
 >		     4
 >		  etc.....

\begin{center}
  \begin{tabular}{c}
    The Heading\\
    \begin{tabular}{r}
      27\\113\\1251\\4
    \end{tabular}
  \end{tabular}
\end{center}

 >   2) What do you do if you have a lot of numbers to be aligned on a decimal
 >   point if the numbers have varying numbers of decimal places?
 >
 >   e.g.           10.7
 >		   1.3
 >		   0.75
 >		   etc....

\begin{center}
  \begin{tabular}{r@{.}l}
    10&7\\1&3\\0&75
  \end{tabular}
\end{center}

--Denys

domen@wiener.crin.fr (Eric Domenjoud) (11/29/90)

In article <tas.659768770@tasman> tas@tasman.cc.utas.edu.au (Tasman Derk Van Ommen) writes:

   1) How does one align a column of numbers which need to be right aligned
   under a central heading?

   e.g.        The Heading
		    27
		   113
		  1251
		     4
		  etc.....


\begin{tabular}{c}
The Heading \\
	\begin{tabular}{r}
	  27 \\
	 113 \\
	1251 \\
	   4
	\end{tabular}
\end{tabular}

   2) What do you do if you have a lot of numbers to be aligned on a decimal
   point if the numbers have varying numbers of decimal places?

   e.g.           10.7
		   1.3
		   0.75
		   etc....


\begin{tabular}{r@{.}l}
	10&7 \\
	 1&3 \\
	 0&75
\end{tabular}

================================================================
Eric Domenjoud
e-mail: domen@loria.crin.fr