5

Is there any command or macro for printing a character with a cross over it?

Werner
  • 603,163
user56153
  • 999

1 Answers1

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}

enter image description here

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}

enter image description here