[Tex/LaTex] How to left align caption inside subtable

captionstables

I have the following code:

\documentclass[letterpaper,12pt]{article}

% things needed to include figures
\usepackage{subfigure, graphicx}
% float must be included for the [H] to actually work
\usepackage{float}
% formulas
\usepackage{amsmath}
% Added to adjust captions
\usepackage[singlelinecheck=false]{caption}
% added to adjust margins at the suggestion of Dr. Matt
\usepackage[top=1in, bottom=1in, left=1in, right=1in]{geometry}
\usepackage{fullpage}

\begin{document}
% 2 column side by side table
\begin{table}[H]
  \subtable[Half-life for $^{108}$Ag] {%

    % -----------------------------------------------------%
    \begin{tabular}{c@{\hskip 1cm} c}
      \hline\noalign{\smallskip}
      Accepted $T_{1/2}$ & Experimental $T_{1/2}$\\
      (s) & (s)\\
      \hline\noalign{\smallskip}
      142.92 & 158 $\pm$ 7\\
      \hline\noalign{\smallskip}
    \end{tabular}
    \label{lefttable}
    % -----------------------------------------------------%

  }
  \subtable[Half-life for $^{110}$Ag] {%

    % -----------------------------------------------------%
    \begin{tabular}{c@{\hskip 1cm} c}
      \hline\noalign{\smallskip}
      Accepted $T_{1/2}$ & Experimental $T_{1/2}$\\
      (s) & (s)\\
      \hline\noalign{\smallskip}
      24.6 & 21 $\pm$ 2\\
      \hline\noalign{\smallskip}
    \end{tabular}
    \label{righttable}
    % -----------------------------------------------------%

  }
  \caption{2 Column tables side by side}
  \label{sidebysidetable}
\end{table}
\end{document}

That produces this result:
enter image description here

I'd like the captions to be left aligned. How would I go about doing this?

Best Answer

To your question:

subcaption package supports the caption package and use its \captionsetup interface.

    \usepackage{caption}
      \captionsetup[table]{justification=raggedright}
      \captionsetup[subtable]{justification=raggedright}

where raggedright is left aligned.

In the problem subfigure-and-subfig-packages-deprecated, subcaption is recommended.

\usepackage{subcaption}

instead of subfigure.

And I change your subtable environment style:

\begin{table}[H]
  \begin{subtable}[b]{0.48\textwidth}
    % -----------------------------------------------------%
    \caption{Half-life for $^{108}$Ag} \label{lefttable}
    \begin{tabular}{c@{\hskip 1cm} c}
      \hline\noalign{\smallskip}
      Accepted $T_{1/2}$ & Experimental $T_{1/2}$\\
      (s) & (s)\\
      \hline\noalign{\smallskip}
      142.92 & 158 $\pm$ 7\\
      \hline\noalign{\smallskip}
    \end{tabular}
    % -----------------------------------------------------%  
  \end{subtable}
  \begin{subtable}[b]{0.48\textwidth}
    % -----------------------------------------------------%
    \caption{Half-life for $^{110}$Ag}     \label{righttable}
    \begin{tabular}{c@{\hskip 1cm} c}
      \hline\noalign{\smallskip}
      Accepted $T_{1/2}$ & Experimental $T_{1/2}$\\
      (s) & (s)\\
      \hline\noalign{\smallskip}
      24.6 & 21 $\pm$ 2\\
      \hline\noalign{\smallskip}
    \end{tabular}
    % -----------------------------------------------------%
  \end{subtable}
  \caption{2 Column tables side by side}
  \label{sidebysidetable}
\end{table}

And output is enter image description here

Noting that the overall width (lefttable + righttable) should be less than \textwidth. And the option in [b] is vertical position for that sub-table. In your case, same height tables would make b and t no difference.