# What the following codes do?

I am using a latex template and the following codes appear the file. I was wondering what their functionality is:

\makeatletter
\let\c@equation\c@thm
\makeatother
\numberwithin{equation}{section}


It seems to me the above somehow numbers the equation withing section and within theorems. The last line resets the counter at every section. The first and third line is supposed to change the character so that @' could be used in the second line.

\newcommand {\sub}{\mbox{SB}}


This code is totally mysterious to me.

\let\c@equation\c@thm makes the counter for equations identical to the one for theorems (assuming that the thm counter is indeed used for theorems). In more detail, counters are referenced by a counter number inside the guts of TeX, and \c@equation expands to the number of the equation counter.
\newcommand {\sub}{\mbox{SB}} creates a command \sub which typesets the two letters “SB” as a single unit. Why the author of the template wanted this, is a different question, which I can't answer. Perhaps you can get some idea by seeing how the command is used elsewhere.
• this answer is correct, but there's an easier way to do this when using amsthm or amsart. that is, declare \numberwithin{equatnion}{section} \newtheorem{thm}[equation]{Theorem}`. so, to some extent, if numbering the theorems in sequence with equations is wanted, it depends on what documentc class and/or packages are being used. – barbara beeton Aug 6 '17 at 18:35