6

I'm using this symbol (defined by Steven B. Segletes here) to denote a special type of function definition:

\newcommand*\diamondarrow{%
  \stackengine{0pt}{\hspace{.83ex}$\rightarrow$}{$\diamond$}{O}{l}{F}{F}{L}}

I have noticed that when used in subscript it does not scale (should it, right?). How can I make it scaling automatically?

\documentclass{article}

\usepackage{stackengine}
\usepackage{scalerel}

\newcommand*\diamondarrow{%   
  \stackengine{0pt}{\hspace{.83ex}$\rightarrow$}{$\diamond$}{O}{l}{F}{F}{L}}

\begin{document}
$A \diamondarrow B_{C \diamondarrow D_{E \diamondarrow F}}$
\end{document}
5

I suggest a different definition:

\documentclass{article}

\newcommand{\diamondarrow}{%
  \mathrel\diamond
  \mathrel{\mathchoice{\mkern-2mu}{\mkern-2mu}{\mkern-2.5mu}{\mkern-3mu}}%
  \rightarrow
}

\begin{document}
$A \diamondarrow B_{C \diamondarrow D_{E \diamondarrow F}}$
\end{document}

image

By setting everything to a \mathrel, TeX will not introduce any additional spacing. With the help of \mathchoice we're able to define different negative kerns for the different math styles. This is font depending, though, so different math fonts might need different amounts.

| improve this answer | |
  • It works perfectly! – BlackBrain Nov 7 '18 at 18:17

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.