0

I've a long table

\documentclass[8pt]{report}

\usepackage[utf8]{inputenc} %Accept different input encodings
\usepackage[T1]{fontenc} %Standard package for selecting font encodings.
\usepackage[UKenglish]{babel}
\usepackage{xcolor, colortbl} %Driver-independent color extensions.

\usepackage{tabularray} %Typeset Tabulars and Arrays with LATEX3
\usepackage{booktabs} % Required for nicer horizontal rules in tables

\usepackage{lipsum}  % Generate random latin text.

% Solid colors used by custom
\definecolor{customPink}{RGB}{255,000,255}
\definecolor{customLightBlue}{RGB}{034,181,255}
\definecolor{customYellow}{RGB}{255,194,000}
\definecolor{customDarkBlue}{RGB}{000,113,188}

\definecolor{customShadePink1}{RGB}{233,099,253}
\definecolor{customShadePurple1}{RGB}{155,086,244}
\definecolor{customShadeBlue1}{RGB}{087,129,242}

\definecolor{customGrey}{RGB}{128,128,128}
\definecolor{customGreyLight}{RGB}{243,243,234}

\definecolor{customGreyHeaderTable}{RGB}{230,230,230}
\definecolor{customGreyRowTable}{RGB}{250,250,250}

\begin{document}
    \lipsum[1-3]
    \begin{longtblr}[
                caption = {Expection processing flow - SCT messages},
                label ={table_ISO20022_Happy_flow_SCT_messages}
                ]
                {
                    hline{1,Z} = {1pt,solid},
                    hline{2} = {1}{1pt, solid, customGrey, leftpos=0},
                    hline{2} = {2-Y}{1pt, solid, customGrey},
                    hline{2} = {Z}{1pt, solid, customGrey, rightpos=0},
                    hline{3-Y} = {customGreyLight, leftpos=0, rightpos=0},
                    vline{1,Z} = {1pt,solid},
                    vline{2-Y} = {customGreyLight},
                    columns  = {l},
                    row{1}  = {bg=customGreyHeaderTable, fg=customShadePink1,font=\bfseries},
                    row{2-Z}= {bg=gray, fg=white}
                }
    
        Initial message & R-Transaction & Wording of the R-Transaction  \\
    \SetCell[r=7]{l}pacs.008  & camt.027 & SCT Inquiry for Claim of Non-Receipt \\
    & camt.029 & {Negative Response to a Recall, \\ RFRO \\ or SCT Inquiry use cases;\\ Positive Response to SCT Inquiry use cases} \\
    & camt.056 & Recall; RFRO \\
    & camt.087 & SCT Inquiry for Value Date Correction \\
    & pacs.002 & Reject \\
    & pacs.004 & {Return;\\ Positive Response to a Recall \\ or RFRO} \\
    & pacs.028 & {Request for Status Update on a Recall, RFRO \\ or SCT Inquiry use cases} \\
    pain.001 & pain.002 & Reject \\
    \end{longtblr}
\end{document}

and when the table breaks on another page, the backgroup color is continuing on the first page and not the second page: Issue

Issue with other colors

Thanks in advance for your help.

2
  • (i) your table example is only on one page, change example so, that we will be able to see your problem. (ii) selection of colors make observing the ground colors very difficult. For test you should define more saturated, easy to observe ones. (iii) at table design you should prevent its splitting at the middle of multirow cells -- this cause many problems, not only wrong coloring.
    – Zarko
    Dec 4, 2023 at 9:57
  • Hello, I have updated the description and the code to give more contrast. For the splitting, I did not want to force the splitting myself since it means each time, I'll update that place in the document, I'll maybe need to change the break page and longtblr is supposed to handle the splitting efficiently.
    – spawnkam
    Dec 4, 2023 at 13:08

1 Answer 1

1
  • As I mentioned in my comment, you should prevent table splitting at the middle of multirow cells .
  • Splitting you can prevent by adding * after row termination (see MWE below)
  • For standard LaTeX document classes are defined only 10pt, 11pt and 12pt font size. consequently 8pt is not used (10pt instead it)

MWE, in which I a little bit change table design, is:

\documentclass{report}

%\usepackage[utf8]{inputenc} %Accept different input encodings
\usepackage[T1]{fontenc} %Standard package for selecting font encodings.
\usepackage[UKenglish]{babel}
\usepackage[table]{xcolor} %Driver-independent color extensions.

\usepackage{tabularray} %Typeset Tabulars and Arrays with LATEX3
\UseTblrLibrary{booktabs}
%\usepackage{booktabs} % Required for nicer horizontal rules in tables

\usepackage{lipsum}  % Generate random latin text.

% Solid colors used by custom
\definecolor{customPink}{RGB}{255,000,255}
\definecolor{customLightBlue}{RGB}{034,181,255}
\definecolor{customYellow}{RGB}{255,194,000}
\definecolor{customDarkBlue}{RGB}{000,113,188}

