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}|}
which gives error. Please help
Thank you
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).\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 thearray
-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 atabular
(\raggedright
changes it).\tiny
font size givesOverfull \hbox
messages. Can't you really use larger tables?tabularx{\linewidth}
would have no problem.