0

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

  • 2
    I am not exactly sure what you want. If you want to have the cells aligned top-left, you could change the cellspecification to tl as in your two lines: \multirowcell{3}[*][tl]{% and &\makecell[tl]{line with\\… If this is not what you are looking for, please add some more information. – Runar Aug 27 '16 at 22:37
  • @RunarTrollet But what is about hyphenation? For me it looks like that doesn't work in makecell. – buhtz Aug 27 '16 at 22:47
  • 2
    I cannot really figure from your very brief explanation what you want with your hyphenation. You only say that it should work, but your example has forced linebreaks, so there will be no hyphenation. What is it you expect? – Runar Aug 27 '16 at 23:01
  • @RunarTrollet I'll fix that. The forced linebreaks are there because hyphenation doesn't work. – buhtz Aug 28 '16 at 7:01
2

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

| improve this answer | |
  • It looks like a solution and I will test it on my real code soon. What is about mrwdith and arraystretch?`What do they does? – buhtz Aug 28 '16 at 10:27
  • microtype!? Greath sh...! Never heard of it before. Awsome! – buhtz Aug 28 '16 at 11:02
  • mrwidth (as shorthes for multi row width :-) ) is lenght by which I define width of parbox which is nested in multirow. arraystreatch define vertical spacing of cell content. default value is 1, its increasing for 10% should make more space between hlines and clines and cells content (test it with different stretch vales to see its effect). microtype is astonishing package for fine kerning of letters as well words in text with goals to reduce hyphenation as much as possible. unfortunately it not works with all fonts type (for details see package manual). – Zarko Aug 28 '16 at 11:16
  • Am I right to say that arraystretch doesn't work without table? I opened a new question about that problem: Vertical padding in tabularx cells without using tabular or table. – buhtz Aug 28 '16 at 13:39
  • arraystrets as name imply, is intended only for arrays, i.e. tables of any sort, for text outside table exist other commands. For example, package setspace provide some of them and environments for locally different line spacing. – Zarko Aug 28 '16 at 14:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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