使用上述包时,表计数器似乎在标记后续表时忽略了子表。以下是 MWE:
\documentclass[a4paper,oneside,12pt]{book}
\usepackage{standalone}
\usepackage{amsmath, subfig}
\usepackage{booktabs, makecell, multirow}
\usepackage[colorlinks=true, allcolors=black]{hyperref}
\usepackage{cleveref}
\usepackage[font = footnotesize]{caption}
\begin{document}
\section{First}
\begin{table}[!h]
\label{4tbl:2}
\centering\begingroup\fontsize{8}{10}\selectfont
\subfloat[Stuff 2 \label{4tbl:1a}]{
\begin{tabular}[t]{>{}l>{}l>{}l>{}l>{}l>{}ll}
\toprule
\multicolumn{1}{c}{\bgroup\fontsize{10}{12}\selectfont \egroup{}} & \multicolumn{6}{c}{\bgroup\fontsize{10}{12}\selectfont Stuff table 1\egroup{}} \\
\cmidrule(l{3pt}r{3pt}){1-1} \cmidrule(l{3pt}r{3pt}){2-7}
& v & w & f & h & $\mu_0$ & $w_0$\\
\midrule
2 & 1 & 1 & 0.75 & 1 & 0 & 1\\
3 & 0.5 & 3 & 0.5 & 1 & 1 & 1\\
\bottomrule
\end{tabular}
}
\qquad
\subfloat[Stuff 1\label{4tbl:1b}] {
\begin{tabular}[t]{>{}l>{}l>{}l>{}l>{}l>{}ll}
\toprule
\multicolumn{1}{c}{\bgroup\fontsize{10}{12}\selectfont \egroup{}} & \multicolumn{6}{c}{\bgroup\fontsize{10}{12}\selectfont Stuff Table 2\egroup{}} \\
\cmidrule(l{3pt}r{3pt}){1-1} \cmidrule(l{3pt}r{3pt}){2-7}
& v & w & f & h & $\mu_0$ & $w_0$\\
\midrule
2 & 1 & 1 & 0.95 & 1 & 0 & 1\\
3 & 0.5 & 1 & 0.75 & 1.5 & 1 & 1\\
\bottomrule
\end{tabular}
}
\endgroup{}
\end{table}
This is ref to \Cref{4tbl:1a} and this to \Cref{4tbl:1b}.
\begin{table}[!h]
\centering\begingroup\fontsize{8}{10}\selectfont
\begin{tabular}[t]{>{}l>{}l>{}l>{}l>{}l>{}ll}
\toprule
\multicolumn{1}{c}{\bgroup\fontsize{10}{12}\selectfont \egroup{}} & \multicolumn{6}{c}{\bgroup\fontsize{10}{12}\selectfont
More Stuff \egroup{}} \\
\cmidrule(l{3pt}r{3pt}){2-7}
Exp & V & W & F & H & $\mu_0$ & $W_0$\\
\midrule
1 & 1 & 1 & 0.5 & 1 & 1 & 1\\
2 & 1 & 1 & 0.95 & 1 & 0 & 1\\
3 & 0.5 & 1 & 0.75 & 1.5 & 1 & 1\\
4 & 1 & 3 & 0.5 & 1.5 & 1 & 1\\
5 & 0.75 & 5 & 0.15 & 1 & 1 & 1\\
\bottomrule
\end{tabular}
\caption{Parameter values for several Kalman filters.}
\label{4tbl:3}
\endgroup{}
\end{table}
This is ref to \Cref{4tbl:3}.
\end{document}
第二张表应为Table 2
。
答案1
看看这是否能达到你想要的效果:
\documentclass[a4paper,oneside,12pt]{book}
\usepackage{booktabs, makecell, multirow}
\usepackage[font = footnotesize]{caption}
\usepackage{subcaption}
\usepackage{siunitx}
\usepackage[colorlinks=true,
allcolors=black]{hyperref}
\usepackage{cleveref} % had to be last in preamble
\begin{document}
\chapter{FIRST}
\section{First}
\begin{table}[!h]
\centering
\small
\subfloat[Stuff 2 \label{4tbl:1a}]{%
\begin{tabular}[t]{>{} c S[table-format=1.1] c
S[table-format=1.2] ccc @{}}
\toprule
& \multicolumn{6}{c}{Stuff table 1} \\
\cmidrule(l{3pt}r{3pt}){1-1}
\cmidrule(l{3pt}r{3pt}){2-7}
& {v} & w & {f} & h & $\mu_0$ & $w_0$\\
\midrule
2 & 1 & 1 & 0.75 & 1 & 0 & 1 \\
3 & 0.5 & 3 & 0.5 & 1 & 1 & 1 \\
\bottomrule
\end{tabular} }
\hfil
\subfloat[Stuff 1 \label{4tbl:1b}] {
\begin{tabular}[t]{>{} c S[table-format=1.1] c
S[table-format=1.2]
S[table-format=1.1] cc @{}}
\toprule
& \multicolumn{6}{c}{Stuff Table 2} \\
\cmidrule(l{3pt}r{3pt}){1-1}
\cmidrule(l{3pt}r{3pt}){2-7}
& {v} & w & {f} & {h} & $\mu_0$ & $w_0$ \\
\midrule
2 & 1 & 1 & 0.95 & 1 & 0 & 1 \\
3 & 0.5 & 1 & 0.75 & 1.5 & 1 & 1 \\
\bottomrule
\end{tabular} }
%\caption[]{} % <--- had to be used. Why you omit it?
\label{4tbl:2}
\end{table}
This is ref to \Cref{4tbl:1a} and this to \Cref{4tbl:1b}.
\begin{table}[!h]
\centering%\begingroup
\small
\begin{tabular}[t]{>{} c S[table-format=1.1] c
S[table-format=1.2]
S[table-format=1.1] cc @{}}
\toprule
& \multicolumn{6}{c}{More Stuff} \\
\cmidrule(l{3pt}r{3pt}){2-7}
Exp &{ V} & W & {F} & {H} & $\mu_0$ & $W_0$\\
\midrule
1 & 1 & 1 & 0.5 & 1 & 1 & 1\\
2 & 1 & 1 & 0.95 & 1 & 0 & 1\\
3 & 0.5 & 1 & 0.75 & 1.5 & 1 & 1\\
4 & 1 & 3 & 0.5 & 1.5 & 1 & 1\\
5 & 0.75 & 5 & 0.15 & 1 & 1 & 1\\
\bottomrule
\end{tabular}
\caption{Parameter values for several Kalman filters.}
\label{4tbl:3}
\end{table}
This is ref to \Cref{4tbl:3}.
\end{document}
与您的文档示例的主要区别是:
- 而不是
subfi
使用subcaption
包,它与\hyperref
包配合使用效果更好 - 第一个表的标签被移动到末尾
table
(在subfloat
s之后 - 对于具有小数的列,使用包
S
中定义的列类型siunitx
。 - 删除了表格的所有奇怪字体设置 - 但是,我想知道,为什么你不使用标题来表示第一个
table
I 应该插入在之前label
。就像现在的 MWE 一样,它偶然起作用,因为第一个表格紧随其后section
,并且参考考虑“section”计数器,而不是表格
这就是你所追求的吗?