# Tabular using X column not wrapping cells (tabu package)

I have the following code.

\documentclass{article}
\usepackage{lscape}
\usepackage[table]{xcolor}
\usepackage{tabu}
\usepackage{multirow}

\begin{document}
\begin{landscape}
\taburowcolors[3] 2{gray!20 .. white}
\arrayrulewidth=1pt
\begin{tabu}{ X[2.2,c] *{8}{| X[c] X[c]}}
\multirow{2}{*}{\textbf{Pseudonym}}
& \multicolumn{2}{c |}{\textbf{Abduction}}
& \multicolumn{2}{c |}{\textbf{Anteversion}}
& \multicolumn{2}{c |}{\textbf{Retroversion}}
& \multicolumn{2}{c |}{\textbf{Lateral Rotation neutral}}
& \multicolumn{2}{c |}{\textbf{Medial Rotation neutral}}
& \multicolumn{2}{c |}{\textbf{Lateral Rotation 90° abduction}}
& \multicolumn{2}{c |}{\textbf{Medial Rotation 90° abduction}}
\\

% already filled by multirow
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
\\

\hline

Proband 01
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\

Proband 02
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\

Proband 03
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\

Proband 04
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\

Proband 05
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\

Proband 07
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\

Proband 08
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\

Proband 09
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\
\end{tabu}
\end{landscape}
\end{document}


What I don't understand is, why the long lines like "Lateral Rotation neutral" don't get wrapped, so the table fits the textwidth. Using the to \textwidth option didn't change anything.

Can somebody please tell me how I get the headings of the last for columns to look like I would have typed Lateral Rotation\\neutral. I am totally stuck here.

• You have replaced the X specification in those cells by c which is single line no wrapping. May 7 '16 at 18:13
• @DavidCarlisle How could I achive the behaviour of the X cells but with centered text?
– Lilo
May 7 '16 at 18:17
• I'd always break headings by hand so \newcommand\hd[1]{\multicolumn{2}{c|}{\bfseries\begin{tabular}{@{}c@{}}#1\end{tabular}} then \hd{Lateral Rotation\\neutral} May 7 '16 at 18:30
• @DavidCarlisle If I use ure suggestion and replace \textbf{Lateral Rotation neutral} with \hd{Lateral Rotation\\neutral} I get ! Misplaced \omit. \multispan ->\omit \@multispan. I don't know what's wrong now. -.-
– Lilo
May 7 '16 at 18:52
• no use that instead of \multicolumn{2}{c |}{\textbf{Lateral Rotation neutral}} the definition includes the multicolumn call May 7 '16 at 19:00

Try to employ package makecell and use its macro \thead. In this case you need to manually broke lines in the column heads where those is necessary. For example:

\documentclass{article}
\usepackage{lscape}
\usepackage[table]{xcolor}
\usepackage{tabu}
\usepackage{makecell,multirow}

\begin{document}
\begin{landscape}
\setlength\tabcolsep{3pt}
\taburowcolors[3] 2{gray!20 .. white}
\arrayrulewidth=1pt
\begin{tabu}{@{} X[3,c] *{8}{| X[c] X[c]} @{}|}
& \multicolumn{2}{c |}{\thead[b]{Lateral\\ Rotation\\ neutral}}
& \multicolumn{2}{c |}{\thead[b]{Medial\\ Rotation\\ neutral}}
& \multicolumn{2}{c |}{\thead[b]{Lateral\\ Rotation\\ 90° abduction}}
& \multicolumn{2}{c |}{\thead[b]{Medial\\ Rotation\\ 90° abduction}}
\\
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
& \textbf{left}     & \textbf{right}
\\
\hline
Proband 01
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\
Proband 02
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
&                   &
\\
\end{tabu}
\end{landscape}
\end{document}


This MWE gives:

@{} eliminate tabcolspace in place where it is placed. In this case on the left and right border of table. It can be omitted, but I use it since your table is very tall (and can not be fitted on page). Option [b] in thead align text in column heads in bottom (without it are vertically centered).
Addendum (2): White space in colored rows are caused by facts that width of \multicolumn{2}{c|}{...} are in the most cases wider than spanning columns. This issues are treated in many questions in SE, and -- shortly -- it is not easy to resolve in tabu ...
• This looks really good. Just some questions: 1. What does @{} do? 2. How would I achieve "Pseudonym" to vertically align centered? 3. What does the b option do? I couldn't find anything on that in the package documentation. 4. How can I get rid of the white spaces in the row color in the last four columns?
• @Zarlo Thanks for your addendum. @all If I use \multirowthead{2}{Pseudonym} in the first row of the table it kinda gets aligned vertically centered but not fully. It seems like the vertical space created by the multilined cells isn't considered in the alignment. How can I fix that? And still, does anyone know a way to get rid of the white gaps in the row color?
• Regarding firts two question see edit of my question. Unfortunately the options for \thead aren't described ... from it definition (by tabular) follows that with it you can use option [t], [b] or [m], which is default. Regarding last question, use of makecell and its thead doesn't interfere with coloring of rows (as far as I know). For this issue would be better ask new question. You should be aware that tabu is not maintained and it has many bugs ... so it is advisable to consider other table environment, like tabularx for example. May 7 '16 at 19:53