# tabularx column has extra padding at right?

\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}


If you want that the first column is half of the other two, you need that the sum of the fractions is 3, so the first column should be set at 3/5, and the other two at 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}


I added booktabs rules, that have more room around them, and typeset the first column ragged right.

As an alternative, after seeing that dmcc-schema gets broken, set the width accordingly.

\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}


From the tabularx documentation:

Make sure that the sum of the widths of all the Xcolumns is unchanged.[...]

You will therefore have to change from X column to >{\hsize=.5\hsize}X for the second and third column (as 1.25+1.25+0.5=3 with a total number of 3 X type columns)

\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}

• Thank you, but egreg's answer is just so elegant, and fixed problems that I didn't know exist. – Miranda Apr 22 '19 at 17:03

From The LaTeX Companion

Normally, all X columns in a single table are set to the same width. It is nevertheless possible to make tabularx set them to diﬀerent widths. A preamble like the following

>{\setlength\hsize{.5\hsize}}X>{\setlength\hsize{1.5\hsize}}X}

speciﬁes two columns; the second column will be three times as wide as the ﬁrst. However, when using this method two rules should be obeyed:

1. The sum of the widths of all X columns should remain unchanged. In the above example, the new widths should add up to the width of two standard X columns.
2. Any \multicolumn entries that cross any X column should not be used.

Thus, the total summation of all factors attached to \hsize must stay equal to the number of columns. In your case, you have 3 columns. Since column h is 0.5\hsize, the other two must add to 3 (total number of columns) - 0.5 = 2.5. Dividing 2.5 over two gives us 1.25. Thus, the size for the other two columns should be \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}

• Thank you too, I only saw your answer after I accepted the first answer then refreshed the page. – Miranda Apr 22 '19 at 16:26