# tabu and space between columns

I have aproblem with column widths in tabu environment. I set dimensions of tables and columns. First columns should have the same width = 5cm, First and second table should have the same width = 19cm. But there is a significant shift = purple rectangle on an image. How can I fix it? I need to define total width of table and widths of columns. But i have no idea how:) So please help me

\documentclass[article, 12pt, oneside]{memoir}
\setstocksize{297mm}{210mm}
\settrimmedsize{297mm}{210mm}{*}
\settrims{0mm}{0mm}
\setlrmarginsandblock{10mm}{*}{1}
\setulmarginsandblock{20mm}{*}{1}
\checkandfixthelayout
\usepackage{polyglossia}
\usepackage{microtype}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{TeX Gyre Schola}
\usepackage{tabu}
\begin{document}
\begin{center}
\begin{tabu} to 19cm {|X[5cm,p,l]|X[11cm,p,l]X[3cm,p,r]|}
\multicolumn{3}{l}{ \textit{ \textls[100]{bla bla} } } \\
\toprule
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\

\end{tabu}
\begin{tabu} to 19cm {|X[5cm,p,l]|X[14cm,p,l]|}
\multicolumn{2}{l}{ \textit{ \textls[100]{bla bla} } } \\
\toprule
bla bla & bla bla bla bla bla bla bla bla \\
bla bla & bla bla bla bla bla bla bla bla \\
bla bla & bla bla bla bla bla bla bla bla \\
\end{tabu}
\end{center}
\end{document}


-
Welcome to TeX.SX! – Heiko Oberdiek Apr 13 '14 at 9:25
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – karlkoeller Apr 13 '14 at 11:09

First of all, I've adjusted your code not to have bad boxes. If you omit the tabu length then it uses \linewidth.

If you use all columns of type X then the space is divided into the columns depending on the first parameter you give to the column.

So, specifying X[5] is not the same as specifying p{5cm}.

Moreover, the right way to specify an X column is (commas can be omitted):

X[<coef>,<align>,<type>]


where <coef> scales the widths of the X columns, if there are more than one X column and takes into consideration the length \tabcolsep, <align> is the horizontal alignment (either r, c, l or j (default)) and <type> is the vertical alignment (either p (default), m or b).

Specifying

X[5cm,p,l]


is wrong for a few reasons: you are specifying a width coefficient of 5 (5), a centered column (c) and a column type m. Then you are redefining things adding p which overwrites m and r which overwrites c. The right definition in this case would have been:

X[5,l,p]


where p can be omitted since it's the default.

If you want the result you're expecting, it is better to use fixed width columns and only the last one calculated (X).

This means that this is the right code to use:

\documentclass[article, 12pt, oneside]{memoir}
\setstocksize{297mm}{210mm}
\settrimmedsize{297mm}{210mm}{*}
\settrims{0mm}{0mm}
\setlrmarginsandblock{10mm}{*}{1}
\setulmarginsandblock{20mm}{*}{1}
\checkandfixthelayout
\usepackage{polyglossia}
\usepackage{microtype}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{TeX Gyre Schola}
\usepackage{tabu}
\begin{document}
\begin{center}
\begin{tabu} {|p{5cm}|p{11cm}X[r]|}
\multicolumn{3}{l}{ \textit{ \textls[100]{bla bla} } } \\
\toprule
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\
bla bla                     & bla bla           & bla \\

\end{tabu}
\begin{tabu} {|p{5cm}|X[l]|}

When using p{5cm} I get warnings for Underfull \hbox in paragraph every time I leave an empty column. Is there anything I can do about it (while keeping fixed width column) ? – Ciprian Tomoiaga May 11 at 3:14