I want to use \tag
in my LaTex file at https://www.sharelatex.com/.
For example, I want to do:
If $x \equiv x' \pmod{N}$ and $y \equiv y' \pmod{N}$, then: $xy \equiv x'y' \pmod{N}\tag{Substitution rule}$.
I look at a previous question on this website, \numcases with \tag, and found the answer insufficient for my problem.
I still get the ! Package amsmath Error: \tag not allowed here.
error even though I am only importing the following:
\usepackage{textcomp,geometry,graphicx,hyperref,empheq}
I have two questions:
(1) Why does the amsmath
package cause an error when \tag
is used?
(2) How do I add customized tags to my equations without causing errors?
Thank you for any help you can provide on this!
EDIT:
This is a made-up example as requested:
Now solve for $E[X]$:\newline
\hspace{30pt} $E[X] = 1 + E[X] - p \cdot E[X]$\newline
\hspace{30pt} $0 = 1 - p \cdot E[X]\tag{"xyz"}$\newline
\hspace{30pt} $p \cdot E[X] = 1\tag{"xyy"}$\newline
\hspace{30pt} $E[X] = \frac{1}{p}\tag{"xzy"}$\newline\newline
Note the \tag
parts were added in afterwards because they caused errors.
Then I want to say, based on "xyz" and "xyy", I can prove "abc".
\text
or write Substitution rule outside the math.\tag
names like "Substitution rule".