【问题标题】:How to strike out inside LaTeX equations? [closed]如何在 LaTeX 方程中剔除? [关闭]
【发布时间】:2011-02-09 11:22:02
【问题描述】:

请参阅下面的 sn-p 并告诉我如何实现与正文中相同的删除效果。我正在使用最新 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}

Here is LaTeX output

【问题讨论】:

  • 你不应该在 Latex 中使用$$。这是一个普通的 Tex 命令。
  • 进一步了解@Debilski 所说的内容:stackoverflow.com/questions/2251417/latex-dollar-sign-vs 对此进行了一些讨论。我不认为使用 $$ 是一种犯罪行为,我认为 $$ 支持不会消失,但您最好避免使用它。

标签: latex typesetting strikethrough mathematical-typesetting


【解决方案1】:

看起来\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}

【讨论】:

  • 这很优雅。谢谢!
  • 但是包 ulem\emph{} 更改为下划线。
  • 来自 Sara 的回答:“...要在不让 ulem 重新定义 \emph{} 的工作方式的情况下使用删除线,请使用 \usepackage[normalem]{ulem}”。谢谢萨拉!
【解决方案2】:

如果有人仍然感兴趣,我刚刚发现了 cancel package,它允许您以几种不同的方式在数学模式下敲击您的文本。不过,它不是水平的——只有对角线,在我的情况下要好得多。

【讨论】:

  • 感谢您提及这一点。 \cancelto 命令正是我所需要的。
【解决方案3】:

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

\newcommand{\msout}[1]{\text{\sout{\ensuremath{#1}}}}

然后

$\msout{\mathsf{stuckout}}$

你需要 amsmath 和 ulem。

(来自here的解决方案。)

【讨论】:

    【解决方案4】:

    几乎所有非数学模式命令都可以在数学模式中使用,只需将其置于\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}
    

    如果您希望能够在没有ulem 的情况下使用删除线重新定义\emph{} 的工作方式,请使用\usepackage[normalem]{ulem}

    【讨论】:

      猜你喜欢
      • 2018-01-23
      • 2011-02-23
      • 2010-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-13
      • 2011-04-08
      相关资源
      最近更新 更多