Is there any command or macro for printing a character with a cross over it?
Asked
Active
Viewed 391 times
1 Answers
8
With tikz anything is possible if you are determined.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes}
\newcommand*{\mycancel}[2][draw]{%
\begin{tikzpicture}
\node[cross out,inner sep=0.5pt,outer sep=0pt,#1]{#2};
\end{tikzpicture}
}
\begin{document}
\mycancel[draw=red]{C} \mycancel{$\alpha$}
\end{document}

But there is already a package for it and you can use it in math mode.
\documentclass{article}
\usepackage{cancel,color,amsmath}
\begin{document}
$\xcancel{C}$
\renewcommand{\CancelColor}{\color{red}}
$\xcancel{C}$
$\xcancel{\text{C}}$
\end{document}
