Next time please help us to help you by providing a MWE in text form not as screenshot so that we can copy the code and try our answer.
This looks like a xy problem to me.
Could it be that you are actually trying to reset the table counter every time another counter is incremented and use both counters to reference the table?
If so the newfloat package can help you.
In the following example the table counter is reset at the end of each section and both the section counter and table counter are printed by \caption.
Please note that I have redefined \thesection
instead of \thetable
to match the format requested while avoiding an inconsistency between using sometimes numbers and sometimes letters for the same counter.
\documentclass{article}
\usepackage{longtable}
\usepackage[within=section]{newfloat}
% see https://en.wikibooks.org/wiki/LaTeX/Counters#Counter_style
\renewcommand{\thesection}{\Alph{section}}
\begin{document}
\section{Abcdef}
\begin{longtable}{ll}
\caption{Abc}
\end{longtable}
\begin{longtable}{ll}
\caption{Def}
\end{longtable}
\section{Ghijkl}
\begin{longtable}{ll}
\caption{Ghi}
\end{longtable}
\begin{longtable}{ll}
\caption{Jkl}
\end{longtable}
\end{document}
As a side note I would recommend taking a look at the booktabs package documentation which gives a few recommendations on how to format tables.
To answer the question that you have asked:
The problem is that \renewcommand
inserts unexpandable tokens before \caption
.
If you really want to change the numbering of a single table only (which I would discourage without knowing the context) redefine \thetable
before the table and keep the definition local with an explicit \begingroup ...\endgroup
:
\documentclass{article}
\usepackage{longtable}
\begin{document}
\begingroup
\renewcommand{\thetable}{A.5}
\begin{longtable}{ll}
\caption{Abc}
\end{longtable}
\endgroup
\begin{longtable}{ll}
\caption{Def}
\end{longtable}
\end{document}