\definecolor{customShadePink1}{RGB}{233,099,253}
\definecolor{customShadePurple1}{RGB}{155,086,244}
\definecolor{customShadeBlue1}{RGB}{087,129,242}

\definecolor{customGrey}{RGB}{128,128,128}
\definecolor{customGreyLight}{RGB}{243,243,234}

\definecolor{customGreyHeaderTable}{RGB}{230,230,230}
\definecolor{customGreyRowTable}{RGB}{250,250,250}

\begin{document}
    \lipsum[1-3]
    \begin{longtblr}[
                caption = {Expection processing flow - SCT messages},
                label ={table_ISO20022_Happy_flow_SCT_messages}
                ]
                {
                    hline{1,Z} = {1pt,solid},
                    hline{2} = {1}{1pt, solid, customGrey, leftpos=0},
                    hline{2} = {2-Y}{1pt, solid, customGrey},
                    hline{2} = {Z}{1pt, solid, customGrey, rightpos=0},
                    hline{3-Y} = {customGreyLight, leftpos=0, rightpos=0},
                    vline{1,Z} = {1pt,solid},
                    vline{2-Y} = {customGreyLight},
                    colspec  = { X[l] X[l] X[2.5,l]},   % <---
                    row{1}  = {bg=customGreyHeaderTable, fg=customShadePink1,font=\bfseries},
                    row{2-Z}= {bg=gray, fg=white}
                }

Initial message & R-Transaction & Wording of the R-Transaction          \\
\SetCell[r=7]{l}    
    pacs.008    & camt.027      & SCT Inquiry for Claim of Non-Receipt  \\*
                & camt.029      & Negative Response to a Recall, RFRO 
                                  or SCT Inquiry use cases; Positive Response 
                                  to SCT Inquiry use cases                  \\*
                & camt.056      & Recall; RFRO                          \\*
                & camt.087      & SCT Inquiry for Value Date Correction \\*
                & pacs.002      & Reject                                \\*
                & pacs.004      & {Return;\\ Positive Response to a Recall or RFRO}     \\*
                & pacs.028      & Request for Status Update on a Recall, 
                                  RFRO or SCT Inquiry use cases         \\
pain.001        & pain.002      & Reject                                \\
    \end{longtblr}
\end{document}

enter image description here

Addendum:
A wee bit redesigned table that is better to see spliting of table between pages and with removed clutter from table preamble:

\documentclass{report}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                              % for dummy text
%---------------------------------------------------------------%
\usepackage[T1]{fontenc} %Standard package for selecting font encodings.
\usepackage[UKenglish]{babel}

\usepackage{xcolor} %Driver-independent color extensions.
\usepackage{tabularray} %Typeset Tabulars and Arrays with LATEX3

\usepackage{lipsum}  % Generate random latin text.

% Solid colors used by custom

\definecolor{customShadePink1}{RGB}{233,099,253}

\definecolor{customGrey}{RGB}{128,128,128}
\definecolor{customGreyLight}{RGB}{243,243,234}

\definecolor{customGreyHeaderTable}{RGB}{230,230,230}

\begin{document}
    \lipsum[1-2]\lipsum[23]
    \begin{longtblr}[
caption = {Expection processing flow - SCT messages},
  label = {table_ISO20022_Happy_flow_SCT_messages}
                ]{
        hline{1,Z} = {1pt},
        hline{2}   = {1pt, customGrey, leftpos=0, rightpos=0},
        hline{3-Y} = {customGreyLight, leftpos=0, rightpos=0},
        vline{1,Z} = {1pt},
        vline{2-Y} = {customGreyLight},
        colspec    = { X[0.6, l] X[0.8, l] X[2.6,l]},   % <---
        row{1}     = {c, bg=customGreyHeaderTable, fg=customShadePink1,font=\bfseries},
        row{2-Z}   = {bg=gray, fg=white}
                }

Initial message & R-Transaction & {Wording of the\\ R-Transaction}      \\
\SetCell[r=7]{l}
    pacs.008    & camt.027      & SCT Inquiry for Claim of Non-Receipt  \\*
                & camt.029      & Negative Response to a Recall, RFRO
                                  or SCT Inquiry use cases; Positive Response
                                  to SCT Inquiry use cases                  \\*
                & camt.056      & Recall; RFRO                          \\*
                & camt.087      & SCT Inquiry for Value Date Correction \\*
                & pacs.002      & Reject                                \\*
                & pacs.004      & {Return;\\ Positive Response to a Recall or RFRO}     \\*
                & pacs.028      & Request for Status Update on a Recall,
                                  RFRO or SCT Inquiry use cases         \\
\SetCell[r=3]{l}
 pain.001       & pain.002      & Reject                                \\*
                & pain.003      & whatever                              \\*
                & pain.004      & whatever                              \\
    \end{longtblr}
\end{document}

enter image description here

(red lines shows page layout).

You must log in to answer this question.

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