Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Typesetting $\overrightarrow{OQ}$ yields a very unpleasant gap in the arrow when used with garamond. Here's a minimal working example that shows the problem. It looks okay without the garamond line.

\documentclass{article}
\usepackage[garamond]{mathdesign}    
\begin{document}
\[\overrightarrow{OQ}.\]
\end{document}

This is clearly an unwanted feature. Is it possible to fix this? (discarding garamond is not an option, I've already typeset and printed several hundreds of pages with it, and I want uniformity in my documents for my students).

share|improve this question

1 Answer 1

up vote 9 down vote accepted

The problem is that the minus sign and the arrow in the math font that's used with the garamond option is shorter than usual and this breaks \rightarrowfill that's used in \overrightarrow.

You should repair the glitch by redefining \rightarrowfill:

\documentclass{article}
\usepackage[garamond]{mathdesign}

\makeatletter
\def\rightarrowfill{%
  $\m@th\smash-\mkern-9mu
  \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
  \mkern-9mu\mathord\rightarrow$}
\makeatother

\begin{document}
$\overrightarrow{OQ}$

\makebox[1.0em]{\rightarrowfill}
\makebox[1.1em]{\rightarrowfill}
\makebox[1.2em]{\rightarrowfill}
\makebox[1.3em]{\rightarrowfill}
\makebox[1.4em]{\rightarrowfill}
\makebox[1.5em]{\rightarrowfill}
\makebox[1.6em]{\rightarrowfill}

\makebox[1.7em]{\rightarrowfill}
\makebox[1.8em]{\rightarrowfill}
\makebox[1.9em]{\rightarrowfill}
\makebox[2.0em]{\rightarrowfill}
\makebox[2.1em]{\rightarrowfill}

\end{document}

enter image description here

Using amsmath (which is implicitly loaded by amsart and amsbook) the patch should also be to \arrowfill@; it's simpler to use etoolbox:

\usepackage{etoolbox}
\makeatletter
\patchcmd\arrowfill@{-7mu}{-9mu}{}{}
\patchcmd\arrowfill@{-7mu}{-9mu}{}{}
\patchcmd\rightarrowfill{-7mu}{-9mu}{}{}
\patchcmd\rightarrowfill{-7mu}{-9mu}{}{}
\makeatother
share|improve this answer
    
Thanks so much, it works fine! Well, in fact I'm using the amsbook class, which uses \rightarrowfill@ instead of \rightarrowfill... so I redefined \overrightarrow as found in base/fontmath.ltx and with your fix it seems to work perfectly! –  gniourf_gniourf Sep 30 '12 at 16:26
    
@gniourf_gniourf I've added the patch for amsmath –  egreg Sep 30 '12 at 16:32
    
fantastic! I'm now using your patch for amsmath, it's much nicer than my solution. Thanks a lot! –  gniourf_gniourf Sep 30 '12 at 16:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.