I'm using this answer to control the appearance and order of float captions in a document. The relevant part is:
\renewcommand{\thetable}{S\arabic{table}}
\usepackage{tocloft}
\makeatletter
\newcommand{\listfloatname}{\normalsize Contents:}
\newlistof{float}{flt}{\listfloatname}
\long\def\@caption#1[#2]#3{%
\par
\refstepcounter{float}%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
\addcontentsline{flt}{#1}%
{\protect\numberline{\csname the#1\endcsname}{ #2}}%
\begingroup
\@parboxrestore
\if@minipage
\@setminipage
\fi
\normalsize
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
\endgroup}
\makeatother
This is used to label floats in order of appearance in a certain document. However, when I try and use \ref to reference a float, the additional S character does not appear. It works perfectly if I remove the above section, but I need to retain the functionality.
Here is a MWE:
\documentclass{article}
\usepackage{tocloft}
\renewcommand{\thetable}{S\arabic{table}}
%% TOC handling
\makeatletter
\newcommand{\listfloatname}{\normalsize Contents:}
\newlistof{float}{flt}{\listfloatname}
\long\def\@caption#1[#2]#3{%
\par
\refstepcounter{float}%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
\addcontentsline{flt}{#1}%
{\protect\numberline{\csname the#1\endcsname}{ #2}}%
\begingroup
\@parboxrestore
\if@minipage
\@setminipage
\fi
\normalsize
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
\endgroup}
\makeatother
\begin{document}
\begin{table}
\caption[Short title]{A table \label{table:a_label}}
\begin{tabular}{c|c}
1 & 2 \\
3 & 4
\end{tabular}
\end{table}
As in \ref{table:a_label}
\end{document}



\@captionis totally changed for all floats then? Why should\thetablebe called by your 'float' counter caption at all? This is weird! – Jan 04 '17 at 17:35