You could use \clipbox
to cut off the ends of \relbar
and \rightarrow
instead of having them overlap.
This command is defined in the trimclip
package, which is part of adjustbox
and is documented separately here.
It feels a little bit like overkill, but it works and I'm not really sure how else you could accomplish this.
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathabx}
\usepackage{trimclip}
\makeatletter %% <- make @ usable in command names
\newcommand*\clipjoin[2]{\mathrel{\mathpalette\clipjoin@{{#1}{#2}}}}
\def\clipjoin@#1#2{\clipjoin@@{#1}#2}
\def\clipjoin@@#1#2#3{%
\begingroup
\settowidth\@tempdima{$\m@th#1\mkern3mu$}%
\trimbox{0pt 128pt {.01\@tempdima} 128pt}{\clipbox{0pt -128pt {.49\@tempdima} -128pt}{$\m@th#1#2$}}%
\trimbox{{.01\@tempdima} 128pt 0pt 128pt}{\clipbox{{.49\@tempdima} -128pt 0pt -128pt}{$\m@th#1#3$}}%
\endgroup
}
\makeatother %% <- revert @
\newcommand*\cliprightarrow{\clipjoin{\relbar}{\rightarrow}}
\begin{document}
\begin{gather*}
\longrightarrow
\\[\glueexpr1ex-\baselineskip]
\cliprightarrow
\\
\scriptstyle
\longrightarrow
\\[\glueexpr1ex-\baselineskip]
\scriptstyle
\cliprightarrow
\\
\scriptscriptstyle
\cliprightarrow
\\[\glueexpr1ex-\baselineskip]
\scriptscriptstyle
\longrightarrow
\end{gather*}
\end{document}
Here's the result at 600dpi:
(From top to bottom, these are pairs of arrows in \displaystyle
, \scriptstyle
and \scriptscriptstyle
, and of each pair the top one is a \longrightarrow
and the bottom one is a \cliprightarrow
)
To illustrate what this looks like from really close by, I've loaded xcolor
and defined.
\newcommand*\cliprightarrow{\clipjoin{\relbar}{\color{red}\rightarrow}}
Here is the part where the arrows meet at 300 000 dpi (~100 000%?):
And here is, for comparison, what the original \longrightarrow
looks like at the same resolution:
Notes:
- I'm using
\mathpalette
to get the size of the arrow right at every math style.
- I'm measuring how wide
3mu
is at the current math style because this is how much will need to be cut off from \relbar
and \rightarrow
(together) to get the same length as with \joinrel
.
\clipbox{<left> <bottom> <right> <top>}{<stuff>}
clips <left>
/<bottom>
/<right>
/<top>
from the left/bottom/right/top of <stuff>
. The part that is clipped off won't be printed
\trimbox{<left> <bottom> <right> <top>}{<stuff>}
just changes the bounding box of <stuff>
in the same way.
- I've used large negative numbers (
-128pt
) for the vertical lengths in the argument of \clipbox
because \rightarrow
is larger than its bounding box and the top of the arrowhead would otherwise be cut off. I then correct this by putting the result in a \trimbox
that shrinks the bounding box by the same amount.
- I'm clipping off only
1.47mu
from \relbar
and \rightarrow
rather than 1.5mu
and trimming each by 0.03
to ensure that there is still a (really tiny) overlap between the arrow shaft and the arrowhead, just in case.
pdflatex
.