# How do you adjust column width of a table

I have a table in the following code:

\documentclass{revtex4-1}

\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{tabularx}

\begin{document}
\begin{table*}
\footnotesize
\caption{\label{tab:dimensionlessnumber}
Definitions and physical meanings of dimensionless quantities.}
\begin{ruledtabular}
\begin{tabularx}{\textwidth}{llX}
\textrm{number group} & \textrm{Definition} & \textrm{Physical meaning}  \\
\colrule
Density ratio               & $D=\frac{\rho_1}{\rho_2}$
& A measure of the ratio of the A to B densities            \\
Reactive number             & $R=\frac{s\Delta p}{a b C}$
& The ratio of two very different quantities, a measure of the rate of reaction (very complicated), different from another definition in the reference                         \\
Non-dimensional non-trivial parameter & $N=bk/aC$
& A measure of the non-trivial degree at another side       \\
\end{tabularx}
\end{ruledtabular}
\end{table*}

\end{document}


It gives

In this table,

1. The 2nd row of the 3rd column cannot be shown completely. Is there any way to automatically split the long entry in multi-lines with an appropriate column width so that text wider than the column width will be put on a new line?

2. The 3rd row of the 1st column was obviously longer than the length of others. I have tried \\ to break it on a new line. But in this way, the entry of the second column, e.g., the definition of $N$, will then follow the second row, see the next figure. Instead, I want it in the first row.

To solve the problem, I have used tabularx environment (with width set to \textwidth, as shown in the this question and the other question. I even used \footnotesize to reduce the font of the table. But the problems remain. Thanks for any suggestion!

Remove ruledtabular and use p type for the first column. Also to make the table a bit more readable, you can increase line spacing by \renewcommand{\arraystretch}{1.5}. Finally, instead of multiple \hlines, you may consider using booktabs for much better output.

\documentclass{revtex4-1}

\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{bm}
\usepackage{tabularx}

\begin{document}
\begin{table*}
\renewcommand{\arraystretch}{1.5}
\caption{\label{tab:dimensionlessnumber}
Definitions and physical meanings of dimensionless quantities.}
%\begin{ruledtabular}
\begin{tabularx}{\textwidth}{ >{\raggedright}p{10em} l X }
\hline \hline
\textrm{number group} & \textrm{Definition} & \textrm{Physical meaning}  \\
\hline
Density ratio               & $D=\frac{\rho_1}{\rho_2}$
& A measure of the ratio of the A to B densities            \\
Reactive number             & $R=\frac{s\Delta p}{a b C}$
& The ratio of two very different quantities, a measure of the rate of reaction (very complicated), different from another definition in the reference                         \\
Non-dimensional non-trivial parameter & $N=bk/aC$
& A measure of the non-trivial degree at another side       \\ \hline\hline
\end{tabularx}
%\end{ruledtabular}
\end{table*}

\end{document}


• Thanks @AboAmmar for your answer! Do you mean it is the using of ruledtabular or \hline that made the \begin{tabularx}{\textwidth} and Xinvalid? Actually, I have been following the style of APS template, which recommends ruledtabular and \hline. – jsxs Sep 18 '17 at 14:20

a variation of nice AboAmmar answer:

• more space between table rows is obtained by use of \makegapedcells macro from package makecell
• top and bottom horizontal lines are replaced with Xhline{0.8pt}
• equations are in \displaystale

\documentclass{revtex4-1}

\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage{amssymb}
%\usepackage{amsfonts}
\usepackage{bm}
\usepackage{makecell, tabularx}
\setcellgapes{4pt}

\begin{document}
\begin{table*}
\makegapedcells
\caption{Definitions and physical meanings of dimensionless quantities.}
\label{tab:dimensionlessnumber}
\begin{tabularx}{\textwidth}{ >{\raggedright}p{10em}
>{$\displaystyle}l<{$}
X }
\Xhline{0.8pt}
number group    &   \text{Definition}   &   Physical meaning    \\
\hline
Density ratio   & D=\frac{\rho_1}{\rho_2}
&   A measure of the ratio of the A to B densities          \\
Reactive number & R=\frac{s\Delta p}{a b C}
&   The ratio of two very different quantities, a measure of the rate of reaction (very complicated), different from another definition in the reference                                               \\
Non-dimensional non-trivial parameter
& N=\frac{bk}{aC}
&   A measure of the non-trivial degree at another side     \\
\Xhline{0.8pt}
\end{tabularx}
\end{table*}

\end{document}