I am doing my homework, and each of the problems is an "item", part of an itemized list. Each problem has some equations which I am numbering. I want the numbers to look like [item].[equation-number]. I am aware of the command numberwithin, but it doesn't work for items, throwing compiling errors. Code provided below:
\documentclass[11pt]{article}
\usepackage{amssymb,amsmath,amsthm}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
%\numberwithin{equation}{item}
\pagestyle{empty}
\begin{document}
\begin{enumerate}
\item
\setcounter{equation}{0}
We have the following amazing equation: \[ a = 6. \numberthis\label{p1}\]
We also have this beautiful equation: \[a1 = 17. \numberthis\label{p1-2}\]
\item
\setcounter{equation}{0}
More amazingness here: \[ b = 7.\numberthis\label{p2}\]
\end{enumerate}
\end{document}
(Uncomment the line numberwithin... and compile to see the error). I am using numberthis as a new command that I found the code for somewhere on tex stackexchange, and I'd prefer to not remove it, since it works very well for me across various math environments.
What I want to see is (1.1), (1.2) ... for Problem 1, (2.1), (2.2)... for Problem 2, etc.
Thank you!