编辑:
问题描述有所改进(我希望如此)。
在某些情况下,当表格必须封装到subtables
环境(在caption
包中定义)中时,这些环境位于两个连续table
的浮点数中,并且应该具有相同的标题标签,如果使用表格,则宏\ContinuedFloat
会照顾table
浮点数以及s ,, ... 当使用包中定义的表格时,也会照顾表。subtable
tabular
tabularx
tblr
tabularray
然而,当你因为某种原因需要talltblr
(也就是你可以在表体下方写注释和备注)时,情况就会发生巨大的变化:
- 宏
\ContinuedFloat
不影响字幕talltblr
subtable
不影响字幕talltblr
我尝试通过 来解决这个问题talltblr
。\DefTblrTemplate{caption}{default}{}
它删除了标题,但没有增加(有趣的是)table
计数器,因此\end{table}
应该在之前添加\addtocounter{table}{-1}
。
另一个问题是 中的标题subtable
不会像 中那样递增tblr
。 这也可以通过\addtocounter{subtable}{1}
在第二个 中的标题前添加 来解决subtable
。 手动更改的计数器在文档文本中有效,但在 中完全失效\listoftables
。 因此,当使用 时,这种解决表格编号问题的方法talltblr
没有用。
我想知道,是否有人知道如何更好地解决这个问题,或者这应该是向软件包作者提出的功能请求?
不那么短的MWE:
\documentclass{article}
\usepackage[vmargin=20mm]{geometry}
\usepackage{enumitem}
\usepackage[skip=0pt]{caption}
\usepackage[list=true,listformat=simple]{subcaption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx, counter}
\begin{document}
\listoftables
%%%%%%%% tblr
\begingroup
\DefTblrTemplate{caption}{default}{}
\sisetup{
input-open-uncertainty =,
input-close-uncertainty =,
table-format={(}1.3{$^{***}$}, % reserve space for text before/after numbers
}
\begin{table}[!ht]
\centering
\caption{Caption Text, \texttt{tblr}}
\label{tab:1}
%
\begin{subtable}{\linewidth}
\centering
\caption{first sub table}
\label{tab:1-1}
\begin{tblr}{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
1 & 1.234
& 1.234 & 1.234
& 1.234 & 1.234 \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{tblr}
\end{subtable}
\end{table}
\begin{table}[!ht]\ContinuedFloat
\centering
\caption[]{Caption Text, \texttt{tblr} -- \textit{Continued}}
%
\begin{subtable}{\linewidth}
\centering
\caption{second sub table}
\label{tab:1-2}
\begin{tblr}{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
2 & 5.678
& 5.678 & 5.678
& 5.678 & 5.678 \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{tblr}
\end{subtable}
\end{table}
\endgroup
%%%%%%%% talltblr
\begingroup
\DefTblrTemplate{caption}{default}{}
\sisetup{
input-open-uncertainty =,
input-close-uncertainty =,
table-format={(}1.3{$^{***}$}, % reserve space for text before/after numbers
}
\begin{table}[!htb]
\centering
\caption{Caption Text, \texttt{talltblr}}
\label{tab:1}
%
\begin{subtable}{\linewidth}
\centering
\caption{first sub table}
\label{tab:1-1}
\begin{talltblr}[
note{} = {SE in parentheses:
*: $p<0.10$,\quad
**: $p<0.05$,\quad
***: $p<0.01$.
},
]{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
1 & 1.234\TblrNote{*}
& 1.234 & 1.234\TblrNote{**}
& 1.234 & 1.234\TblrNote{***} \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{talltblr}
\end{subtable}
\addtocounter{table}{-1}
\end{table}
\begin{table}[!ht]\ContinuedFloat
\centering
\caption[]{Caption Text, \texttt{talltblr} -- \textit{Continued}}
%
\begin{subtable}{\linewidth}
\addtocounter{subtable}{1}
\centering
\caption{second sub table}
\label{tab:1-2}
\begin{talltblr}[
note{} = {SE in parentheses:
*: $p<0.10$,\quad
**: $p<0.05$,\quad
***: $p<0.01$.}
]{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
2 & 5.678\TblrNote{*}
& 5.678 & 5.678\TblrNote{**}
& 5.678 & 5.678\TblrNote{***} \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{talltblr}
\end{subtable}
\addtocounter{table}{-1}
\end{table}
\endgroup
\begin{table}[!ht]
\centering
any table body
\caption{Test of table numbering}
\end{table}
\end{document}
答案1
解决方案是添加label=none,entry=none,
到talltblr
。第一个确保计数器不会增加,第二个隐藏表列表中的条目。您需要这样做,因为 涵盖了这两个方面subtable
。
那么您就不必操作计数器table
了。
顺便问一下,的用途是什么\begingroup ... \endgroup
?
\documentclass{article}
\usepackage[vmargin=20mm]{geometry}
\usepackage{enumitem}
\usepackage[skip=0pt]{caption}
\usepackage[list=true,listformat=simple]{subcaption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx, counter}
\begin{document}
\listoftables
%%%%%%%% tblr
\begingroup
\DefTblrTemplate{caption}{default}{}
\sisetup{
input-open-uncertainty =,
input-close-uncertainty =,
table-format={(}1.3{$^{***}$}, % reserve space for text before/after numbers
}
\begin{table}[!ht]
\centering
\caption{Caption Text, \texttt{tblr}}
\label{tab:1}
%
\begin{subtable}{\linewidth}
\centering
\caption{first sub table}
\label{tab:1-1}
\begin{tblr}{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
1 & 1.234
& 1.234 & 1.234
& 1.234 & 1.234 \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{tblr}
\end{subtable}
\end{table}
\begin{table}[!ht]\ContinuedFloat
\centering
\caption[]{Caption Text, \texttt{tblr} -- \textit{Continued}}
%
\begin{subtable}{\linewidth}
\centering
\caption{second sub table}
\label{tab:1-2}
\begin{tblr}{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
2 & 5.678
& 5.678 & 5.678
& 5.678 & 5.678 \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{tblr}
\end{subtable}
\end{table}
\endgroup
%%%%%%%% talltblr
\begingroup
\DefTblrTemplate{caption}{default}{}
\sisetup{
input-open-uncertainty =,
input-close-uncertainty =,
table-format={(}1.3{$^{***}$}, % reserve space for text before/after numbers
}
\begin{table}[!htb]
\centering
\caption{Caption Text, \texttt{talltblr}}
\label{tab:2}
%
\begin{subtable}{\linewidth}
\centering
\caption{first sub table}
\label{tab:2-1}
\begin{talltblr}[label=none,entry=none,
note{} = {SE in parentheses:
*: $p<0.10$,\quad
**: $p<0.05$,\quad
***: $p<0.01$.
},
]{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
1 & 1.234\TblrNote{*}
& 1.234 & 1.234\TblrNote{**}
& 1.234 & 1.234\TblrNote{***} \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{talltblr}
\end{subtable}
\end{table}
\begin{table}[!ht]\ContinuedFloat
\centering
\caption[]{Caption Text, \texttt{talltblr} -- \textit{Continued}}
%
\begin{subtable}{\linewidth}
\centering
\caption{second sub table}
\label{tab:2-2}
\begin{talltblr}[label=none,entry=none,
note{} = {SE in parentheses:
*: $p<0.10$,\quad
**: $p<0.05$,\quad
***: $p<0.01$.}
]{colspec={ l *{5}{S} },
row{1} = {font=\bfseries, guard},
}
\toprule
A & B & C & D & E & F \\
\midrule
2 & 5.678\TblrNote{*}
& 5.678 & 5.678\TblrNote{**}
& 5.678 & 5.678\TblrNote{***} \\
&(0.123)&(0.123)&(0.123)&(0.123)&(0.123) \\
\bottomrule
\end{talltblr}
\end{subtable}
\end{table}
\endgroup
\begin{table}[!ht]
\centering
any table body
\caption{Test of table numbering}
\end{table}
\end{document}