[Tex/LaTex] Formula numbering in the Appendix

appendicesnumberingsectioning

In the source tex-file I use:

% ----------------------------

\appendix

\section{Appendix: Counting words without repetitions}

\begin{center} by Maarten M.S. Solleveld\footnote{Institute for Mathematics, Astrophysics and Particle Physics, Faculty of Science, Radboud University Nijmegen, P.O. Box 9010 (Heyendaalseweg 135), 6500 GL Nijmegen, The Netherlands}

\end{center}

\numberwithin{equation}{section}

\setcounter{equation}{0}


% ----------------------------

This works and I obtain in the appendix of the pdf-file as formula numbering A.1, A.2, A.3 … .

The problem, howver, is then that in the pdf-file a capital A is placed before the section name:

A Appendix: Counting words without repetitions

I do not want this. If I place in the source file a star after section such as:

\section*{Appendix: Counting words without repetitions}

then in the pdf-file the capital A disappears, but as formula numbering in the appendix I obtain .1, .2, .3 … .

Therefore with a star no A but as formula numbering in the appendix I obtain .1, .2, .3 … .
and with no star an additional A and as formula numbering in the appendix A.1, A.2, A.3 … .

What I want is:

No additional A and as formula numbering in the appendix A.1, A.2, A.3 … .

Best Answer

A bit of overhead is required, as shown in the code below, especially if you want to (a) retain the ability to create cross-references to section-level headers in the appendix and (b) have numbered subsection-level headers in the appendix. The overhead that's involved is the low-level LaTeX macro \@seccntformat, which -- as its name suggests -- serves to set how the counter that's associated with a sectioning command (\section,\subsection, ...,\subparagraph`) is displayed in the header itself.

A comment on your feature request: I don't think it's a good idea to show the letter A (or B, or whatever) in the equation numbers but then not to show the same letter in the header of the (appendix) section as well. At least some of the readers of your document may well be confused over where the letter A in equation numbers come from. However, if you really have to suppress the letter A in the section-level header, you may do so by changing the instruction

\newcommand{\section@cntformat}{Appendix \thesection:\ } 

in the code below to

\newcommand{\section@cntformat}{Appendix:\ } 

(This assumes that you do want to show the string "Appendix: " in the header.) Do note that not showing the letter A in the first sectioning header after \appendix can only make sense if there's exactly one numbered section in the appendix.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for '\numberwithin' macro

\usepackage[colorlinks]{hyperref} % just for this example
\usepackage[nameinlink,noabbrev]{cleveref}

%% Set up some preparatory code -- activated fully after '\appendix'
%% (see 'The LaTeX Companion,' 2nd. ed., pp. 26f. for more details)
\makeatletter
\def\@seccntformat#1{\@ifundefined{#1@cntformat}%
   {\csname the#1\endcsname\quad}%      default
   {\csname #1@cntformat\endcsname}%    enable individual control
}
\makeatother

\begin{document}
\section{Uno}
\dots

\appendix
\numberwithin{equation}{section}
\makeatletter 
% "activate" the preparatory code, but for section-level headers only
\newcommand{\section@cntformat}{Appendix \thesection:\ }
\makeatother

\section{Counting words without repetitions} \label{sec:counting}
\subsection{Some random equations}

\begin{equation}\label{eq:pyth} a^2+b^2=c^2 \end{equation}

As we saw in \cref{sec:counting,eq:pyth}, \dots

\end{document}