3

In my opinion, mathabx has the nicest arrows. However, it doesn't include long arrows as single glyphs, so they are built in the same way amsmath builds their arrows, with the code \def\longleftarrow{\relbar\protect\joinrel\leftarrow}.

The problem is that mathabx's relbar has roundend corners, the same as the endings of mathbax`s arrows. Hence, long arrows present an imperfection in the middle. It is shown in the following picture, with zoom=98526.1%.

A partial solution is to redefine the relbar as the - sign. This fix one ''hill'' but it still remains another one:

enter image description here

In this case zoom= 98526.1% too.

Thus, My question: does anybody know how to fix this problem?

Thanks Here I write my mwe:

\documentclass{article}

\usepackage{amsmath}
\usepackage{mathabx}

\DeclareFontFamily{U}{matha}{\hyphenchar\font45}
\DeclareFontShape{U}{matha}{m}{n}{
      <5> <6> <7> <8> <9> <10> gen * matha
      <10.95> matha10 <12> <14.4> <17.28> <20.74> <24.88> matha12
      }{}
\DeclareSymbolFont{matha}{U}{matha}{m}{n}
%\let\rightarrow\abc
\DeclareMathSymbol{\varrelbar}{\mathrel}{matha}{1}
\def\varlongrightarrow{\varrelbar\protect\joinrel\rightarrow}
\begin{document}

\begin{align*}
&\longrightarrow \\
&\varlongrightarrow
\end{align*}

\end{document}

EDIT

I add a figure showing the arrowhead of one arrow (zoom=147789%)

enter image description here

  • Please help us out and provide a minimum working example of code. – Steven B. Segletes Jan 8 '19 at 11:49
  • Oh, yes. Sorry. I'll edit the question. Thanks. – Dog_69 Jan 8 '19 at 11:52
  • I do not get your behavior...I get a highly pixelated arrowhead, but a straight arrow shank without anomaly (when using Adobe reader). When using TeXworks viewer, I do get a shaft anomaly, but in the form of a single stair step. – Steven B. Segletes Jan 8 '19 at 12:16
  • Did you compile with pdfLaTeX? – Dog_69 Jan 8 '19 at 12:50
  • Yes I did compile with pdflatex. – Steven B. Segletes Jan 8 '19 at 13:02
3

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:

output

(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%?):

GOOD

And here is, for comparison, what the original \longrightarrow looks like at the same resolution:

BAD

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.
|improve this answer|||||
  • 1
    I know that comments conggratulating the answers should be avoided. But this answer so fantastic that I have to do it. Just amazing. Thanks. – Dog_69 Jan 8 '19 at 22: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.