Control Caption and Subcaptions in A Nested Table

captionssubcaptionsubfloatstables

I want my subcaption for these tables to be in the following conditions:

  1. The subcaption font size to be smaller than the mean caption font size.
  2. The subcaption to be placed at the bottom of the table while the main caption be placed at the top of them all.
  3. The subcaption prefix to be like this 1(a): and 1(b): while the main caption prefix to be like this 1:
  4. When I reference the subtable it should look like this l(a) or 1(b) while the reference for the mean table should look like this 1
  5. keep reasonable vertical gap in between `subtables.

See my MWE below

\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}

Best Answer

You have no real chance to typeset that table at normal size using 14pt, so I suggest a different way of formatting it.

\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}

enter image description here

Related Question