子表中的标题对齐方式(subfig 包)

子表中的标题对齐方式(subfig 包)

我在两个相关表格上使用 \begin{table} \subtable[] \subtable[] \end{table},这两个表格水平平铺(一个在另一个上面)。问题是我希望(子)标题 (a) 和 (b) 比图更宽(占据整个页面宽度),而不是像现在这样(见图)。我希望子标题与页面一样宽。我该如何设置标题?谢谢!Michael

在此处输入图片描述

以下是相关摘录:

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

\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
\caption{Use of added entries by agencies \label{addedEntriesAgencies}}

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

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

答案1

以下是两个子表的三个不同版本:

对于第一个版本,我已经使用它\captionsetup[subfloat]{width=\textwidth}来使子表的标题使用整个宽度而不是仅仅使用相应子表的宽度。

在第二个示例中,我将重复信息从子表的标题移至主标题。

在此处输入图片描述

在第三张表中,我将两个子表合并为一张表以节省一些空间。我还使用了booktabs水平线包并删除了所有垂直线:

\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}
\renewcommand{\theadfont}{\normalsize}
\begin{document}

\begin{table}
\centering

\caption{Use of added entries by agencies \label{addedEntriesAgencies}}

\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}
\renewcommand{\theadfont}{\normalsize}
\begin{document}

\begin{table}
\centering

\caption{Use of added entries by agencies \label{addedEntriesAgencies}}

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

相关内容