[Tex/LaTex] Caption above subtables with subcaption package breaks numbering of following table

numberingsubcaption

I use the subcaption package to display multiple tables side by side.
My document follows the convention of putting table captions above the table and I would like to keep this for the meta caption at least.

If I put the caption above the subtable entries, the following table is skipping one increment in the numbering like this:

Captions below:
Table 1
Table 2

Captions above:
Table 1
Table 3

This is an example of the situation that produces the wrong numbering:

\documentclass[11pt,a4paper,toc=listof,toc=bib,abstract=true,parskip=half]{scrreprt}

\usepackage{subcaption}

\begin{document}
\chapter{firstchapter}
\begin{table}[ht]
\caption{A table with caption on top}\label{tab:1}
\begin{subtable}{.5\linewidth}\centering
\caption{A subtable}\label{tab:1a}
{\begin{tabular}{ccc}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\end{subtable}%
\begin{subtable}{.5\linewidth}\centering
\caption{Another subtable}\label{tab:1b}
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}
\end{subtable}
\end{table}

\begin{table}
{\begin{tabular}{c c c}
\ $a$ & $b$ & $c$ \\
\hline 0 & 0 & 0 \\
\ 1 & 1 & 1 \\
\end{tabular}}

\caption{Any other table}\label{tab:2}
\end{table}

\end{document}

Am I using something wrong here or is this a bug in the subcaption package? Any Input would be appreciated, I would rather not "fix" the counter manually after the table or change packages.

Best Answer

If you want to alternate between top and bottom captions, you will have to set \captionabove instead of the upper \caption.

If you want to have them all on top, just set the option captions=tableheading to your documentclass and add the captions as you would normally do.

% arara: pdflatex

\documentclass[%
    ,parskip=half
    %,captions=tableheading
    ]{scrreprt}
\usepackage{subcaption}
\usepackage{booktabs}

\begin{document}
\chapter{firstchapter}
\begin{table}[ht]
    \captionabove{A table with caption on top}\label{tab:1}
    \begin{subtable}{.5\linewidth}\centering
        \subcaption{A subtable}\label{tab:1a}
        \begin{tabular}{ccc}
            $a$ & $b$ & $c$ \\\midrule
            0 & 0 & 0 \\
            1 & 1 & 1 \\    
        \end{tabular}
    \end{subtable}%
    \begin{subtable}{.5\linewidth}\centering
        \subcaption{Another subtable}\label{tab:1b}
        \begin{tabular}{c c c}
            $a$ & $b$ & $c$ \\\midrule
            0 & 0 & 0 \\
            1 & 1 & 1 \\
        \end{tabular}
    \end{subtable}%
\end{table}

\begin{table}
    \centering
    \begin{tabular}{ccc}
        $a$ & $b$ & $c$ \\\midrule
        0 & 0 & 0 \\
        1 & 1 & 1 \\
    \end{tabular}
    \caption{Any other table}\label{tab:2}
\end{table}
\end{document}