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)
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)
小智 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{}.
如果你需要在数学模式下保持删除线(例如,保持数学字体),请尝试:
\newcommand{\msout}[1]{\text{\sout{\ensuremath{#1}}}}
Run Code Online (Sandbox Code Playgroud)
然后
$\msout{\mathsf{stuckout}}$
Run Code Online (Sandbox Code Playgroud)
你需要amsmath和ulem.
(解决方案来自这里.)