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

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}
```

## 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.Note: The

`cancel`

package is not needed here.Result: