我有空间限制,只能提供下面表格结构中提到的空间。我担心的是如何将单元格中的内容向左对齐,以便文本高度、重量等完全位于表格内。我看到了,|ccc|
我们可以使用|lll|
或|rrr|
... 而不是... 但这里有|m{0.5cm}|
,我不知道如何更改。
\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}
我还尝试修改上面代码中的一行,如下所示
\begin{tabular}{|{\raggedright}m{0.5cm}|m{0.5cm}|m{0.5cm}|m{0.5cm}|}
出现错误。请帮忙
谢谢
答案1
由于列宽限制为 0.5 厘米,我建议缩短标题文本并在表格末尾添加一些脚注。
\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}