# left alignment in table

I have space restriction and can give only the space mentioned in the table structure below. My concern is how to justify to left, the contents in cells so that the text Height, weight etc will be completely inside the table. I saw that, instead of |ccc| we can use |lll| or |rrr| ... but here I have |m{0.5cm}| and I don't know how to change.

\documentclass{ifacconf}
\usepackage{graphicx}      % include this line if your document contains figures
\usepackage{natbib}        % required for bibliography
% The following packages can be found on http:\\www.ctan.org
%\usepackage{graphicx} % for pdf, bitmapped graphics files
\usepackage{epsfig} % for postscript graphics files
\usepackage{mathptmx} % assumes new font selection scheme installed
\usepackage{times} % assumes new font selection scheme installed
\usepackage{amsmath} % assumes amsmath package installed
\usepackage{amssymb}  % assumes amsmath package installed
\usepackage{multirow}
\usepackage{epstopdf}
%\usepackage{cite}
\usepackage{subfigure}
\usepackage{color}
\usepackage{enumerate}
\DeclareMathOperator*{\argmax}{arg\,max}

\usepackage{tabularx,ragged2e,booktabs}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\newcolumntype{C}[1]{>{\Centering}m{#1}}
\renewcommand\tabularxcolumn[1]{C{#1}}
\begin{document}

\begin{table}[t]
\centering \caption{Details}
\begin{tabular}{|m{0.5cm}|m{0.5cm}|m{0.5cm}|m{0.5cm}|}
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\hline
No.& Age {[years]}  & Height {[cm]} & Weight {[kg]}\\\hline
11&  56& 160& 88 \\
\hline
\end{tabular}\label{10_PKPD}
\end{table}
\end{document}


I also tried to modify one line from above code as below

\begin{tabular}{|{\raggedright}m{0.5cm}|m{0.5cm}|m{0.5cm}|m{0.5cm}|}


Thank you

• Using m{0.5cm} already left aligns the contents of a cell (but with justification), but the cell gets a width of 0.5cm no matter what. Now TeX tries to put the stuff of one cell into this width like it does for a \parbox. The problem is that it can't linebreak "Weight". In other words: It is not possible without changing a size (be it the fontsize or the column width). – Skillmon Jan 10 '18 at 9:18
• Thank u for your comment, but looking at the table, its like "Age" is in the middle and "Height " is towards right – user252783 Jan 10 '18 at 9:20
• It isn't. They are leftaligned. You are tricked by the fact that there is a bit of padding around the cell (one \tabcolsep) and the fact that "Age" has a width of around 0.5cm which is why it does look centred. If you want to inject stuff like \raggedright into a column you can do this with the array-package. The syntax is >{pre-cell-content}m{0.5cm}<{post-cell-content}. So using \raggedright would look like: >{\raggedright\arraybackslash}m{0.5cm}. The \arraybackslash is to restore the \\  inside a tabular (\raggedright changes it). – Skillmon Jan 10 '18 at 9:25
• Even the unreadable \tiny font size gives Overfull \hbox messages. Can't you really use larger tables? tabularx{\linewidth} would have no problem. – Bernard Jan 10 '18 at 9:28
• I'd also say that the best approach is change stuff so that you can use more horizontal space. – Skillmon Jan 10 '18 at 9:29

Since you're bound to the column width of .5 cm, I'd suggest abbreviating your header texts adding some footnotes at the end of the table.

\documentclass{ifacconf}
\usepackage{graphicx}      % include this line if your document contains figures
\usepackage{natbib}        % required for bibliography
% The following packages can be found on http:\\www.ctan.org
%\usepackage{graphicx} % for pdf, bitmapped graphics files
\usepackage{epsfig} % for postscript graphics files
\usepackage{mathptmx} % assumes new font selection scheme installed
\usepackage{times} % assumes new font selection scheme installed
\usepackage{amsmath} % assumes amsmath package installed
\usepackage{amssymb}  % assumes amsmath package installed
\usepackage{multirow}
\usepackage{epstopdf}
%\usepackage{cite}
\usepackage{subfigure}
\usepackage{color}
\usepackage{enumerate}
\DeclareMathOperator*{\argmax}{arg\,max}

\usepackage{tabularx,ragged2e,booktabs}
\usepackage[T1]{fontenc}
\usepackage{multirow}
\usepackage{array}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\renewcommand\tabularxcolumn[1]{C{#1}}
\begin{document}

\begin{table}[t]
\centering\caption{Details\label{10_PKPD}}% put label near caption
\begin{tabular}{|C{0.5cm}|C{0.5cm}|C{0.5cm}|C{0.5cm}|}
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\hline
No.& A  & H & W\\\hline
11&  56& 160& 88 \\
\hline
\multicolumn{4}{@{}l@{}}{\footnotesize \begin{tabular}{@{}l@{}}
\rule{0pt}{9pt}A = Age [years]\\
H = Height [cm]\\
W = Weight [kg]\\
\end{tabular}}
\end{tabular}
\end{table}
\begin{table}[htb]
\centering\caption{A better layout\label{better}}% put label near caption
\begin{tabular}{C{0.5cm}C{0.5cm}C{0.5cm}C{0.5cm}}
% after \\: \hline or \cline{col1-col2} \cline{col3-col4} ...
\toprule
No.& A  & H & W\\\midrule
11&  56& 160& 88 \\
\bottomrule
\multicolumn{4}{@{}l}{\footnotesize \begin{tabular}{@{}l@{}}
\rule{0pt}{9pt}A = Age [years]\\
H = Height [cm]\\
W = Weight [kg]\\
\end{tabular}}
\end{tabular}
\end{table}
\end{document}