\documentclass[]{article}
\usepackage{tabularx}
\newcolumntype{h}{>{\hsize=.5\hsize}X} % half width of X
\begin{document}
\begin{table}
\begin{tabularx}{\linewidth}{ h | X | X }
\hline
Ontologies &
Details &
Limitations\\
\hline
\textbf{ccsla}, \textbf{ccpricing}, \textbf{ccinstances}, \textbf{ccregions},\textbf{dmcc-schema}, \textbf{ccdm}.
&
Features:
SLA, Price, VM instance feature and Region, Vendor. Data mining experiments parameters.
\newline\newline
Availability:
Schemas and data are online. Each schema has one or two examples modelling Services from Amazon. One exception is \textbf{ccdm} which has 6 examples of different ML experiments.
&
\textbf{ccpricing} can not handle the complexity of most common price options, like cost of OS to be installed on the VM, network data transfer cost differed by destination and usage, snapshot storage costs and etc. \textbf{ccinstances} does not allow unit to be specified in data, has to be fixed for each property.
\\
\hline
\end{tabularx}
\caption{Ontologies Comparison}
\label{table:OntologiesComparison}
\end{table}
\end{document}
答案1
如果希望第一列是其他两列的一半,则需要分数之和为 3,因此第一列应设置为 3/5,其他两列应设置为 6/5。
\documentclass[]{article}
\usepackage{tabularx,booktabs}
\newcolumntype{Y}[1]{>{\hsize=#1\hsize}X}
\begin{document}
\begin{table}
\begin{tabularx}{\linewidth}{@{} >{\raggedright}Y{0.6} Y{1.2} Y{1.2} @{}}
\toprule
Ontologies & Details & Limitations\\
\midrule
\textbf{ccsla}, \textbf{ccpricing}, \textbf{ccinstances}, \textbf{ccregions},
\textbf{dmcc-schema}, \textbf{ccdm}.
&
Features:
SLA, Price, VM instance feature and Region, Vendor. Data mining experiments
parameters.
\bigskip
Availability:
Schemas and data are online. Each schema has one or two examples modelling
Services from Amazon. One exception is \textbf{ccdm} which has 6 examples
of different ML experiments.
&
\textbf{ccpricing} can not handle the complexity of most common price options,
like cost of OS to be installed on the VM, network data transfer cost differed
by destination and usage, snapshot storage costs and etc. \textbf{ccinstances}
does not allow unit to be specified in data, has to be fixed for each property.
\\
\bottomrule
\end{tabularx}
\caption{Ontologies Comparison}
\label{table:OntologiesComparison}
\end{table}
\end{document}
我添加了booktabs
规则,使其周围有更多空间,并将第一列排版为右侧参差不齐。
另外,在发现dmcc-schema
损坏后,请相应地设置宽度。
\documentclass[]{article}
\usepackage{tabularx,booktabs}
\newlength{\mytabwidth}
\begin{document}
\begin{table}
\settowidth{\mytabwidth}{\textbf{dmcc-schema},}
\begin{tabularx}{\linewidth}{@{} >{\raggedright}p{\mytabwidth} X X @{}}
\toprule
Ontologies & Details & Limitations\\
\midrule
\textbf{ccsla}, \textbf{ccpricing}, \textbf{ccinstances}, \textbf{ccregions},
\textbf{dmcc-schema}, \textbf{ccdm}.
&
Features:
SLA, Price, VM instance feature and Region, Vendor. Data mining experiments
parameters.
\bigskip
Availability:
Schemas and data are online. Each schema has one or two examples modelling
Services from Amazon. One exception is \textbf{ccdm} which has 6 examples
of different ML experiments.
&
\textbf{ccpricing} can not handle the complexity of most common price options,
like cost of OS to be installed on the VM, network data transfer cost differed
by destination and usage, snapshot storage costs and etc. \textbf{ccinstances}
does not allow unit to be specified in data, has to be fixed for each property.
\\
\bottomrule
\end{tabularx}
\caption{Ontologies Comparison}
\label{table:OntologiesComparison}
\end{table}
\end{document}
答案2
来自tabularx
文档:
确保所有列的宽度总和
X
保持不变。[...]
因此,您必须将第二列和第三列从X
列更改为(总共有 3 个类型列)>{\hsize=.5\hsize}X
1.25+1.25+0.5=3
X
\documentclass[]{article}
\usepackage{tabularx}
\newcolumntype{h}{>{\hsize=.5\hsize}X} % half width of X
\begin{document}
\begin{table}
\begin{tabularx}{\linewidth}{ >{\hsize=.5\hsize}X | >{\hsize=1.25\hsize}X | >{\hsize=1.25\hsize}X }
\hline
Ontologies &
Details &
Limitations\\
\hline
\textbf{ccsla}, \textbf{ccpricing}, \textbf{ccinstances}, \textbf{ccregions},\textbf{dmcc-schema}, \textbf{ccdm}.
&
Features:
SLA, Price, VM instance feature and Region, Vendor. Data mining experiments parameters.
\newline\newline
Availability:
Schemas and data are online. Each schema has one or two examples modelling Services from Amazon. One exception is \textbf{ccdm} which has 6 examples of different ML experiments.
&
\textbf{ccpricing} can not handle the complexity of most common price options, like cost of OS to be installed on the VM, network data transfer cost differed by destination and usage, snapshot storage costs and etc. \textbf{ccinstances} does not allow unit to be specified in data, has to be fixed for each property.
\\
\hline
\end{tabularx}
\caption{Ontologies Comparison}
\label{table:OntologiesComparison}
\end{table}
\end{document}
答案3
来自 LaTeX 伴侣
通常,
X
单个表中的所有列都设置为相同的宽度。不过,也可以将tabularx
它们设置为不同的宽度。如下所示的序言
>{\setlength\hsize{.5\hsize}}X>{\setlength\hsize{1.5\hsize}}X}
指定两列;第二列的宽度将是第一列的三倍。但是,使用此方法时应遵守两个规则:
- 所有 X 列的宽度总和应保持不变。在上面的示例中,新宽度应等于两个标准 X 列的宽度之和。
- 不应使用任何跨越 X 列的 \multicolumn 条目。
因此,附加到的所有因子的总和\hsize
必须保持等于列数。在您的例子中,您有 3 列。由于列h
是0.5\hsize
,其他两列必须加到3 (total number of columns) - 0.5 = 2.5
。将 2.5 除以 2 得到 1.25。因此,其他两列的大小应该是\hsize=1.25\hsize
\documentclass[]{article}
\usepackage{tabularx}
\newcolumntype{h}{>{\hsize=.5\hsize}X} % half width of X
\begin{document}
\begin{table}
\begin{tabularx}{\linewidth}{ h | >{\hsize=1.25\hsize}X | >{\hsize=1.25\hsize}X }
\hline
Ontologies &
Details &
Limitations\\
\hline
\textbf{ccsla}, \textbf{ccpricing}, \textbf{ccinstances}, \textbf{ccregions},\textbf{dmcc-schema}, \textbf{ccdm}.
&
Features:
SLA, Price, VM instance feature and Region, Vendor. Data mining experiments parameters.
\newline\newline
Availability:
Schemas and data are online. Each schema has one or two examples modelling Services from Amazon. One exception is \textbf{ccdm} which has 6 examples of different ML experiments.
&
\textbf{ccpricing} can not handle the complexity of most common price options, like cost of OS to be installed on the VM, network data transfer cost differed by destination and usage, snapshot storage costs and etc. \textbf{ccinstances} does not allow unit to be specified in data, has to be fixed for each property.
\\
\hline
\end{tabularx}
\caption{Ontologies Comparison}
\label{table:OntologiesComparison}
\end{table}
\end{document}