0

Consider the following code from egreg:

\documentclass{article}

\newcommand{\strutarrow}[2]{%
  \vrule width 0pt height 2\fontdimen22
  \ifx#1\displaystyle\textfont\else
    \ifx#1\textstyle\textfont\else
      \ifx#1\scriptstyle\scriptfont\else
  \scriptscriptfont\fi\fi\fi 2
  {#2}%
}
\newcommand{\srightarrow}{%
  \mathrel{\mathpalette\strutarrow\longrightarrow}%
}

\begin{document}

\fbox{$\srightarrow$}

\end{document}

arrow

As can be seen, the long arrow is composed of line segment and shorter arrow.

How do I "fix" this so that there isn't a dent in the arrow?

2
  • 1
    the default overlap is \DeclareRobustCommand\joinrel{\mathrel{\mkern-3mu}} you could redefine it to be -4mu and have more overlap and a slightly shorter arrow or use a font that has long arrows that don't need building up like: → ⟶ Commented Jan 17, 2018 at 18:56
  • 1
    The code for the strut has nothing to do with this. Try with just \longrightarrow, but it's only a question of font hinting.
    – egreg
    Commented Jan 17, 2018 at 21:09

2 Answers 2

2

The \longrightarrow is defined as

\def\longrightarrow{\relbar\joinrel\rightarrow}

You can correct the flaw mentioned above for example by this:

\def\longrightarrow{\relbar\joinrel\mkern-1mu\rightarrow}

Note that the problem has nothing in common with the code mentioned in your question. The code only adds the invisible strut (depending on the math style).

2

You can add a small negative space using the \! macro. Inserting it before #2 seems to fix the issue:

\documentclass{article}

\newcommand{\strutarrow}[2]{%
  \vrule width 0pt height 2\fontdimen22
  \ifx#1\displaystyle\textfont\else
    \ifx#1\textstyle\textfont\else
      \ifx#1\scriptstyle\scriptfont\else
  \scriptscriptfont\fi\fi\fi 2
  \!{#2}%
}
\newcommand{\srightarrow}{%
  \mathrel{\mathpalette\strutarrow\longrightarrow}%
}

\begin{document}
\fbox{$\srightarrow$}
\end{document}
1
  • This cannot help because \! is inserted between strut and \longrightarrow. But the problem is in \longrightarrow.
    – wipet
    Commented Jan 17, 2018 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .