2

Typically, \numberwithin{equation}{section} numbers equations according to the section in which they appear: e.g.,

normal numbering

Using the Springer Nature author template (available via Overleaf and on Springer Nature's site), \numberwithin{equation}{section} works normally for sections that don't appear as appendices. However, within an appendix section, the period separating the appendix letter from the equation number is now omitted: Spring appendix numbering

I don't understand what is causing this behavior. How can the standard A.1 formatting be restored?

For reference, my MWE with the Springer template is:

\documentclass[sn-mathphys,pdflatex]{sn-jnl}% Math and Physical Sciences Reference 
\numberwithin{equation}{section}

\begin{document}

\title{Title}

\section{Section}
\begin{equation}
1+1=2
\end{equation}

\backmatter

\begin{appendices}
\section{}
\begin{equation}
2+2=4
\end{equation}
\end{appendices}

\end{document}

2 Answers 2

1

The class has the following code for appendices. First of all it loads the appendix package (twice) and, quite curiously, it executes code conditionally on the loading of the package (!). Such code redefines appendices taken from appendix and then redefines it again as follows (reformatted for clarity, but not modified in functionality):

\AtBeginDocument{%
  \let\oldappendices\appendices
  \let\oldendappendices\endappendices
  \renewenvironment{appendices}{%
    \setcounter{figure}{0}%
    \setcounter{table}{0}%
    \setcounter{equation}{0}%
    \begin{oldappendices}%
    \gdef\thefigure{\@Alph\c@section\arabic{figure}}%
    \gdef\thetable{\@Alph\c@section\arabic{table}}%
    \gdef\theequation{\@Alph\c@section\arabic{equation}}%
  }{\end{oldappendices}}
}

Thus they did think to the problem and decided that no period is wanted between the appendix letter and the equation number: the line

    \gdef\theequation{\@Alph\c@section\arabic{equation}}%

is quite clear about it. In better programming it would be

\renewcommand\theequation{\Alph{section}\arabic{equation}}

The conclusion is that you should follow the desire of the class maintainers, which in turn should reflect the publisher's style.

If you are prone to accept rejection for not following the house style, you can do

\documentclass[sn-mathphys,pdflatex]{sn-jnl}% Math and Physical Sciences Reference 
\usepackage{xpatch}

\numberwithin{equation}{section}

\AtBeginDocument{%
  \xpatchcmd{\appendices}{\arabic{equation}}{.\arabic{equation}}{}{}%
}

\begin{document}

\title{Title}

\section{Section}
\begin{equation}
1+1=2
\end{equation}

\backmatter

\begin{appendices}
\section{}
\begin{equation}
2+2=4
\end{equation}
\end{appendices}

\end{document}

enter image description here

In case you get a report that mentions not following the house style, just remove the loading of xpatch and the patch.

1
  • I really appreciate you pointing out this formatting was intentional. I had completely overlooked this fact!
    – user143410
    Commented Nov 7, 2022 at 18:36
1

I suggest you insert the following instruction after \begin{appendices}:

\numberwithin{equation}{section}

Incidentally, running \counterwithin{equation}{section} would be ok as well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .