\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}
It looks like the \sout doesn't work inside a math env. You can try doing something like this, which works:
\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}
If anyone's still interested, I just found out about the cancel package, which allows you to strike your text in math mode in a few different ways. It's not horizontal, though -- only diagonal, which in my case is much better.
\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}
Pretty much any non-math-mode command can be used inside mathmode by putting it within a \text{} environment, e.g.:
\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}
And if you'd like to be able to use strike-out without having ulem redefine how \emph{} works, use \usepackage[normalem]{ulem}.
发布评论
评论(4)
看起来
\sout
在数学环境中不起作用。你可以尝试做这样的事情,它有效:
It looks like the
\sout
doesn't work inside a math env.You can try doing something like this, which works:
如果有人仍然感兴趣,我刚刚发现了取消套餐 ,它允许您以几种不同的方式在数学模式下删除文本。不过,它不是水平的——只是对角线,就我而言,这要好得多。
If anyone's still interested, I just found out about the cancel package, which allows you to strike your text in math mode in a few different ways. It's not horizontal, though -- only diagonal, which in my case is much better.
如果您需要在数学模式下保留删除线(例如,保留数学字体),请尝试:
那么
您需要 amsmath 和 ulem。
(来自此处的解决方案。)
If you need to keep the strikeout in Math mode (e.g., to keep Math fonts) try:
then
you need amsmath and ulem.
(Solution from here.)
几乎任何非数学模式命令都可以在数学模式中使用,只需将其放入
\text{}
环境中即可,例如:如果您希望能够使用删除线 如果没有
ulem
重新定义\emph{}
的工作方式,请使用\usepackage[normalem]{ulem}
。Pretty much any non-math-mode command can be used inside mathmode by putting it within a
\text{}
environment, e.g.:And if you'd like to be able to use strike-out without having
ulem
redefine how\emph{}
works, use\usepackage[normalem]{ulem}
.