Change Appendix table numbering

I am using article atm and trying to implement a short appendix at the end of the document. For testing, the appendix should just contain a single table.

I use the following code:

\section*{Appendix}
\renewcommand{\thetable}{\Alph{section}\arabic{table}}
\setcounter{table}{0}


So I am using a section to create the appendix. What I want to achieve is the table labelled as A.1, the next one as A.2, etc. What is the right way to do it? In my document, I have many sections, and as a result the labelling for the first table in the appendix is "Table G1". It should be: "A.1". My used solution is from here: Numbering tables A1, A2, etc in Latex Any hints highly appreciated!

• Have you tried adding \setcounter{section}{1} under the \setcounter{table}{0}? – Jon Jun 4 '19 at 15:38
• @Jon no, I tried \setcounter{section}{0} as for the tables, but that didnt work :) thanks! – ghx Jun 4 '19 at 15:48

Here is a MWE which gives table tiles as A.number. This uses the caption package to add a custom label format called AppendixTables in the example below. If you want to change the title for all your appendix Tables it can be done by changing the A.#2 in the label format. #1 (not shown) would be the text from the \caption{} command in the table if you wanted to include text that way.

\documentclass{article}
\usepackage{caption}
\DeclareCaptionLabelFormat{AppendixTables}{A.#2}

\begin{document}
\section*{Appendix}
\captionsetup{labelformat=AppendixTables}
\setcounter{table}{0}
\begin{table}[h]
\caption{}
\center
\begin{tabular}{|c|c|}
\hline
&\\
\hline
&\\
\hline
\end{tabular}
\end{table}

\begin{table}[h]
\caption{}
\center
\begin{tabular}{|c|c|}
\hline
&\\
\hline
&\\
\hline
\end{tabular}
\end{table}
\end{document}


This results in the image below.