3

I have defined a command \kr to draw a small circle to use it as a letter. Later I want to cancel out a circle. But the cancel line is in the background, see picture. How can I make the cancel line be in the foreground?

enter image description here

Code:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{cancel}
\newcommand*\kr[1]{%
  \begin{tikzpicture}[baseline=(C.base),inner sep=0pt,minimum size=0pt]
    \node (C) {\phantom{a}};
    \node[fill=#1!50,draw,circle,minimum size=0.3cm] (C.center) {};
  \end{tikzpicture}}

\begin{document}
  \kr{green} \cancel{\kr{green}}
\end{document}
  • 1
    draw a line over the node instead of cancel? – percusse Nov 3 '15 at 16:38
3

Maybe something like that:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{cancel}
\newcommand*\kr[1]{%
  \begin{tikzpicture}[baseline=(C.base),inner sep=0pt,minimum size=0pt]
    \node (C) {\phantom{a}};
    \node[fill=#1!50,draw,circle,minimum size=0.3cm] (C.center) {};
  \end{tikzpicture}}

\newcommand*\mycancel[1]{\makebox{\rlap{#1}\cancel{\phantom{#1}}}}

\begin{document}
  \kr{green} \mycancel{\kr{green}}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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