I’m writing a paper with a lot of commutative diagrams, using tikz-cd
, and am using different styles to distinguish various classes of maps in the diagrams. For instance, injective maps have a hooked tail, defined and used by
\tikzset{inj/.code={\pgfsetarrowsstart{right hook}}}
\begin{tikzcd} A \ar[r,inj] & B \end{tikzcd}
There’s one I’m having trouble defining. It should produce, roughly, a subscripted “lw” beside the arrowhead, i.e.\ something like
\begin{tikzcd} A \ar[r,"lw"' very near end] & B \end{tikzcd}
.
How can I define a style lw
so that I can write \begin{tikzcd} A \ar[r,lw] & B \end{tikzcd}
to get the subscripted “lw” beside the arrowhead as described above?
An attribute that simply adds a label "lw"' very near end
as on the example above would be fine. However, if it’s possible to do something like placing a node relative to the arrowhead, so that one has the versatile syntax of node positioning to fine-tune the placement of the “lw”, that would be even better.
MWE:
\documentclass{standalone}
\usepackage{tikz-cd} \usetikzlibrary{arrows}
\begin{document}
% example of defining/using arrow styles:
\tikzset{inj/.code={\pgfsetarrowsstart{right hook}}}
\begin{tikzcd} A \ar[r,inj] & B \end{tikzcd}
% what I want to define a style for:
\begin{tikzcd} A \ar[r,"lw"' very near end] & B \end{tikzcd}
\end{document}