[Tex/LaTex] Wrong to delete/replace equation by using changes package

amsmathchangesmath-modemathtools

I am using changes package to check the changing in my latex file. For changing in sentence, it works well. However, it showed some wrong/unexpected result when I change equation. This is my problem and my code. Could you look at this and give me a way to solve it? Thank all

enter image description here

This is my code

\documentclass{article}
\usepackage{changes}
\usepackage{amsmath,mathtools}
\usepackage{changes}

\begin{document}
I want to delete $y=1$ look likes \deleted{$y=1$ }.
But it was failure in dcase
And replace $z=x+1$ to $z=y+1$ as \replaced{z=y+1}{z=x+1}.
However, the case equation has error as:

\begin{equation}\hspace{0pt}\label{eq:1}
\begin{dcases}
x=1\\
\deleted{y=1}
\\
\replaced{z=y+1}{z=x+1}.
\end{dcases}
\hfill\end{equation}
\end{document}

Update: this is example to show unexpected result by using cancel package

\documentclass[preprint,12pt, sort&compress]{elsarticle}
\usepackage{changes}
\usepackage{amsmath,mathtools}
\usepackage{cancel}
\setdeletedmarkup{\cancel{#1}}

\begin{document}
I want to delete $y=1$ look likes \deleted{$y=1$ }.
But it was failure in dcase. And replace $z=x+1$ to $z=y+1$ as \replaced{z=y+1}{z=x+1}.\deleted{This is long sentence which I want to delete}, However, it showed wrong location to delete by using cancel package
However, the case equation has error as:

\begin{equation}\hspace{0pt}\label{eq:1}
\begin{dcases}
x=1\\
\deleted{y=1}
\\
\replaced{z=y+1}{z=x+1}.
\end{dcases}
\hfill\end{equation}
\end{document}

enter image description here

Best Answer

I am using Marijn's solution in combination with Cong Ma's \sout hack which works pretty well in order to enforce horizontal strikeouts within and outside math mode.

\documentclass{article}
\usepackage{changes}
\usepackage{amsmath}
\newcommand{\stkout}[1]{\ifmmode\text{\sout{\ensuremath{#1}}}\else\sout{#1}\fi}
\setdeletedmarkup{\stkout{#1}}

\begin{document}
I want to delete $y=1$ look likes \deleted{$y=1$ }.
But it was failure in dcase
And replace $z=x+1$ to $z=y+1$ as \replaced{z=y+1}{z=x+1}.
However, the case equation has error as:

\begin{equation}\hspace{0pt}\label{eq:1}
\begin{dcases}
x=1\\
\deleted{y=1}
\\
\replaced{z=y+1}{z=x+1}.
\end{dcases}
\hfill\end{equation}
\end{document}

Note: The cancel package is not needed here.

Result:

enter image description here