The context
I know how to use append after command
to draw a cross inside a rectangle (see code block and image below)
\documentclass[border=2]{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.misc, fit}
\tikzset{
mystyle/.style = {
rectangle,
draw,
append after command={
node [
fit = (\tikzlastnode),
inner sep = -\pgflinewidth,
cross out,
draw = blue
] {}
}
},
}
\begin{document}
\begin{tikzpicture}
\node [mystyle] {a};
\end{tikzpicture}
\end{document}
As can be seen in the image above, the blue cross is drawn on top of the text of the node. I want to change this behavior. I want the text to be on top of the blue cross so that text is not covered by anything.
The question
How can I make the text of the node not be covered by the blue cross drawn by append after command
?
One way to accomplish this is by making append after command
draw the cross below the "a". Is there an option that I can pass to append after command
to set that behavior?
Best Answer
You can customize the node "background" with a
path picture
: