# stealth hook arrow in inline math?

For display math I use tikzcd with stealth arrow style, which give me all I need.

From the answer of Stealth arrow in math? I get (from mathabx package) stealth arrows for inline math formulas, but this package doesn't have the hook version, so I can not extract this arrows from it.

The package boisik has a similar symbol, but in an "old style".

I tried building the symbol with TikZ or tikzcd but they modify the space between lines.

So, I would like to have a \newcommand as \varhookrightarrow which works without requiring tikz, LuaTex nor XeTeX, for publishing issues.

• if you don't use TikZ that means it needs a font symbol. If you don't use LuaTeX or XeTeX you are stuck with whatever is available with classical fonts. And that you couldn't find. So it doesn't look like you left any options for us. – percusse May 26 '17 at 10:53

Here's a method that doesn't involve TikZ (not a complete truth -- see pre-requisite) :p

Pre-requisite: You need a picture (preferably in vector format) of the hook arrow. One way is to use TikZ, of course. Another is to draw it in Inkscape or similar software. The point is that your main .tex file using this command would not need TikZ explicitly, nor the use of XeTeX or LuaTeX. I drew my arrow with TikZ, the code for which I supply at the very end of this answer.

On to the code proper:

• I used the \includegraphics command from the graphicx package to include the image of the hook arrow in,
• enclosed that in a \scalerel command from the \scalerel package (written by Steven in the other answer) to ensure it scales well when used in-line,
• and then I enclose the entire thing in a \mathrel for proper spacing when in math mode, just like for the normal \rightarrow etc.
• Finally I wrapped the entire thing in a macro called \hookrightstealtharrow as requested.

Code:

\documentclass{article}
\usepackage{scalerel,graphicx}
\usepackage[nopar]{lipsum} % for dummy text only
\newcommand\hookrightstealtharrow{%
\mathrel{%
\scalerel*{\includegraphics{arrow}}{x}}}

\begin{document}
\textbf{Exhibit A: Comparison with original hooked arrow} \par\medskip
\verb!Normal \hookrightarrow:! $x \hookrightarrow y$ \par
\verb!\hookrightarrow with stealth:! $x \hookrightstealtharrow y$ \par
\bigskip

\textbf{Exhibit B: Showing in-line use} \par\medskip
\lipsum[28]
$x \hookrightstealtharrow y$,
$A_{x \hookrightstealtharrow y} B$,
$C^{x \hookrightstealtharrow y} D$
\lipsum[13]
\bigskip

\textbf{Exhibit C: In various font sizes} \par\medskip
\small $x \hookrightstealtharrow y$\par
\normalsize $x \hookrightstealtharrow y$\par
\large $x \hookrightstealtharrow y$\par
\huge $x \hookrightstealtharrow y$
\end{document}


ps. Sorry for the different sizes of the exhibits. Had to zoom in on them so the image is clearer. So I took individual screenshots. Also, note there's no TikZ :p

Drawing the arrow

You can do this however you like, but I did it with TikZ, see here:

\documentclass[border=1.5pt,tikz]{standalone}
\usetikzlibrary{arrows.meta}

\begin{document}
\tikz[baseline=-.2ex] \draw[{Hooks[right]}-{stealth},] (0,0)--(1.5em,0);
\end{document}


I compiled the above with pdfLaTeX to generate a .pdf file of this image, then placed it in the same directory as the main .tex file.

Might this work for you?

Presented in a multi-line setting, to show that line spacing is not adversely affected. EDITED to make the macro both robust and of \mathrel class.

\documentclass{article}
\usepackage{tikz-cd}
\usepackage[nopar]{lipsum}
\usetikzlibrary{arrows}

\tikzset{
commutative diagrams/.cd,
arrow style=tikz,
diagrams={>=stealth},
ampersand replacement=\&
}
\usepackage{etoolbox}
\DeclareRobustCommand\hookrightstealtharrow{%
\mathrel{\!\!\!\!\begin{tikzcd}\arrow[r,hook]\&{}\end{tikzcd}\!\!\!\!}}

\begin{document}
\lipsum[1]
Inline math $x \hookrightstealtharrow y$ or just $\hookrightstealtharrow$ by itself.
\lipsum[2]
\end{document}


• It should be a robust command; and it needs \mathrel. – egreg May 26 '17 at 16:14
• This works for inline formulas, but then each single diagram $\begin{tikzcd} A \ar{r} & B \end{tikzcd}$ produces a compiler error: ! Package pgf Error: Single ampersand used with wrong catcode. – HeinrichD Jun 8 '17 at 7:50
• It works when one puts ampersand replacement=\& only in the new command arrows. See also tex.stackexchange.com/questions/87781/… – HeinrichD Jun 8 '17 at 7:52