Change caption in table from Table 2 to Table 1A
I would do this using the subcaption
package- the key parts of the MWE below are
\usepackage{subcaption}
\DeclareCaptionSubType*[Alph]{table}
\DeclareCaptionLabelFormat{mystyle}{Table~\bothIfFirst{#1}{ }#2}
\captionsetup[subtable]{labelformat=mystyle}
The output is
Note that I've put your 'sub' tables into a subtable
environment, defined by the subcaption
package.
\documentclass{article}
\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}
\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}
\begin{subtable}{\textwidth}
\centering
\caption{Describe contents of Table 1.B}
\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}%
\end{table}
\end {document}
Unrelated to your question- a few folks would recommend the booktabs
package, and would also recommend removing your vertical lines. I also noticed that these tables give you overfull
hboxes
- this should really be fixed before sending this to print.
A sans-caption
solution that can be optimised (especially the needed \startsubcaptions
).
Code
\documentclass[12pt]{article}
\usepackage{etoolbox}
\newcounter{subtable}
\renewcommand*{\thesubtable}{\Alph{subtable}}
\newcounter{subfigure}
\renewcommand*{\thesubfigure}{\Alph{subfigure}}
\makeatletter
\newcommand*{\startsubcaptions}{%
\setcounter{sub\@captype}{0}
\csappto{the\@captype}{.\csname thesub\@captype\endcsname}%
}
\newcommand*{\subcaption}[2][]{%
\stepcounter{sub\@captype}%
\addtocounter{\@captype}{-1}%
\ifx\\#1\\\caption{#2}\else\caption[#1]{#2}\fi%
}
\newcommand*{\nonumbercaption}[1]{%
\refstepcounter{\@captype}%
{\centering #1\par}%
}
\makeatother
\begin{document}
\begin{table}[!hbp]
\nonumbercaption{This caption describes contents of Table 1, gives the big picture.}\label{table1}%
\startsubcaptions%
\subcaption{Describe contents of Table 1.A}\label{table1a}
\subcaption{Describe contents of Table 1.B}\label{table1b}
\end{table}
\ref{table1}, \ref{table1a}, \ref{table1b}
\begin{table}[!hbp]
\caption{This caption describes contents of Table 2, gives the big picture.}\label{table2}%
\startsubcaptions%
\subcaption{Describe contents of Table 2.A}\label{table2a}
\subcaption{Describe contents of Table 2.B}\label{table2b}
\end{table}
\ref{table2}, \ref{table2a}, \ref{table2b}
\end{document}