Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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

3 Answers 3

up vote 4 down vote accepted

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}
share|improve this answer
    
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.

share|improve this answer

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}
  \addcontentsline{toc}{section}\appendixtitle
  \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}
  \addcontentsline{toc}{section}\appendixtitle
  \theappendix\appendixtitle
}
\newcommand\theappendix[1]{
  \section*{#1}
}

\makeatother

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

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

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

\begin{equation}
 y =x^2 
\end{equation}

or I could have called one single appendix:

\appendix*{My Lone Appendix}

The rest follows.

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.