# table numbering style

The tables in my document are labeled 1...N; I like this format. I also have a table which belongs to the appendix of my paper that I would labeled A1 or A.1 . Is there a way to change the numbering style for just that one specific table? I use LyX for my editor.

-
Are you using the \appendix command? – Sigur Mar 26 '13 at 23:31
Please tell us more about the numbering style you'd like to see implemented for one specific table. – Mico Mar 26 '13 at 23:32
@Sigur: yes, i use \appendix – Alex Mar 26 '13 at 23:34
@Mico: I would the table in the appendix labeled A1 or A.1 – Alex Mar 26 '13 at 23:34
@Alex, in fact, that command only change the section counters. Which class are you using? – Sigur Mar 26 '13 at 23:40

Use \numberwithin from the amsmath package. MWE:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\section{Normal}
\begin{table}
\caption{Normal Table}
\end{table}

\appendix
\numberwithin{table}{section}

\section{First Appendix}
\begin{table}
\caption{Table in Appendix}
\end{table}

\end{document}


EDIT: Having seen This note on numberwithin outside the preamble (and this) here's an alternative version:

\documentclass{article}
\usepackage{chngcntr}

\begin{document}

\section{Normal}
\begin{table}
\caption{Normal Table}
\end{table}

\appendix
\counterwithin{table}{section}

\section{First Appendix}
\begin{table}
\caption{Table in Appendix}
\end{table}

\end{document}

-
Easier. Nice! +1 – Sigur Mar 27 '13 at 0:36

From article.cls we found the definition of \appendix command:

\newcommand\appendix{\par
\setcounter{section}{0}%
\setcounter{subsection}{0}%
\gdef\thesection{\@Alph\c@section}}


So the counters section and subsection are reseted. Also the command \thesection is defined to print the counter section using alphanumeric.

My suggestion is to use

\appendix
\makeatletter
\setcounter{table}{0}
\gdef\thetable{\@Alph\c@section.\@arabic\c@table}
\makeatother


to reset the table counter and define the command \thetable to print the section counter using alphanumeric followed by the table counter in arabic.

-

Or do it yourself very easily. Figures, tables, equations are all taken care of here. And you have \appendix for multiple appendices, or \appendix* for a single appendix.

\documentclass[12pt]{article}
\usepackage{boxhandler}

\makeatletter

\renewcommand\appendix{\@ifstar{\loneappendix}{\anappendix}}

\newcounter{appndx}
\setcounter{appndx}{0}

\newcommand \loneappendix [1]{
\clearpage
\refstepcounter{appndx}
\setcounter{section}{\arabic{appndx}}
\renewcommand\thesection {\appendixname~\Alph{appndx}.}
\setcounter{subsection}{0}
\renewcommand\thesubsection {\Alph{appndx}.\@arabic\c@subsection}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{figure}{0}
\renewcommand\thefigure{\Alph{appndx}\@arabic\c@figure}
\setcounter{table}{0}
\renewcommand\thetable{\Alph{appndx}\arabic{table}}
\setcounter{equation}{0}
\renewcommand\theequation {\Alph{appndx}-\arabic{equation}}
\def\appendixtitle{\appendixname. #1}
\theappendix\appendixtitle
}

\newcommand \anappendix[1]{
\clearpage
\refstepcounter{appndx}
\setcounter{section}{\arabic{appndx}}
\renewcommand\thesection {\appendixname~\Alph{appndx}.}
\setcounter{subsection}{0}
\renewcommand\thesubsection {\Alph{appndx}.\@arabic\c@subsection}
\setcounter{paragraph}{0}
\setcounter{subparagraph}{0}
\setcounter{equation}{0}
\setcounter{figure}{0}
\renewcommand\thefigure{\Alph{appndx}\@arabic\c@figure}
\setcounter{table}{0}
\renewcommand\thetable{\Alph{appndx}\arabic{table}}
\renewcommand\theequation {\Alph{appndx}-\arabic{equation}}
\def\appendixtitle{\appendixname~\Alph{appndx}. #1}
\theappendix\appendixtitle
}
\newcommand\theappendix[1]{
\section*{#1}
}

\makeatother

\begin{document}
\section{First section}
\bxtable[ht]{Caption}{\rule{2in}{1in}}
\section{Second Section}
Text
$$y =x^2$$

\appendix{First of Many Appendices}
Let's see if tables are renumbered

\bxtable[ht]{Caption}{\rule{2in}{1in}}
\bxfigure[ht]{Caption}{\rule{2in}{1in}}

$$y =x^2$$

or I could have called one single appendix:

\appendix*{My Lone Appendix}

The rest follows.

\end{document}


-