8

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

  • cancelling as such is typographically problematic. Avoid using it but instead use colors. Or strikethrough – percusse Mar 4 '16 at 11:41
  • @percusse: How can i obtain the the result in equation as in text by using strikethrough – Jame Mar 4 '16 at 11:47
  • It is not straightforward, I always change the opacity of the deleted text for the articles etc. – percusse Mar 4 '16 at 11:57
3

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

|improve this answer|||||
2

If you are willing to settle for diagonal lines then you can use the cancel package (which works inside equations) as a user-defined markup for changes:

\documentclass{article}
\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}.
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}

Result:

enter image description here

|improve this answer|||||
  • Thanks, but cancel package is not good to delete the sentence, It takes so much space – Jame Mar 3 '16 at 13:42
  • @user8430 what do you mean exactly? It looks like the strikethrough with cancel takes the same space as the default strikethrough in changes when you look at the two screenshots in this question. – Marijn Mar 3 '16 at 22:18
  • @Marijin: Sorry for reply late. I update the example in my question. It shows unexpected result by using the diagonal line – Jame Mar 4 '16 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.