控制嵌套表中的标题和子标题

控制嵌套表中的标题和子标题

我希望subcaption这些表满足以下条件:

  1. 字体subcaption大小小于平均caption字体大小。
  2. subcaption放置在表格的底部,而将主caption放置在所有表格的顶部。
  3. 前缀subcaption是这样的1(a):1(b):而主标题前缀是这样的1:
  4. 当我引用子表时,它应该看起来像这样l(a),或者1(b)平均表的引用应该看起来像这样1
  5. 在子表之间保持合理的垂直间隙。

请参阅下面我的 MWE

\documentclass[a4paper,14pt]{extarticle}
%% the below are for subtable
\usepackage{subcaption}
%\DeclareCaptionSubType*[alph]{table}
%\DeclareCaptionLabelFormat{mystyle}{Table~\bothIfFirst{#1}{ }#2}
%\captionsetup[subtable]{labelformat=mystyle}
\begin{document}
\begin{table}[hbp!]
    \centering
    \caption{This caption describes contents of Table 1, gives the big picture.}
    \label{TestTable}
    \begin{subtable}{\textwidth}
        \centering
        \caption{Describe contents of Table 1.A}
        \label{TestTableA}
        \begin{tabular}{|c|c|c|c|c|c|}
        \hline
        Recom Strength & Highest Idos Risk & 2nd Highest & Middle & 2nd Lowest & Lowest \\
        \hline
        1              & -0.41             & -0.07       & 1.27   & -0.78      & 0.73   \\
        \hline
        2              & -0.85             & -1.88       & 0.01   & 0.75       & 2.32   \\
        \hline
        3              & -0.48             & -1.0        & -0.56  & 0.47       & 1.01   \\
        \hline
        4              & 0.04              & 0.76        & 1.34   & 1.78       & -1.27  \\
        \hline
        5              & -1.35             & -1.52       & 0.04   & 1.23       & 0.51   \\
        \hline
        \end{tabular}
    \end{subtable} \quad%
    \hspace{0.4em}
    \begin{subtable}{\textwidth}
        \centering
        \caption{Describe contents of Table 1.B}
        \label{TestTableB}
        \begin{tabular}{|c|c|c|c|c|c|} 
        \hline
        Recom Strength & Highest Idos Risk & 2nd Highest & Middle & 2nd Lowest & Lowest \\
        \hline
        1              & -0.41             & -0.07       & 1.27   & -0.78      & 0.73   \\
        \hline
        2              & -0.85             & -1.88       & 0.01   & 0.75       & 2.32   \\
        \hline
        3              & -0.48             & -1.0        & -0.56  & 0.47       & 1.01   \\
        \hline
        4              & 0.04              & 0.76        & 1.34   & 1.78       & -1.27  \\
        \hline
        5              & -1.35             & -1.52       & 0.04   & 1.23       & 0.51   \\
        \hline
        \end{tabular}
    \end{subtable} \quad%%
\end{table}

答案1

您没有真正的机会使用 14pt 以正常大小排版该表格,因此我建议采用不同的格式化方式。

\documentclass[a4paper,14pt]{extarticle}

\usepackage{subcaption}
\usepackage{booktabs,siunitx}

\DeclareCaptionLabelFormat{mystyle}{\tablename~\thetable\thesubtable}
\captionsetup[subtable]{
  labelformat=mystyle,
  position=bottom,
}
\renewcommand{\thesubtable}{(\alph{subtable})}

\begin{document}

\begin{table}[hbp!]
\centering

\caption{This caption describes contents of Table 1, gives the big picture.}
\label{TestTable}

\begin{subtable}{\textwidth}
  \centering
  \begin{tabular}{
    c
    *{5}{S[table-format=-1.2]}
  }
  \toprule
  \smash{\begin{tabular}[t]{@{}c@{}}Recom \\ Strength\end{tabular}} &
  \multicolumn{5}{c}{Idos Risk}
  \\
  \cmidrule{2-6}
  & {Highest} & {2nd Highest} & {Middle} & {2nd Lowest} & {Lowest} \\
  \midrule
  1 & -0.41 & -0.07 &  1.27 & -0.78 &  0.73 \\
  2 & -0.85 & -1.88 &  0.01 &  0.75 &  2.32 \\
  3 & -0.48 & -1.0  & -0.56 &  0.47 &  1.01 \\
  4 &  0.04 &  0.76 &  1.34 &  1.78 & -1.27 \\
  5 & -1.35 & -1.52 &  0.04 &  1.23 &  0.51 \\
  \bottomrule
  \end{tabular}
  \caption{Describe contents of Table 1.A}\label{TestTableA}
\end{subtable}

\bigskip

\begin{subtable}{\textwidth}
  \centering
  \footnotesize
  \begin{tabular}{|c|c|c|c|c|c|}
  \hline
  Recom Strength & Highest Idos Risk & 2nd Highest & Middle & 2nd Lowest & Lowest \\
  \hline
  1              & -0.41             & -0.07       & 1.27   & -0.78      & 0.73   \\
  \hline
  2              & -0.85             & -1.88       & 0.01   & 0.75       & 2.32   \\
  \hline
  3              & -0.48             & -1.0        & -0.56  & 0.47       & 1.01   \\
  \hline
  4              & 0.04              & 0.76        & 1.34   & 1.78       & -1.27  \\
  \hline
  5              & -1.35             & -1.52       & 0.04   & 1.23       & 0.51   \\
  \hline
  \end{tabular}
  \caption{Describe contents of Table 1.B}\label{TestTableB}
\end{subtable}
\end{table}

See my \ref{TestTable}, \ref{TestTableA} and \ref{TestTableB}

\end{document}

在此处输入图片描述

相关内容