7

I'm trying to create an equation where the letter "I" has a horizontal line through it. The only name I know for this action is "strikethrough" but I'm not sure if this would be correct when dealing with equations specifically; I don't want the line to be too long.

I've tried the ulem, soul, sout and cancel but none of these seem to work inside a \begin{equation} ... \end{equation} environment.

lockstep
  • 250,273

1 Answers1

7
  1. Box the contents in an \mbox that you then use inside equation as a macro.

    enter image description here

    \documentclass{article}
    \usepackage{soul}% http://ctan.org/pkg/soul
    \newcommand{\stI}{\mbox{\st{$I$}}}
    \begin{document}
    \begin{equation}
      f(x)=\stI\times\stI
    \end{equation}
    \end{document}
    
  2. A slightly more verbatim boxing technique is to set everything inside a box using lrbox and then just use the box via \usebox:

    \documentclass{article}
    \usepackage{soul}% http://ctan.org/pkg/soul
    \newsavebox{\strikeoutI}
    \begin{lrbox}{\strikeoutI}\st{$I$}\end{lrbox}
    \newcommand{\stI}{\usebox{\strikeoutI}}
    \begin{document}
    \begin{equation}
      f(x)=\stI\times\stI
    \end{equation}
    \end{document}
    
  3. Use \ooalign to overlay symbols (an $I$ and a horizontal rule):

    \documentclass{article}
    \newcommand{\stI}{%
      \ooalign{\hidewidth $I$\hidewidth\cr\rule[.5ex]{1ex}{.4pt}}}
    \begin{document}
    \begin{equation}
      f(x)=\stI\times\stI
    \end{equation}
    \end{document}
    

    See \subseteq + \circ as a single symbol (“open subset”) for a short course in \ooalign.

Werner
  • 603,163
  • Thank you Werner for your comprehensive answer! For my needs, option 3 from your list was the most appropriate as it allows the horizontal line to be made less wide but also to be moved up or down the character "I" in order to not clash with sub/superscripts. –  Aug 04 '12 at 14:08