6

I want to use the following hooked arrow instead of usual one:

enter image description here

where its tail is math command subset. But zooming further to this one (image from Lee smooth manifolds, p. 563) it reveals that it has been assembled in awkward way (see below): enter image description here

How can I have such arrow in tikz-cd or inside math formulas?

1 Answers1

7

Something like this? tikz-cd allows you to use glyphs for arrow tips. (I had to define a slightly wider version in order to avoid the symbol from being clipped.)

\documentclass{article}  
\usepackage{tikz-cd}
\makeatletter
\pgfdeclarearrow{
  name=xGlyph,
  cache=false,
  bending mode=none,
  parameters={\tikzcd@glyph@len,\tikzcd@glyph@shorten},
  setup code={%
    \pgfarrowssettipend{\tikzcd@glyph@len\advance\pgf@x by\tikzcd@glyph@shorten}},
  defaults={
    glyph axis=axis_height,
    glyph length=+1.55ex,
    glyph shorten=+-0.1ex},
  drawing code={%
    \pgfpathrectangle{\pgfpoint{+0pt}{+-1.5ex}}{\pgfpoint{+\tikzcd@glyph@len}{+3ex}}%
    \pgfusepathqclip%
    \pgftransformxshift{+\tikzcd@glyph@len}%
    \pgftransformyshift{+-\tikzcd@glyph@axis}%
    \pgftext[right,base]{\tikzcd@glyph}}}
\makeatother    
\tikzset{
supset/.tip={xGlyph[glyph math command=supset,
    glyph axis=5.2pt]},
}
\begin{document}
\[\begin{tikzcd} 
 A \arrow[supset-latex,d]\\
 B \\
\end{tikzcd}\]
\end{document}

enter image description here

Maximal zoom under preview on a Mac:

enter image description here

Alternatively you can use \pgfdeclarearrow to declare the arrow.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta}
\pgfdeclarearrow{
  name = shook,
  parameters = {\the\pgfarrowlength,\the\pgfarrowwidth},
  setup code = {
    % The different end values:
    \pgfarrowssettipend{\pgfarrowlength}
    \pgfarrowssetlineend{.01\pgfarrowlength}
    \pgfarrowssetvisualbackend{-.1\pgfarrowlength}
    \pgfarrowssetbackend{-.25\pgfarrowlength}
% The hull
    \pgfarrowshullpoint{\pgfarrowlength}{0pt} 
    \pgfarrowshullpoint{0pt}{-\pgfarrowwidth} 
    \pgfarrowssavethe\pgfarrowlength
  },
  drawing code = {
    \pgfpathmoveto{\pgfqpoint{0pt}{0pt}}
    \pgfpatharc{90}{-90}{\pgfarrowlength and \pgfarrowwidth/2}
    \pgfpathlineto{\pgfpoint{-\pgfarrowlength}{-\pgfarrowwidth}}
    \pgfusepathqstroke
},
  defaults = { length = 4pt,width=8pt}
}
\begin{document}
\begin{tikzpicture}
    \draw [shook-latex] (0,0) -- (0,-2);
    \draw [{shook[length=3pt]}-latex] (1,0) -- (1,-2);
    \draw [thick,{shook[length=3pt,width=7pt]}-latex] (2,0) -- (2,-2);
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    +1.5. Thanks @Schrödinger's cat. But same problem again when I zooming it in (slightly better)!!! or maybe it is because of my Screen resolution? –  Nov 01 '19 at 04:59
  • 3
    @C.F.G One has to be extremely lucky to have the line width of the glyph coincide with the line width of pgf. However, I added a second version in which I draw the hook, so the line width matches perfectly. –  Nov 01 '19 at 05:03
  • 1
    Thanks a lot (=mc^2). –  Nov 01 '19 at 05:04
  • 1
    @C.F.G It might also be a viewer issue. On preview the glyph proposal seems to be fine, on acroread one can see a very tiny corner at magnification 1600%. –  Nov 01 '19 at 05:07
  • 1
    I prefer the first one of your answer, because I can change the size of supset by glyph length=1.5ex. What about the second code? –  Nov 01 '19 at 05:10
  • glyph length=1.5ex change the size in both dim x and y in properly way. –  Nov 01 '19 at 05:16
  • @C.F.G I added a version in which you can change both the width and the length. –  Nov 01 '19 at 05:16
  • Thanks. In first code, why I can't use other directions? e.g. r, l. –  Nov 01 '19 at 05:26
  • @C.F.G You can. Try \[\begin{tikzcd} A \arrow[supset-latex,d] \arrow[supset-latex,r] & C\\ B & D\\ \end{tikzcd}\]. –  Nov 01 '19 at 05:27
  • The second code output seems that is equal to usual hook. isn't? –  Nov 01 '19 at 05:29
  • 1
    @C.F.G I made a mistake with the glyph, didn't realize its lower part got clipped. Fixed it. –  Nov 01 '19 at 06:08