Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

When I put X in column specifier, how can I define column formatting? How can I get center alignment? Currently I am putting \centering, but that is not a proper solution.

This is my code:



\caption{Case studies}
\centering Nature of unreliability & \centering Sender SST & \centering Receiver SST & \centering Implementation SST &  Retransmission Bound \\


Noisy (Single fixed error message) & DSST & DSST & DSST & Unbounded \\

share|improve this question

marked as duplicate by Joseph Wright Jul 21 '14 at 6:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

\centering is the proper solution. But if you use it in the last column you should use \tabularnewline to end the row of the tabular. –  Ulrike Fischer Feb 7 '13 at 12:27
If you want it to apply to the whole column you can use >{\centering \arraybackslash}X as it suggests in the tabularx manual. –  David Carlisle Feb 7 '13 at 12:41
Please, clarify if you need to center align only one row or all of them. –  egreg Feb 7 '13 at 13:41
@DavidCarlisle Please check my answer -- for whatever reason, >{\centering \arraybackslash}X does not suffice. –  lockstep Feb 7 '13 at 14:20

1 Answer 1

up vote 9 down vote accepted

My answer to Fixed width column with text centered/raggedright/raggedleft in tabular? can also be applied in slightly modified form to X columns. (Note that omitting \let\newline\\ will result in text that is not properly centered.)





\begin{tabularx}{\linewidth}{| c | c | Z |}
Abc & Bcd & Cde \\
Abc & Bcd & A long cell with text that is centered \newline
    and allows manual line breaks \\


enter image description here

share|improve this answer
yes \centering only redefines \` not \newline` so if you need manual breaks you can do as here, or don't use \arraybackslash and use \` for centering break and \tabularnewline` for end of table row, or perhaps simplest you can use a blank line to force a new centred parapgraph –  David Carlisle Feb 7 '13 at 16:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.