我正在使用 changes 包来检查我的 latex 文件中的变化。对于句子的变化,它效果很好。但是,当我更改方程式时,它显示了一些错误/意外的结果。这是我的问题和我的代码。你能看看这个并给我一个解决方法吗?谢谢大家
这是我的代码
\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}
更新:这是使用取消包显示意外结果的示例
\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}
答案1
我正在使用 Marijn 的解决方案与 Cong Ma 的解决方案结合使用\sout
黑客这对于在数学模式内外强制执行水平删除线非常有效。
\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}
注意:cancel
这里不需要该包。
结果:
答案2
如果您愿意接受对角线,那么您可以使用cancel
包(在方程式内工作)作为用户定义的标记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}
结果: