![更正包含多个 tabularx 的 ThreePartTable 标签编号](https://linux22.com/image/352359/%E6%9B%B4%E6%AD%A3%E5%8C%85%E5%90%AB%E5%A4%9A%E4%B8%AA%20tabularx%20%E7%9A%84%20ThreePartTable%20%E6%A0%87%E7%AD%BE%E7%BC%96%E5%8F%B7.png)
这是一个说明我的问题的工作示例:
\documentclass[12pt]{article}
\usepackage{booktabs, ltablex, siunitx, threeparttablex}
\usepackage[labelsep=endash, skip=5pt]{caption}
\newcommand{\rowgroup}[1]{\hspace{-2em}#1} % for indentation tables
\sisetup{
group-separator={,},
group-four-digits=true,
table-space-text-pre = (,
table-space-text-post = ),
table-space-text-post= \textsuperscript{*},
retain-explicit-plus,
input-open-uncertainty = ,
input-close-uncertainty = ,
table-align-text-pre = false,
table-align-text-post = false,
round-mode=places,
round-precision = 2,
tight-spacing = true
}
\keepXColumns
\usepackage{setspace}
\begin{document}
\setstretch{0.85}
First table is Table \ref{tab:t1}:
\begin{ThreePartTable}
\small
\begin{TableNotes}[flushleft]\footnotesize
\item \textit{Notes:} Bla ...
\end{TableNotes}
\begin{tabularx}{0.9\textwidth}{ @{\hspace*{\leftmargin}}
l S[table-format=+1.2] S[table-format=-1.2] }
\caption {Alternative explanations; estimates for firm size regressions}\label{tab:t1} \\ \toprule
& {Low unemployment} & {High unemployment} \\
& {(1)} & {(2)} \\ \cmidrule(r){2-3}
\endfirsthead
\multicolumn{3}{c}%
{\vspace{5pt}{\tablename\ \thetable{} -- continued from previous page}} \\ \midrule
& {Low unemployment} & {High unemployment} \\
& {(1)} & {(2)} \\ \cmidrule(r){2-3}
\endhead
\multicolumn{3}{c}%
{\textit{Continue to next page}} \\ \midrule
\endfoot
\endlastfoot
\addlinespace
\rowgroup{\textit{Panel A: Buniness cycle conditions}}
& {\phantom{Low unemployment}} & {\phantom{High unemployment}} \\ \addlinespace
{Year 1}
& {...} & {...}\\
& ({...}) & ({...}) \\
{Year 2}
& {...} & {...} \\
& ({...}) & ({...}) \\
{Year 3}
& {...} & {...} \\
& ({...}) & ({...}) \\ \midrule
\end{tabularx}
\vspace{-20pt}
\begin{tabularx}{0.9\textwidth}{ @{\hspace*{\leftmargin}}
l S[table-format=-1.2] S[table-format=-1.2] }
& {Low unemployment} & {High unemployment} \\
& {(1)} & {(2)} \\ \cmidrule(r){2-3}
\addlinespace
\rowgroup{\textit{Panel B: ...\phantom{iness cycle conditions}}}
& {\phantom{Low unemployment}} & {\phantom{High unemployment}} \\ \addlinespace
{Year 1}
& {...} & {...}\\
& ({...}) & ({...}) \\
{Year 2}
& {...} & {...} \\
& ({...}) & ({...}) \\
{Year 3}
& {...} & {...} \\
& ({...}) & ({...}) \\
\bottomrule
\insertTableNotes
\endlastfoot
\end{tabularx}
\end{ThreePartTable}
Second table is Table \ref{tab:t2}:
\begin{table}[h!]
\caption{\label{tab:t2} The second table}
\centering
\begin{tabular}{ccc}
\toprule
column 1 & column 2 & column 3 \\ \midrule
... & ... & ... \\
... & ... & ... \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
问题是,在编译第一个表时,标签编号增加了一,因此第二个表看起来是表 3,而不是表 2。感谢您的任何建议。
编辑:
对于那些想知道为什么我实际上需要两个tabularx
嵌套在ThreePartTable
环境中的人,请参阅这个问题。总之,我tabularx
对表格的每个面板都使用一个,以便能够灵活地设置siunitx
每个面板中的列。
答案1
答案2
抱歉,目前没有权限添加评论,所以必须将此作为答案发布。问题是您使用 2 x tabularx(基本上是 2 个表)来生成第一个表。没有必要这样做。制作第一个表,以便生成一个具有 3 列和 5 行的单个表。您可以使用http://www.tablesgenerator.com/首先设置您的表格,然后如果您想使用 tabularx 而不是 tabular,请相应地进行更改。