I ask a variation of some questions previously posed.
What I have now is this:
I want the equation numbers to follow the same numbering scheme as the theorems and definition. That is, I want the equation to be labelled (1.3) and the definition after it be labelled (1.4).
To further clarify, if we were in subsection 1.1, instead of section 1, I want to have theorem 1.1.1, theorem 1.1.2, equation 1.1.3 and definition 1.1.4.
Right now, the screenshot I posted uses the solution presented here.
I've also looked at this post. I tried to do that, but it completely ignored the "sectioning" I've done with the theorem numbers. Everything became 1, 2, 3... instead of 1.1, 1.2, 1.3, ...
Moreover, it makes the theorem numbers depend on the equation numbers, which is the opposite of what I want. I want the equation numbering to follow the theorem numbering. This is because I've already "fixed" the theorem numbering to how I want it. However, I'm open to more out-of-the-box suggestions.
The following is the code for the screenshot.
\documentclass[a4paper]{article}
\usepackage{amsmath, amsthm}
\setcounter{section}{0}
\newtheorem{thm}{Theorem}[section]
\numberwithin{equation}{section}
\newtheorem{ex}[thm]{Example}
\newtheorem{defn}[thm]{Definition}
\begin{document}
\section{Section Title}
\begin{thm}
Spaghettoni.
\end{thm}
\begin{thm}
Vermicelloni.
\end{thm}
\begin{proof}
Manicotti.
\begin{equation}
x^2 + y^2 = z^2
\end{equation}
\end{proof}
\begin{defn}
Maltagliati.
\end{defn}
\end{document}

\numberwithinassumes that, if you want, say, equations to be numbered within subsections, you are not going to use them directly within sections; in other words, it assumes that all equations occur at the same sectioning level. It’s not impossible to arrange things for a different behavior, but you should specify unambiguously what this different behavior should look like. Perhaps you should ask a self-contained question concerning this specific issue. – GuM Aug 10 '16 at 19:53