如何在LaTeX方程中删除?

Aam*_*mir 36 latex typesetting strikethrough mathematical-typesetting

请参阅下面的代码段并告诉我如何实现与正文中相同的删除效果.我正在使用最新的Ubuntu存储库中的LaTeX版本.

\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.
$$
list = [1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}]
$$
Any clue?
\end{document}
Run Code Online (Sandbox Code Playgroud)

这是LaTeX输出

Mac*_*rse 23

看起来它\sout在数学环境中不起作用.你可以尝试做这样的事情,它有效:

\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.

$list = $[1, \sout{2}, 3, \sout{4}, 5, \sout{6}, 7, \sout{8}, 9, \sout{10}$]$

Any clue?
\end{document}
Run Code Online (Sandbox Code Playgroud)

  • 来自Sara的答案:"...使用删除而不使用ulem重新定义\ emph {}如何工作,使用`\ usepackage [normalem] {ulem}`".谢谢萨拉! (10认同)
  • 但是包'ulem`改变`\ emph {}`以强调. (3认同)

Ant*_*rre 23

如果有人仍然感兴趣,我只是发现了取消包,它允许你以几种不同的方式在数学模式下打击你的文本.但它不是水平的 - 只有对角线,在我的情况下要好得多.


小智 9

几乎任何非数学模式命令都可以在mathmode中使用,方法是将它放在\ text {}环境中,例如:

\documentclass{article}
\usepackage{ulem}
\begin{document}
The sout tag works perfect in the \sout{main text area} but not inside the equations.

\[ list = [1, \text{\sout{2}}, 3, \text{\sout{4}}, 5, \text{\sout{6}}, 7, \text{\sout{8}}, 9, \text{\sout{10}}] \]
Any clue?
\end{document}
Run Code Online (Sandbox Code Playgroud)

如果您希望能够使用删除而不使用ulem重新定义\ emph {}如何工作,请使用\text{}.


bad*_*oit 9

如果你需要在数学模式下保持删除线(例如,保持数学字体),请尝试:

\newcommand{\msout}[1]{\text{\sout{\ensuremath{#1}}}}
Run Code Online (Sandbox Code Playgroud)

然后

$\msout{\mathsf{stuckout}}$
Run Code Online (Sandbox Code Playgroud)

你需要amsmath和ulem.

(解决方案来自这里.)