Take the 2-minute tour ×
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.

How do I get the text within a multicolumn to wrap when using tabu? I am hoping that tabu makes it somewhat easier than having to specify p with a manual specification of the width \multicolumn{2}{p...}{...} since one of the main reasons I am using tabu is to get the tables set more automatically but my reading of the tabu manual and my trial and error attempts and not been successful.

Here is an obviously wrong attempt since c does not wrap but at least it gets some code out that could be modified:

\documentclass{article}
\usepackage{tabu}
\begin{document}
\noindent\begin{tabu} to\linewidth{|X|X|X|}
\tabucline-
\multicolumn{2}{c}{ 1 aaaaaaaaa 2 aaaaaaaaa 3 aaaaaaaaa 4 aaaaaaaaa 5 aaaaaaaaa 6
    aaaaaaaaa 7 aaaaaaaaa 8 aaaaaaaaa 9 aaaaaaaaa}&Feb\\ 
Mar&Apr&May\\ 
\tabucline-
\tabuphantomline
\end{tabu}
\end{document}

which gives this output:

screenshot

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

enter image description here

You can use a p column of the width calculated. In tabularx it would be \TX@col@width but in tabu it seems to be called \tabucolX

\documentclass{article}
\usepackage{tabu}
\begin{document}

\noindent\begin{tabu} to\linewidth{|X|X|X|}
\tabucline-
\multicolumn{2}{|p{\dimexpr 2\tabucolX+2\tabcolsep+\arrayrulewidth\relax}|}{1 aaaaaaaaa 2 aaaaaaaaa 3 aaaaaaaaa 4 aaaaaaaaa 5 aaaaaaaaa 6 aaaaaaaaa 7 aaaaaaaaa 8 aaaaaaaaa 9 aaaaaaaaa}&Feb\\ 
Mar&Apr&May\\ 
\tabucline-
\tabuphantomline
\end{tabu}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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