Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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
add comment

5 Answers

up vote 15 down vote accepted

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

share|improve this answer
    
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
add comment

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}
share|improve this answer
add comment

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

share|improve this answer
1  
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 6:15
4  
Use \usepackage[normalem]{ulem} to avoid the problem mentioned by Geoffrey. –  Christian Lindig Apr 25 '11 at 11:29
add comment

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

share|improve this answer
    
Same idea at the same moment :) –  Alain Matthes Jun 14 '12 at 19:21
    
@Altermundus :) Yours seems more sophisticated. –  azetina Jun 14 '12 at 19:22
    
Yes you need \tikz[baseline] and to add an optional argument –  Alain Matthes Jun 14 '12 at 19:23
    
@Altermundus I had it but I removed it. Don't remember why I did. –  azetina Jun 14 '12 at 19:27
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.