# Issue with \xrightarrow

I get something weird from the \xrightarrow command: the line is dashed.

Here is my main.texfile:

\documentclass[twoside,titlepage,paper=a4,fontsize=12pt,numbers=noenddot,cleardoublepage=empty,openright]{scrreprt}

\usepackage{polyglossia}
\setdefaultlanguage{french}

\usepackage{feynmp}

\usepackage{unicode-math}
\RequirePackage{amsmath}
\usepackage{slashed}

\usepackage{graphicx}
\DeclareGraphicsRule{*}{eps}{*}{}

\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext=eqs,placement={tbp},name=Éq.]{eq}

\begin{document}

$$\parbox{30mm}{ \vspace{4.3mm} \begin{fmffile}{self} \begin{fmfgraph*}(100,75) \fmfcmd{ vardef middir(expr p,ang) = dir(angle direction length(p)/2 of p + ang) enddef; style_def arrow_right expr p = shrink(.7); cfill(arrow p shifted (8thick*middir(p,-90))); endshrink enddef;} \fmfset{curly_len}{2mm} \fmfleft{i} \fmfright{o} \fmf{quark,label=p}{i,v1} \fmf{quark,label=p}{v2,o} \fmf{quark,tension=.3,label=p+l}{v1,v2} \fmf{arrow_right,tension=.3}{v2,v1} \fmf{gluon,left,tension=.1,label=l}{v1,v2} \end{fmfgraph*} \end{fmffile} } \qquad \xrightarrow[\: \varepsilon \to 0 \:]{} \quad i \, \slashed{p} \, C_F\, \frac{g_C^2}{4\pi} \, \frac{1}{\varepsilon} + \dots$$

\end{document}


To compile, I run:

latexmk -quiet -e '$pdflatex=q/xelatex %O %S/' -f -pdf -synctex=1 -jobname=Document -outdir=$PWD/Result $PWD/main.tex cd Result/ mpost self.mp cd .. latexmk -quiet -e '$pdflatex=q/xelatex %O %S/' -f -pdf -synctex=1 -jobname=Document -outdir=$PWD/Result$PWD/main.tex


Would you know how I could fix that ?

Thanks a lot for your help !

(EDIT:)

Here's a MWE:

\documentclass{article}

\usepackage{unicode-math}
\RequirePackage{amsmath}

\begin{document}

$$\xrightarrow[\: \varepsilon \to 0 \:]{}$$

\end{document}

• this appears to be a bug in unicode-math. (there are some problems with the \xrightarrow being tested in the new beta version of the stix fonts, so this isn't surprising. i will ping will robertson.) – barbara beeton Aug 22 '15 at 14:12
• @barbarabeeton — actually I don't really see why unicode-math needs to reimplement amsmath whenever something doesn't work; it would preferable to fix amsmath instead :) Presumably the problem would go away if U+23AF (horizontal line extender) were being used directly without the need to "back up" as in @egreg's answer below. – Will Robertson Feb 11 '16 at 23:15

It seems that the backing up done by \arrowfill@ is insufficient when Latin Modern Math is used. Here's a fix:

\documentclass{article}
\usepackage{ifxetex}

\usepackage{amsmath}
\usepackage{etoolbox}
\ifxetex
\usepackage{unicode-math}
\makeatletter
\patchcmd{\arrowfill@}{-7mu}{-14mu}{}{}
\patchcmd{\arrowfill@}{-7mu}{-14mu}{}{}
\patchcmd{\arrowfill@}{-2mu}{-4mu}{}{}
\patchcmd{\arrowfill@}{-2mu}{-4mu}{}{}
\makeatother
\fi

\begin{document}

\begin{gather}
\xrightarrow[\mspace{28mu}]{}\\
\xrightarrow[\mspace{30mu}]{}\\
\xrightarrow[\mspace{32mu}]{}\\
\xrightarrow[\mspace{34mu}]{}\\
\xrightarrow[\mspace{36mu}]{}\\
\xrightarrow[\mspace{38mu}]{}\\
\xrightarrow[\mspace{40mu}]{}\\
\xrightarrow[\mspace{42mu}]{}\\
\xrightarrow[\mspace{44mu}]{}\\
\xrightarrow[\mspace{46mu}]{}\\
\xrightarrow[\mspace{48mu}]{}\\
\xrightarrow[\mspace{50mu}]{}\\
\xrightarrow[\mspace{52mu}]{}\\
\xrightarrow[\mspace{54mu}]{}\\
\xrightarrow[\mspace{56mu}]{}\\
\xrightarrow[\mspace{58mu}]{}\\
\xrightarrow[\mspace{60mu}]{}\\
\xrightarrow[\mspace{62mu}]{}\\
\xrightarrow[\mspace{64mu}]{}\\
\xrightarrow[\mspace{66mu}]{}\\
\xrightarrow[\mspace{68mu}]{}\\
\xrightarrow[\mspace{70mu}]{}\\
\xrightarrow[\mspace{72mu}]{}\\
\xrightarrow[\mspace{74mu}]{}\\
\xrightarrow[\mspace{76mu}]{}\\
\xrightarrow[\mspace{78mu}]{}
\end{gather}
\end{document}


Here's the output if the four \patchcmd lines are commented out.

One can observe that the first and the last parts have gaps, while the middle parts are not overlapping each other. The default backing up is -7mu for the terminal parts and -2mu for the middle parts.

It's got something to do with how \: is interpreted. The following code doesn't have the same problem.

\documentclass{article}

\RequirePackage{amsmath}
\usepackage{unicode-math}

\begin{document}

$$\xrightarrow[\; \varepsilon \to 0 \;]{}$$

\end{document}

• I get exactly the same, a dashed arrow. – Johannes_B Aug 22 '15 at 14:58
• Same here. This doesn't answer the question; the problem remains. It is a bug in unicode-math. I'd suggest you either to modify the answer or to delete it. – Gonzalo Medina Aug 22 '15 at 18:37
• With \; I get a regular arrow. Yes, it is a bug in unicode-math. – JPi Aug 22 '15 at 19:47
• Perhaps the whole question should be turned into a bug report to the unicode-math packag authors. – JPi Aug 22 '15 at 19:54
• @JPi Will did just that: github.com/wspr/unicode-math/issues/314 – David Carlisle Aug 24 '15 at 7:10