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.
Asked
Active
Viewed 2,046 times
3
3 Answers
4
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}
2
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.
Sigur
- 37,330
1
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}

Steven B. Segletes
- 237,551
\appendixcommand? – Sigur Mar 26 '13 at 23:31\appendix– Alex Mar 26 '13 at 23:34A1orA.1– Alex Mar 26 '13 at 23:34