表格编号样式

表格编号样式

我的文档中的表格标记为 1...N;我喜欢这种格式。我还有一个属于论文附录的表格,我会将其标记为 A1 或 A.1 。有没有办法只更改该特定表格的编号样式?我使用 LyX 作为编辑器。

答案1

\numberwithin从包中使用amsmath。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}

编辑: 看过序言之外的关于numberin的注释(和)这里有另一个版本:

\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

从中article.cls我们发现命令的定义\appendix

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

因此计数器sectionsubsection被重置。此外,命令\thesection被定义为使用字母数字打印计数器section

我的建议是使用

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

重置计数器并定义使用字母数字打印计数器的table命令,然后用阿拉伯语打印计数器。\thetablesectiontable

答案3

或者自己动手,非常容易。这里会处理好图表、表格、方程式。您可以\appendix创建多个附录,也\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}

在此处输入图片描述

相关内容