I have a figure with two subfigures, each with its own caption. When I refer to the figure the numbering is correct, but when I refer to a subfigure the figure number is one more than it should be. If I change the document class to article the error does not appear. How to fix the numbering when referencing under KOMA script?
MWE:
\documentclass{scrartcl}
\usepackage[hyphens]{url}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\caption{Two photos} \label{fig:photos}
\centering
\begin{subfigure}[t]{0.45\textwidth}
\caption{People on a square}
\label{fig:square}
\includegraphics[width=\textwidth]{images/square.jpg}
{\footnotesize By Lina Kivaka and available at
\url{https://www.pexels.com/photo/people-walking-near-white-building-3989821/}
\par}
\end{subfigure}
\quad
\begin{subfigure}[t]{0.45\textwidth}
\caption{Cabin over a lake}
\label{fig:cabin}
\includegraphics[width=\textwidth]{images/cabin.jpg}
{\footnotesize By Lucas Craig and available at
\url{https://www.pexels.com/photo/cabin-on-green-grass-field-near-lake-under-white-clouds-3689772/}
\par}
\end{subfigure}
\end{figure}
When I refer to panel~\subref{fig:square} of Figure~\ref{fig:photos} it is displayed as
Figure~\ref{fig:square}. Similarly panel~\subref{fig:cabin} is displayed as Figure~\ref{fig:cabin}.
\end{document}

\documentclass[captions=figureheading]{scrartcl}should work – leandriis May 13 '20 at 19:18