I do my homework in LaTeX, and I encountered a new problem. I usually don't number my equations. In this assignment, I would like to number at least one equation of mine that I will reference later. Unfortunately, I always copy the assignment problem statement at the top, and in this assignment, there were numbered equations. Rather than manually numbering equations (mine or the assignment's), I would like to define a new counter and \label - \ref setup to make two types of equation references and counters. Here's what I came up with, which gave me errors:
\newcounter{MyEqNum}
\newcommand{\MyNum}{\refstepcounter{MyEqNum}\rm{\Roman{MyEqNum}}}
%\newcommand{\RefMyEqn}{(\Roman{MyEqNum})}
%\renewcommand{\theequation}{\Roman{MyEqNum}}
\renewcommand{\theequation}{\refstepcounter{MyEqNum}\rm{\Roman{MyEqNum}}}
\begin{equation}
\frac{\partial^4 U}{\partial x^4} = U^{(4)}(x) = \frac{\rho \omega_n^2}{Y I} U(x)
\label{eq:My1}
\end{equation}
\begin{equation}
test
\label{eq:My2}
\end{equation}
The above result, \eqref{eq:My1} will be used later. Now using modal expansion, and writing the fourth spatial derivative as $\frac{\partial^4 U(x)}{\partial x^4} = U_n^{(4)}(x)$:
The errors I get are "No counter", "Extra \endcsname", "Missing \endcsname inserted", and a few undefined control sequences.
Note. that the original assignment used Arabic numbering, which is why I tried to make the second label counter numbering use Roman. I am sorta resigned to write \renewcommand{\theequation}{}
every time I switch back and forth between numbering schemes, but if there is a better way, I would love to know. I would prefer not to define a new equation environment, but I figured that might be the right way to do this (I have no experience with defining new environments and am a bit afraid of that prospect).
-------------------------------------------------------------------------------
Edit: After implementing @Donald Arseneau's method, I made a slight change to get Roman numerals to work. It took me some trial and error, so I'm posting it here.
\makeatletter
\newcounter{MyEqNum}
\newenvironment{mynumbering}{%
% replace equation numbering with my own counter and style
%\let\theequation\theMyEqNum
\renewcommand{\theequation}{\Roman{MyEqNum}}
\let\c@equation\c@MyEqNum
\let\p@equation\p@MyEqNum
}{}
\refstepconter
into\theequation
.\let\theequation\theMyEqNum
presumes you have defined\theMyEqNum
to be what you want (\Roman{MyEqNum}
).