I'm drawing some nodes with to and from edges with some of the edges red, and with a cross through it. I have a custom decoration for the cross, and draw a red arrow head at the end of the line. In trying to shorten the line, to avoid it going out of the arrow head bounds, I find that the custom marker is also shortened.
What I have so far is as shown in the code and image below. Is there a way can shorten the line without affecting the cross, or even a better way to do this in general?
Thanks for your help!
\documentclass[tikz]{standalone}
\usepackage{tikz-cd}
\usetikzlibrary{arrows,positioning,decorations.pathmorphing,decorations.pathreplacing,decorations.shapes,decorations.markings}
\tikzset{
shift left/.style ={commutative diagrams/shift left={#1}},
shift right/.style={commutative diagrams/shift right={#1}},
crossed/.style={draw=red,shorten >= 1.8pt,
decoration={markings, mark= at position .15 with
{
\draw[red] (-2pt,-2pt) -- (2pt,2pt);
\draw[red] (2pt,-2pt) -- (-2pt,2pt);
};,
mark= at position 1 with {\arrow[red]{>}};
},
postaction={decorate},
},
}
\begin{document}
\begin{tikzpicture}[
mynode/.style={rectangle,draw=black,thick,inner sep=0pt, minimum size=4mm},>=latex',
]
\node[mynode,font=\tiny] (m0) {0};
\node[mynode,right=of m0,font=\tiny] (m1) {1};
\path[shift left=.75ex,thick]
(m0) edge[->] node[very near start, yshift=-0.5ex, xshift=0.5ex, font=\tiny] {2} (m1)
(m1) edge[crossed] node[very near start, yshift=0.5ex, xshift=-0.5ex, font=\tiny] {4} (m0);
\end{tikzpicture}
\end{document}
This gives me:

Without the shorten command, I get:

