How do I right align in the following example, given that I am using p{}
for column widths?
Ideally I'd like the right hand side four columns to be right aligned, and the others left aligned.
I can get a workaround, using \multicolumn{1}{r}{...}
for each individual cell, but it's a bit long tbf…
Cheers
\begin{table}[htbp!]
\centering
\captionsetup{justification=centering}
\caption*{\textbf{Table 1.1: Summary Statistics}}
\vspace{-10pt}
\begin{threeparttable}
\begin{tabular}{p{1.5cm} p{2cm} p{2cm} p{1.5cm} p{2cm} p{1.8cm} p{1.8cm}}
\hline\hline
& & & & & & \\
Variable & Number of & Unit of & & Standard & Minimum & Maximum \\
name & observations & observation & Mean & deviation & value & value \\
\hline
\hline\hline
\end{tabular}
\end{threeparttable}
\end{table}
Best Answer
I would like to suggest that you use a
tabularx
environment, with a width set to\textwidth
. Left- and right-alignment may be achieved by definining suitably modified versions of theX
column type. Among other things, such a setup greatly simplifies inputting of cell contents that require line-breaks.