0

Is there a way to do strikethrough math formula in the math mode?

I had known this:

\usepackage[normalem]{ulem}
\sout{ ...}

and

\usepackage{soul}
\st{...}

are useful but they can not be used in the math mode. So one needs to turn it to the \text mode then do it. Is there any better way out?

I also know this:

\usepackage[makeroom]{cancel}
\cancel{}
\cancelto{}

but they do not look like the strikethrough lines.

Thanks! See also this.

1 Answer 1

1

This will get you started. Note, this does not strike out each component individually; you have to do that yourself.

The \bgroup ... \egroup serves two purposes. First is preserves the contents of \box0. It also means you can use \mathsout as an exponent etc. without having to enclose it in braces.

\documentclass{article}
\usepackage{mathtools}

\newcommand{\mathsout}[1]% will draw line through middle of #1
{\bgroup\mathchoice
  {\sbox0{$\displaystyle{#1}$}%
    \usebox0\hspace{-\wd0}%
    \rule[0.5\ht0-0.5\dp0-.5pt]{\wd0}{1pt}}%
  {\sbox0{$\textstyle{#1}$}%
    \usebox0\hspace{-\wd0}%
    \rule[0.5\ht0-0.5\dp0-.5pt]{\wd0}{1pt}}%
  {\sbox0{$\scriptstyle{#1}$}%
    \usebox0\hspace{-\wd0}%
    \rule[0.5\ht0-0.5\dp0-.5pt]{\wd0}{1pt}}%
  {\sbox0{$\scriptscriptstyle{#1}$}%
    \usebox0\hspace{-\wd0}%
    \rule[0.5\ht0-0.5\dp0-.5pt]{\wd0}{1pt}}%
\egroup}

\begin{document}

\begin{equation}
x= \cos(\omega t) + \mathsout{sin(\omega t)} + \mathsout{e}^\mathsout{-t}
\end{equation}

\end{document}

demo

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .