我需要排版表格注释,有时甚至需要在表格主体中引用它们。因此我尝试使用talltblr
浮动表格环境。
MWE 是:
\documentclass{article}
\usepackage[a5paper]{geometry} % a5 paper
\usepackage[utf8]{inputenc} % input encoding
\usepackage[english]{babel} % localization
\usepackage{caption} % caption control
\usepackage{indentfirst} % first line indent
\usepackage{tabularray} % tabularray package
\usepackage[unicode=true, % unicode encoded pdf strings
colorlinks=true, % use colored links
linkcolor=black, % color of links
]{hyperref}
\captionsetup[table]
{labelsep=period, % caption separation for tables
position=t, % caption position for tables
justification=raggedright, % caption alignment for tables
singlelinecheck=off, % don't center single line table captions
aboveskip=0.5em} % above skip for table captions
\newcommand{\normalparindent}{5ex}
\parindent=\normalparindent
\ExplSyntaxOn
% Period separator
\DefTblrTemplate { caption-sep } { mycapsep } { .\enskip }
% My own caption template
\DefTblrTemplate { caption } { mycaption }
{
\UseTblrAlign { caption }
\UseTblrIndent { caption }
\UseTblrHang { caption }
\leavevmode
\makebox [ \linewidth ] [ l ]
{
\parbox { \textwidth }
{
\raggedright
\strut
\UseTblrTemplate { caption-tag } { default }
\UseTblrTemplate { caption-sep } { mycapsep }
\UseTblrTemplate { caption-text } { default }
\strut
}
}
}
% Tabularray theme using mycaption template
\NewTblrTheme { mycaptiontheme }
{
\SetTblrTemplate { caption } { mycaption }
}
\ExplSyntaxOff
\begin{document}
\pagestyle{empty}
\begin{table}[!h]
\begin{talltblr}
[theme = mycaptiontheme,
caption = {Simple floating three part table with two or more notes},
label = {tab:table-simple-mycaption-notes},
note{1} = {The first note text. And a long line of dummy text.},
note{2} = {The first note text. And a long line of dummy text.}]
{colspec = {ccc},
row{1} = {font=\bfseries},
hline{1,2,Z} = {1pt},
vlines = {1pt},
hspan = minimal}
Head:A & Head:B & Head:C \\
A1 & B1 & C1 \\
A2 & B2 & C2 \\
A3 & B3 & C3 \\
\end{talltblr}
\end{table}
\begin{table}[!h]
\begin{talltblr}
[theme = mycaptiontheme,
caption = {Simple floating three part table with two or more notes},
label = {tab:table-simple-mycaption-note},
remark{Note} = {The single note text.
And a long line of dummy text.
And another long line of dummy text.}]
{colspec = {ccc},
row{1} = {font=\bfseries},
hline{1,2,Z} = {1pt},
vlines = {1pt},
hspan = minimal}
Head:A & Head:B & Head:C \\
A1 & B1 & C1 \\
A2 & B2 & C2 \\
A3 & B3 & C3 \\
\end{talltblr}
\end{table}
\end{document}
但我希望注释和备注使用段落缩进,并且看起来像是在最后一个跨表行中排版(应使用水平线和垂直线以及间距)。就像下图所示:
有没有办法做这样的事?