In this answer : Tabularx table with multirows and multicolumns, I have discovered the \hsize
possibility to tune X
column width of tabularx
table.
The documentation says :
Make sure that the sum of the widths of all the X columns is unchanged.
But the answer says :
\begin{tabularx}{\textwidth}{|>{\hsize=0.5\hsize}X|
*{3}{ >{\hsize=1.5\hsize}X|}
}
that makes a sum of 5 for 4 columns, and it leeds to problems if one not fill columns enought.
Questions :
-
Why it works in the example and not in the following example ?
-
What is the correct method to calculate the
\hsize
s ?
\documentclass{article}
\usepackage{tabularx}
\begin{document}
\begin{table}
\begin{tabularx}{\linewidth}{|>{\hsize=0.5\hsize}X|
*{3}{ >{\hsize=1.5\hsize}X|}
}\hline
1&2&3&4\\\hline
\end{tabularx}
\bigskip
% My proposition if correctly understood the manuel
\begin{tabularx}{\linewidth}{|>{\hsize=0.5\hsize}X|
*{3}{ >{\hsize=1.16667\hsize}X|}
}\hline
1&2&3&4\\\hline
\end{tabularx}
\end{table}
\end{document}
Best Answer
It seems you want three equal-width columns (let's denote their width by
x
), plus another column that's one-third as wide as the other three; denote its width byy
. The combined width of the four columns should equal\linewidth
.The computation is that of barycentric coordinates: you have to solve the linear system:
It is easy to find this yields
y=0.4
andx=1.2
, whence the code: