web-dev-qa-db-ja.com

LaTeX方程式の内部を打ち消す方法は?

以下のスニペットを参照して、本文と同じ取り消し線効果を達成する方法を教えてください。最新の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}

これはLaTeXの出力です

35
Aamir

\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}
22
Macarse

まだ興味がある人は、 cancel package について知りました。これにより、いくつかの異なる方法でテキストを数学モードで打つことができます。ただし、水平ではありません。対角線のみで、私の場合ははるかに優れています。

23
Anthony Labarre

ほとんどすべての非数学モードコマンドは、\ 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}

また、取り消し線を使用できるようにするには、withoutを使用して、\ emph {}の動作をulemで再定義し、\usepackage[normalem]{ulem}

9
Sara

Mathモードで取り消し線を保持する必要がある場合(たとえば、Mathフォントを保持するため):

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

それから

$\msout{\mathsf{stuckout}}$

amsmathとulemが必要です。

ここ からの解決策。)

9
badroit