1

When my Appendix starts, the equations and theorems in it should start from (1) and not from the number which ended in the main paper. That is, if the last equation in main paper was numbered (7), then I expect the first equation in Appendix to be numbered (1) and not (8). Similarly, for the numbering of theorems too.

In short, I wish my theorems in Appendix to start from "Theorem 1." and the first equation in Appendix to be numbered with (1).

I am using overleaf.

I request for help.

Thanks

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Sep 14, 2021 at 4:50

1 Answer 1

2

With an up-to-date LaTeX (released 2020-10-01 or later) you can do it in the document preamble:

\documentclass{article}
\usepackage{amsmath}

\newtheorem{theorem}{Theorem}

\AddToHook{cmd/appendix/before}{%
  \setcounter{equation}{0}%
  \renewcommand{\theequation}{\thesection.\arabic{equation}}%
  \setcounter{theorem}{0}%
  \renewcommand{\thetheorem}{\thesection.\arabic{theorem}}%
}

\begin{document}

\section{Text section}

Some text.

\begin{theorem}
Pigs can fly.
\end{theorem}

An equation
\begin{equation}
1+1=2
\end{equation}

\appendix

\section{Appendix section}

Some text.

\begin{theorem}
Pigs cannot fly.
\end{theorem}

An equation
\begin{equation}
1+1=2
\end{equation}

\end{document}

enter image description here

With an older LaTeX, you can do it by moving the code after \appendix

\documentclass{article}
\usepackage{amsmath}

\newtheorem{theorem}{Theorem}

\begin{document}

\section{Text section}

Some text.

\begin{theorem}
Pigs can fly.
\end{theorem}

An equation
\begin{equation}
1+1=2
\end{equation}

\appendix
\setcounter{equation}{0}
\renewcommand{\theequation}{\thesection.\arabic{equation}}
\setcounter{theorem}{0}
\renewcommand{\thetheorem}{\thesection.\arabic{theorem}}


\section{Appendix section}

Some text.

\begin{theorem}
Pigs cannot fly.
\end{theorem}

An equation
\begin{equation}
1+1=2
\end{equation}

\end{document}

You must log in to answer this question.

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