16

I would like to write a word with a slash through it, using LaTeX (in text, not in math mode). That is, I want a line from the lower-left corner of the word through the upper-right. Is there a nice way to do this?

lockstep
  • 250,273
  • What exactly do you mean by "lower-left" corner? Should the line start at the baseline, in the lower left corner of the bounding box of the word, or somewhere else? – Jan Hlavacek Oct 23 '10 at 19:26

5 Answers5

15

Load the cancel package and use \cancel{word}. Most of the commands from the package work in both math and text modes.

lockstep
  • 250,273
frabjous
  • 41,473
  • Thanks! It's not quite perfect; it would be nice if the line were thicker if the word is in a larger font, which doesn't seem to be the case. But it might suffice. – Matt Reece Oct 23 '10 at 22:20
12

Following frabjous' advice, I seem to have discovered a bug in the cancel package: Cancelling at the start of a paragraph only works if you add \leavevmode.

\documentclass{article}

\usepackage{cancel}

\begin{document}

Some text.

% \cancel{Some text.}% Doesn't work
\leavevmode\cancel{Some text.}% Works

\end{document}
lockstep
  • 250,273
9

You might like to try the ulem package and use the command \sout{word} to strikeout a word.

lockstep
  • 250,273
Amy Glen
  • 191
  • 1
  • 3
  • 2
    I agree that ulem can be very useful but do watch out - it hijacks \emph, typesetting emphasised text in underline. The fix is very simple, after loading, issue \normalem to restore \emph back to its original meaning. – Geoffrey Jones Oct 25 '10 at 06:15
  • 6
    Use \usepackage[normalem]{ulem} to avoid the problem mentioned by Geoffrey. – Christian Lindig Apr 25 '11 at 11:29
9

Another possibility with tikz.

\documentclass{article}
\usepackage{tikz} 
\usetikzlibrary{shapes.misc}
\newcommand*\cancel[2][thin]{\tikz[baseline] \node [strike out,draw,anchor=text,inner sep=0pt,text=black,#1]{#2};}  

\begin{document}   

First \cancel{word} canceled, second  \cancel[thick,draw=red]{attempt}

\end{document}    

enter image description here

Alain Matthes
  • 95,075
2

You can use the strike out from the shapes.misc library in TikZ. See the sample code below:

\documentclass[letterpaper]{article}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\newcommand{\strikeout}[1]{%
\tikz[baseline, inner sep=0.5pt] \node [strike out,draw=OrangeRed,anchor=text]{#1};}
\begin{document}
Sample text \strikeout{strike} out.
\end{document} 

enter image description here

azetina
  • 28,884