# caption-justification in subtable (subfig package)

I am using the \begin{table} \subtable[] \subtable[] \end{table} on two related tables, that are tiled horizontally(one above the other). The problem is that I wish the (sub) captions (a) and (b) to be wider than the figures (take the whole page width), and NOT like they are now (see image). I would like the subcaption to be as wide as the page. How do I set up the caption? Thanks! Michael

Here is the relevant extract:

%------------------------------------------------%

\documentclass[review,review,12pt]{elsarticle}

\usepackage{subfigure}
\usepackage[justification=centering]{caption}
\usepackage{subfig}% Support for small, sub' figures and tables

\begin{document}

\begin{table}
\centering

\subtable[Difference in registering added entries between agencies (across 5815 books cataloged by both agencies) - total occurrences of sub-fields]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 5844      & 4574       &  1272 & 775\\
Bokbasen & 5632 & 5623 & 0 & 693\\ \hline
\end{tabular}
}

\subtable[Difference in registering added entries between agencies (across 5815 books
cataloged by both agencies) - Records with at least one occurrence of sub-field]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency    & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 3354      & 3262       &  179     &    571\\
Bokbasen   & 3667      & 3664       &   0         & 417\\ \hline
\end{tabular}
}
\end{table}
\end{document}

%------------------------------------------------------------------%

• Please note that the subfigure package is deprecated. Use the environments from the subfig package (that you also already load) instead. – leandriis Sep 28 '19 at 18:16

Here are three different versions of your two subtables:

For the first version, I have used \captionsetup[subfloat]{width=\textwidth} in order to make the subtable's captions use the whole width instead of just the width of the corresponding subtable.

In the second example, I have moved repeated information from the subtable's captions to the main caption.

In the third table, I have merged both subtables into a single table to save some space. I have also used the booktabs package for the horizontal lines and removed all vertical lines:

\documentclass[review,review,12pt]{elsarticle}

\usepackage{subfig}
\captionsetup[subfloat]{width=\textwidth} % To use the full width of the page instead of the width of the corresponding subtable.

% only used for last example
\usepackage{booktabs}
\usepackage{makecell}
\begin{document}

\begin{table}
\centering

\subfloat[Difference in registering added entries between agencies (across 5815 books cataloged by both agencies) - total occurrences of sub-fields]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 5844      & 4574       &  1272 & 775\\
Bokbasen & 5632 & 5623 & 0 & 693\\ \hline
\end{tabular}
}

\subfloat[Difference in registering added entries between agencies (across 5815 books
cataloged by both agencies) - Records with at least one occurrence of sub-field]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency    & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 3354      & 3262       &  179     &    571\\
Bokbasen   & 3667      & 3664       &   0         & 417\\ \hline
\end{tabular}
}
\end{table}

\begin{table}
\centering
\caption{Use of added entries by agencies -- Difference in registering added entries between agencies (across 5815 books cataloged by both agencies) \label{addedEntriesAgencies}}

\subfloat[total occurrences of sub-fields]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 5844      & 4574       &  1272 & 775\\
Bokbasen & 5632 & 5623 & 0 & 693\\ \hline
\end{tabular}
}

\subfloat[Records with at least one occurrence of sub-field]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency    & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 3354      & 3262       &  179     &    571\\
Bokbasen   & 3667      & 3664       &   0         & 417\\ \hline
\end{tabular}
}
\end{table}

\begin{table}
\centering
\setlength{\tabcolsep}{4pt}
\caption{Use of added entries by agencies -- Difference in registering added entries between agencies (across 5815 books cataloged by both agencies) \label{addedEntriesAgencies}}
\begin{tabular}{l*{8}{r}}
\toprule
& \multicolumn{4}{l}{\small a) total occurrences of sub-fields} & \multicolumn{4}{p{5cm}}{\small b) Records with at least one occurrence of sub-field}\\
\cmidrule(r){2-5} \cmidrule(l){6-9}
Agency   & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$ & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$ \\ \midrule
BIBBI    & 5844      & 4574       &  1272 & 775 & 3354      & 3262       &  179     &    571\\
Bokbasen & 5632 & 5623 & 0 & 693 & 3667      & 3664       &   0         & 417\\ \bottomrule
\end{tabular}
\end{table}
\end{document}
\documentclass[review,review,12pt]{elsarticle}

\usepackage{subfig}
\captionsetup[subfloat]{width=\textwidth} % To use the full width of the page instead of the width of the corresponding subtable.

% only used for ast example
\usepackage{booktabs}
\usepackage{makecell}
\begin{document}

\begin{table}
\centering

\subfloat[Difference in registering added entries between agencies (across 5815 books cataloged by both agencies) - total occurrences of sub-fields]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 5844      & 4574       &  1272 & 775\\
Bokbasen & 5632 & 5623 & 0 & 693\\ \hline
\end{tabular}
}

\subfloat[Difference in registering added entries between agencies (across 5815 books
cataloged by both agencies) - Records with at least one occurrence of sub-field]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency    & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 3354      & 3262       &  179     &    571\\
Bokbasen   & 3667      & 3664       &   0         & 417\\ \hline
\end{tabular}
}
\end{table}

\begin{table}
\centering
\caption{Use of added entries by agencies -- Difference in registering added entries between agencies (across 5815 books cataloged by both agencies) \label{addedEntriesAgencies}}

\subfloat[total occurrences of sub-fields]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 5844      & 4574       &  1272 & 775\\
Bokbasen & 5632 & 5623 & 0 & 693\\ \hline
\end{tabular}
}

\subfloat[Records with at least one occurrence of sub-field]{
\begin{tabular}{|| c | c | c | c | c || }
\hline
Agency    & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$\\ \hline
BIBBI    & 3354      & 3262       &  179     &    571\\
Bokbasen   & 3667      & 3664       &   0         & 417\\ \hline
\end{tabular}
}
\end{table}

\begin{table}
\centering
\setlength{\tabcolsep}{4pt}
\caption{Use of added entries by agencies -- Difference in registering added entries between agencies (across 5815 books cataloged by both agencies) \label{addedEntriesAgencies}}
\begin{tabular}{l*{8}{r}}
\toprule
& \multicolumn{4}{l}{\small a) total occurrences of sub-fields} & \multicolumn{4}{p{5cm}}{\small b) Records with at least one occurrence of sub-field}\\
\cmidrule(r){2-5} \cmidrule(l){6-9}
Agency   & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$ & 700 $\$a$& 700$\$e$  & 700 $\$t$& 740$\$a$ \\ \midrule
BIBBI    & 5844      & 4574       &  1272 & 775 & 3354      & 3262       &  179     &    571\\
Bokbasen & 5632 & 5623 & 0 & 693 & 3667      & 3664       &   0         & 417\\ \bottomrule
\end{tabular}
\end{table}
\end{document}
`