Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!comp.vuw.ac.nz!nickson From: Ray.Nickson@comp.vuw.ac.nz (Ray Nickson) Newsgroups: comp.text.tex Subject: Re: TABLES-- Alligning the decimal points. Message-ID: Date: 30 Jan 91 19:24:22 GMT References: <1991Jan25.114530.2289@vax5.cit.cornell.edu> <1991Jan26.221417.24115@Neon.Stanford.EDU> Sender: news@comp.vuw.ac.nz (News Admin) Distribution: comp Organization: Victoria University of Wellington, Wellington, New Zealand Lines: 32 Nntp-Posting-Host: circa.comp.vuw.ac.nz In-Reply-To: golding@Neon.Stanford.EDU's message of 26 Jan 91 22:14:17 GMT In article <1991Jan26.221417.24115@Neon.Stanford.EDU> golding@Neon.Stanford.EDU (Andy Golding) writes: nqdy@vax5.cit.cornell.edu writes: > I am using LaTeX for making tables. I would like to allign >the numbers in a column so that the decimal points are alligned >rather than the number being left/right/center alligned. This is not the most elegant solution in the world, but one thing to do is use a `tabular' environment ... (I've run this through LaTeX, but don't have a printer or previewer handy; apologies and free flames if it's wrong). I think this is slightly nicer: \def\dotalign{\catcode`\.=4\begin{tabular}{r@{.}l}} \def\enddotalign{\end{tabular}\catcode`\.=12} This allows me to write: \begin{dotalign} 5.8 \\ 111.222 \\ .5 \\ \end{dotalign} and I think should do align the dots properly. In case you can't tell, it works by temporarily telling TeX that . is an alignment character like &. I often change catcodes temporarily to make my input look nicer; I've been known to make newline active and define it to do what \\ does, so I don't have \\s cluttering up my input.