I'm using the standard LaTeX vector arrows in math mode, but they are always aligned in such a way that they result shifted if they haven't an italic character underneath.

The following code:

\documentclass{article}
\usepackage[e]{esvect}

\begin{document}
$\vec{A}\ \vv{A}\ \vec{\mathrm{A}}\ \vv{\mathrm{A}}\ \vv{\ell}\ \vec{\ell}$
\end{document}

produces:

enter image description here

I've compared the traditional arrows with the ones from the esvect package because I'd love to have the centring of the esvect arrows upon non-italic characters but maintain the normal arrow type and length of the plain LaTeX arrow.

This type of centring should only apply to non-italic characters, but it would be nice to be able, if needed, to manually adjust the centring of the vector arrow above any character too.

Thank you for your time, it is very appreciated.

up vote 3 down vote accepted

You could create a macro with some horizontal kerning adjustment.

In the following MWE \myvec has an optional argument (default value 1mu) to indicate that adjustment:

\documentclass{article}
\usepackage[e]{esvect}
\newcommand{\myvec}[2][1mu]{\vec{#2\mkern-#1}\mkern#1}
\begin{document}
Benchmark:

$\vec{A}\ \vv{A}\ \vec{\mathrm{A}}\ \vv{\mathrm{A}}\ \vv{\ell}\ \vec{\ell}$

With my macro:

$\myvec{A}\ \myvec{\ell}$

In case you need to adjust the kerning:


$\myvec[2mu]{A}\ \myvec[2mu]{\ell}$
\end{document}

enter image description here

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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