I tried to apply the method proposed in How to get column alignment in tabularx? to right align cells in a ltablex. However I have a problem when the size of the table is just enough for my columns: some cells end up on two lines, with the first one empty. Here is a minimal example:

\documentclass[a4paper, 12pt]{report}






\begin{tabularx}{160pt}{ X  Y  Z }
% head
  Name & 
  Long~name & 
  Name  \\
  & [unit] & [$longunit$]  \\* 
% foot
% body
\multirow{3}{1.6cm}{Text on two lines} & 0 & 0 \\*
 & 0 & 0   \\*
 & 0 & 0   \\


I get this result:

Compilation result

I found out that removing the \hspace{0pt} in the Y and Z column type definition solves the problem, but as it might be useful in other situations I would like to know if there is a better way to deal with this ?

Also, if I uncomment the line that redefined the tabcolsep, the Y and Z columns become left aligned again. Is there a way to have right aligned or center columns with a lower tabcolsep?

1 Answer 1


The linebreak you can fix with


\tabcolsep should be set with \setlength not \renewcommand (but it still behaves oddly here, out of time now...)

  • The difference between the two cases (with the setting of \tabcolsep and without) seems to lie in the different branches taken by \ifdim \wd\@tempboxa <\TX@target in \TX@endtabularx.
    – Dan
    Commented Oct 8, 2013 at 22:05
  • Thank you for your answers. Any news regarding the \setlength of \tabcolsep ? Commented Oct 11, 2013 at 8:06
  • @Don'tpanic been busy,perhaps at the weekend... Commented Oct 11, 2013 at 8:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .