[Tex/LaTex] create a table with multirow’s auto-hyphenation

makecellmulticolumnmultirowtablesxetex

I tried some combinations of packages to reach my combination of needs. But I wasn't successfull.

  1. multirow: cells spanning over more then one row
  2. hyphenation: should work automatic
  3. allignment: cell content top left alligned
  4. vspace: vertical space between lines of text in one cell

I am free in selecting a package even if that thing works. It should be able to run with XeLaTeX.

In that example the hypenation doesn't work in makecell cells. But I need them to produce multirow and multicolumn cells. Even top-left alignment work in that cells. But I am not sure if that is the right way to find a solution for all my needs.

\documentclass{scrartcl}

\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=new]{german}

\usepackage{tabu}
%\usepackage{multirow}
\usepackage{makecell}
\usepackage{lipsum}

% multirow
% hyphenation automatic
% cell content aligned top left
% sometimes vertical space (or similar) between lines of text in one cell
\begin{document}

\newcommand{\mycline}[1]{%
    \noalign{\vspace{-\arrayrulewidth}}\tabucline{#1}%
}

\noindent
\begin{tabu} to \textwidth {|X|X|X|}
    \tabucline{-}
    \multicolumn{3}{|l|}{Headline}\\\tabucline{-}
    \multirowcell{3}[*][lt]{%
        %\lipsum[10]
        Mr Doe erreicht bis zur Überleitung drei Zeilen more much more super more%
    }
    &\makecell[lt]{line with\\
                  \phantom{0.5 baselineskip}\\
                  another line}&
    word\\\mycline{2-}
    &y&Mr Doe erreicht bis zur Überleitung drei
       Zeilen more much more super more\\\mycline{-}
\end{tabu}
\end{document}

enter image description here

Best Answer

This is more an extended comment than answer (frankly said, i don't know haw to solve your problem as it is stated ...). I wonder if you ask yourself (when problems with table arises):

  • What are benefits to use tabu table environments (regardless to well known fact that it is buggy and not maintaned)?
  • What is benefits to use makecell and multirow cells inside X type columns (which by default don't break long lines into multi line text)?
  • What is purpose of the first table row (does ti serve as table caption)?
  • Do will I refer this table in the text?
  • Does exist other, more simple and proven solution?

I did ask myself. Summarizing pros and cons of my answer I conclude, that for me is better to design the following alternative solution without use of tabu and makecell package, which fulfil all your demands for solution:

\documentclass{scrartcl}
\usepackage[showframe,              %<-- in real application this option had to be deleted 
            margin=25mm]{geometry}  %<-- added to set up and show page layout
\usepackage{xltxtra}
\usepackage{polyglossia}
\setdefaultlanguage[spelling=new]{german}

\usepackage{multirow}
\usepackage{tabularx}               %<-- used instead of "tabu"
\usepackage{calc}                   %<-- added for calculation of column width
\newlength{\mrwidth}                %<-- added for definition of multirow cell width
\usepackage{microtype}              %<-- added for better inter word spacing

\begin{document}
    \begin{table}
    \setlength{\mrwidth}{0.333\textwidth-2\tabcolsep}
    \renewcommand\arraystretch{1.1}
\caption{Headline \dots}
    \label{my special table}
\begin{tabularx}{\textwidth}{|X|X|X|}
    \hline
\multirow{3}*{\parbox{\mrwidth}{% number of own lines, 
                                % should be equal or smaller 
                                % than number of lines in other columns
Mr Doe erreicht bis zur Überleitung drei Zeilen more much more super more%
              }}
    &   line with\vspace{0.5\baselineskip}\newline
        another line
            &   word                                \\  \cline{2-3}
    &   y   &   Mr Doe erreicht bis zur Überleitung drei
                Zeilen more much more super more    \\  \hline
\end{tabularx}
    \end{table}
\end{document}

enter image description here

Related Question