我有一张长桌子
\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}
当表格在另一页上中断时,背景颜色会在第一页上延续,而不是在第二页上:
在此先感谢您的帮助。
答案1
- 正如我在评论中提到的,您应该防止在多行单元格中间拆分表格。
- 您可以通过
*
在行终止后添加来防止拆分(请参阅下面的 MWE) - 对于标准 LaTeX 文档类,仅定义 10pt、11pt 和 12pt 字体大小。因此
8pt
不使用(而是使用 10pt)
我稍微改变了 MWE 的表格设计,如下所示:
\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}
附录:
稍微重新设计了一下表格,可以更好地看到表格在页面之间的分割,并消除了表格序言中的混乱:
\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}
(红线显示页面布局)。