13

I am trying to make a vector-like symbol to use in a paper I'm writing. I am actually able to make almost exactly what I want in Mathematica, in which it looks like this:

enter image description here

In TeX I am using $\overset{\rightharpoonup}{\Gamma_{\! G}}$, which yields:

enter image description here

The harpoon on top is set too high.

Also, the high harpoon makes problems with line spacing, which should be evident from the following image:

enter image description here

How do I "nudge" the \rightharpoonup down so it isn't set so high above the \Gamma?

13
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{tikz}

% Adjust the -0.75ex to taste
\newcommand{\tightoverset}[2]{%
  \mathop{#2}\limits^{\vbox to -.5ex{\kern-0.75ex\hbox{$#1$}\vss}}}

% Just for fun, a tikz solution
\newcommand{\tikzoverset}[2]{%
  \tikz[baseline=(X.base),inner sep=0pt,outer sep=0pt]{%
    \node[inner sep=0pt,outer sep=0pt] (X) {$#2$}; 
    \node[yshift=1pt] at (X.north) {$#1$};
}}

\begin{document}
\lipsum[1]
$\overset{\rightharpoonup}{\Gamma_{\!G}}$
$\tightoverset{\rightharpoonup}{\Gamma_{\!G}}$
$\tikzoverset{\rightharpoonup}{\Gamma_{\!G}}$
\lipsum[2]

\end{document}

(This will also give you a larger harpoon, which is closer to your Mathematica example.)

enter image description here

  • Thanks. Of all the answers, your tikz overset worked the best. – Alexander Gruber Aug 15 '12 at 20:45
12

You can reduce the height using \smash and insert a fake height to move the accent up/down:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}

$\overset{\rightharpoonup}{\Gamma_{\!G}}\ 
   \overset{\rightharpoonup}{\vphantom{a}\smash{\Gamma_{\!G}}}$

\end{document}

\vphantom{a} is just to insert an object of height a (no ascenders). Alternatively, you could use \rule{0pt}{.6ex}, say.

11

You may want to consider using the \overrightharp command that's provided by the harpoon package. The symbol's overall length adapts automatically to the width of its argument.

Note that unlike most math-accent symbols, the \overrightharp macro operates in text mode. If it's going to be used regularly in math contexts, it's probably a good idea to create a wrapper macro, say \orh, that operates correctly while in math mode. The following MWE shows how this might be done:

\documentclass{standalone}
\usepackage{harpoon,amsmath}
\newcommand*{\orh}[1]{\text{\overrightharp{\ensuremath{#1}}}}
\begin{document}
\overrightharp{$\Gamma_{\!G}$} and $\orh{\Gamma_{\!G}}$
\end{document}

enter image description here

Separately, if the term \Gamma_{\!G} is going to be used frequently in your document, you may want to create a dedicated macro, say \def\GG{\Gamma_{\!G}}. This will save you you a lot of typing (and avoid lots of opportunities for creating typos...) in the document itself.

3

It is my understanding that the “correct” method for these kinds of things is a mathematical accent. With XeTeX, the underlying definition could then be, for example (would need to have the fonts set up prior to this):

\def\rharp{\XeTeXmathaccent"7"0"20D1 } % for luatex: \Umathaccent
$ \rharp\Gamma \qquad \rharp{\Gamma_G} \qquad \rharp{\Gamma_{GG}} $

which looks like (with XITS Math active): enter image description here

The unicode-math -package has this mathematical accent accessible with the command:

\rightharpoonaccent

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.