0

Im currently struggling with a table i latex. I want a table like this:

enter image description here

I have found a way to make a normal table like {|c|c|} and then make the title with multicolumn.

The real struggle I have is in row 2 and 4. When using multicolumn I cannot figure out how to split the text inside the box.

And how do I move the vertical line splitting the boxes from row 2 to 4?

Hope you can help!

2
  • 2
    Start with a table which has 4 columns. Feb 6 at 10:21
  • Any news? Does answer with comment fulfil your expectation?
    – Zarko
    Mar 8 at 13:11

1 Answer 1

0

enter image description here

As is suggested in @samcarter_is_at_topanswers.xyz comment:

\documentclass{article}
\usepackage{tabularray}

\begin{document}
    \begin{table}[ht]
\begin{tblr}{width=88mm,
             hlines, vlines,
             colspec = { *{4}{X[l]} },
               hspan = minimal
             }
\SetCell[c=4]{c}    some text
        &       &       &               \\
\SetCell[c=2]{} some longer text in two lines
        &       &   \SetCell[c=2]{} some longer text in two lines
                        &               \\
\SetCell[c=4]{c}    some text     
        &       &       &               \\
\SetCell[c=3]{} some longer text in one line
        &       &       &   some text   \\
\end{tblr}
    \end{table}
\end{document}
2
  • Thanks! But now with the tabularray, how do I color some of the cells?
    – Emilie
    Feb 6 at 19:32
  • @Emilie, simple. In preamble load xcolor package and than selected cells color by \SetCell{fg=red, bg=yellow} <cell text>. See tex.stackexchange.com/questions/625246, tex.stackexchange.com/questions/629708 and of course, package documentation where is coloring thoroughly described with lot of examples. BTW, in question you not mentioned this problem...
    – Zarko
    Feb 6 at 19:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .