3

I'm using the package tabularray to create my tables in LaTeX. Everything works fine, except when I merge rows. In that case, if the merged rows are at the bottom of the page, the cell content and its background color are not evenly distributed across the two pages. As you can see in the screenshot below, the cell content of the merged rows stays on the first page and goes out of the table, overflowing in the footer.

Overflow of the text in the merged rows

Here is my MWE :

\documentclass[a6paper]{article}

\usepackage[margin=2cm]{geometry}
\usepackage{xcolor}
\usepackage{tabularray}



\begin{document}

\vspace*{5.5cm}

    \begin{longtblr}
{
row{odd} = {bg = black!15}, % Background color of odd rows
row{even} = {bg = white}, % Background color of even rows
colspec = {Q[0.2\textwidth,c] Q[0.25\textwidth,c] Q[0.4\textwidth,c]} % Width of the 3 columns of the table
}
a & a & a \\
a & a & a \\
\SetCell[r=4]{}
privation, négation, séparation & a--, an--                                     & amoral, analphabète, anarchie                                                        \\
                                & dé--, dés--                                   & démonter, désunion, désobéir                                                         \\
                                & dif, dis--, div--                             & différent, disparaître, diverger                                                     \\
                                & il--, im--, in--, ir--, mal--                 & illisible, illettré, impossible, inutile, irrégulier, malheureux                     \\
a & a & a \\
a & a & a \\
a & a & a \\
a & a & a \\
a & a & a \\
    \end{longtblr}

\end{document}

What I'm searching for is an automated solution to this problem, not a hack like inserting a line break or something in the merged cells. Thanks in advance for your help.

1
  • 2
    Terminations of merged rows shout be \\*
    – Zarko
    Nov 18, 2023 at 10:40

1 Answer 1

3

Your main problem is solved by (my) comment. So some of topic remarks:

  • your well nicer if you will use in it smaller font size, for example `\footnotesize
  • instruction row{even} = {bg = white} is superfluous
  • I wild add first and last hline
  • multi row cell I would have in the same color
\documentclass[a6paper]{article}
\usepackage[margin=2cm, showframe]{geometry}
\usepackage{ragged2e}
\usepackage{xcolor}
\usepackage{tabularray}
\SetTblrStyle{contfoot}{font=\footnotesize\itshape}


\begin{document}

\vspace*{5.5cm}

\begin{longtblr}{colsep  = 2pt, % <---
                 colspec = {l                           
                            Q[0.28\textwidth,l]             % <---
                            X[cmd=\RaggedRight\hspace{0PT}] % <---
                            },
                 cells = {font=\footnotesize},
                 row{odd} = {bg = black!15}, % Background color of odd rows
                 rowsep = 1pt,
                 hline{1,Z}}                                % <---
a & a & a \\
a & a & a \\
\SetCell[r=4]{bg=white}
{privation,\\ négation,\\ séparation}                       % <--- manulay split into several lines
    & a--, an--         & amoral, analphabète, anarchie     \\* % prevent table broken
    & dé--, dés--       & démonter, désunion, désobéir      \\* % prevent table broken
    & dif, dis--, div-- & différent, disparaître, diverger  \\* % prevent table broken
    & il--, im--, in--, ir--, mal--                 
                        & illisible, illettré, impossible, inutile, irrégulier, malheureux  \\
a & a & a \\
a & a & a \\
a & a & a \\
a & a & a \\
a & a & a \\
    \end{longtblr}
\end{document}

enter image description here

1
  • Thank you very much, the command \* solved my problem ! This command is in fact written in the documentation of the package tabularray, but it's always easier to search for something when you know what to search.
    – Adriem7
    Nov 18, 2023 at 12:14

You must log in to answer this question.

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