[texhax] Table question - defined width and alignment

Peter Flom flom at ndri.org
Fri Apr 8 17:25:23 CEST 2005


Hello again

This seems simple, but I've looked in several books and can't find it.

I have a table where some of the rows contain text, and some contain
numbers.  I'd like to make the columns fixed width, with the numbers
below set either flush right or decimal aligned.....When I use a p
column, it sets the column flush left.....for example

\begin{table}
\begin{tabular}{|l|p{.8 in}|p{.8in}|}\hline
& \multicolumn{2}{c|}{Percent using} \\\hline
 & Direct questioning & Randomized response \\\hline
  18 - 25 & \centering{53} & \centering{48} \tabularnewline \hline
 26 - 34 & \centering{36} & \centering{45} \\\hline
 35 - 49 & 6 & 19 \\\hline
 50 + & <1 & 3\\\hline
 Total & 21 & 24\\\hline
\end{tabular}
\end{table}
 

I'd like "Direct Questioning" and "Randomized Response" to be set on
two lines in one cell, but the numbers in the columns below to be flush
right.

Any suggestions?

TIA

Peter

Peter L. Flom, PhD
Assistant Director, Statistics and Data Analysis Core
Center for Drug Use and HIV Research
National Development and Research Institutes
71 W. 23rd St
www.peterflom.com
New York, NY 10010
(212) 845-4485 (voice)
(917) 438-0894 (fax)




More information about the texhax mailing list