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}

1 Answer 1

4

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.

1
  • It works perfectly!
    – user77461
    Nov 7, 2018 at 18:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy