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}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{etoolbox}
\AtBeginEnvironment{tabular}{\footnotesize}
\AtBeginEnvironment{tabularx}{\footnotesize}
\AtBeginEnvironment{longtable}{\footnotesize}
\usepackage{multirow}
\usepackage{ltablex}
\usepackage{array}
\newcolumntype{Y}{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}X}
\newcolumntype{Z}{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}X}
\begin{document}
%\renewcommand{\tabcolsep}{3pt}
\begin{tabularx}{160pt}{ X Y Z }
% head
\hline
Name &
Long~name &
Name \\
& [unit] & [$longunit$] \\*
\hline\hline
\endhead
% foot
\hline
\endfoot
% body
\multirow{3}{1.6cm}{Text on two lines} & 0 & 0 \\*
& 0 & 0 \\*
& 0 & 0 \\
\end{tabularx}
\end{document}
I get this 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?
\tabcolsepand without) seems to lie in the different branches taken by\ifdim \wd\@tempboxa <\TX@targetin\TX@endtabularx. – Dan Oct 08 '13 at 22:05\setlengthof\tabcolsep? – Don't panic Oct 11 '13 at 08:06