2

The title says it all, really. I'd like to use an arrow that looks exactly like an "upside down \hookrightarrow" in a diagram (for which I'm using tikz-cd), but I am really not comfortable enough with the nitty-gritty details of defining arrows that play nice with the extensibility etc. requirements of tikz-cd to define such a thing by myself.

More generally, an answer that explains how to edit a pre-existing arrow (or create a new one entirely?!) that will work properly in tikz-cd would be welcome.

3

For the arrow you require, you don't have to define anything. It's already there and is called hook'.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{cd}
\begin{document}
\begin{tikzcd}
  A \ar[r,hook]  & B \\
  C \ar[r,hook'] & D \\
\end{tikzcd}
\end{document}

enter image description here


You can define your own arrows easily as specializations of the predefined arrows shipped with the TikZ arrows.meta library.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,cd}
\tikzset{
  five star/.code = {\pgfsetarrowsstart{Rays[n=5]}},
  spaced barb/.code = {\pgfsetarrowsend{Arc Barb[sep].Arc Barb[]}},
  star and barb/.style = {five star, spaced barb}
}
\begin{document}
\begin{tikzcd}
  A \ar[r,star and barb]  & B \\
\end{tikzcd}
\end{document}

enter image description here

|improve this answer|||||
  • Well that was surprisingly simple. Thank you! – Danu Jun 20 '16 at 20:52
  • You're welcome, but please next time post a minimal working example (MWE) with your question. – Henri Menke Jun 20 '16 at 20:53
  • My bad; I won't forget it next time. Also, this simple hint induced a great simplification of my tikz-cd syntax in general. I have been using commands like rightarrowtail, twoheadrightarrow, etc. They are now all replaced by easier commands! Thanks a ton. – Danu Jun 20 '16 at 20:58

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.