0

I want to typeset a vector with an arrow over the top that has a long subscript. My approach makes the vector arrow center over the letter including its subscripts, but I want the arrow to be centered over the letter only instead. Does anyone have an idea how to achieve this? I guess it will be kind of easy for you folks, but I couldn't find an answer by googling.

My code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\(\Vec{H_{\mathrm{n,1}}}\)

\end{document}

my output:

enter image description here

I would like the vector arrow to be centered over the "H" instead of the whole thing.

5
  • 2
    \(\Vec{H}_{\mathrm{n,1}}\) Commented Jun 1, 2021 at 20:02
  • 1
    \vec{H}_{n,1} (I see no reason for \mathrm}. By the way, \Vec is exactly the same as \vec
    – egreg
    Commented Jun 1, 2021 at 20:02
  • I just realized the second I posted. I thought I had tried steven's approach before and it didn't work, but I must have screwed it up somehow. Thanks!
    – M S
    Commented Jun 1, 2021 at 20:03
  • @egreg: \mathrm makes the subscripts upright instead of italic, it's just a requirement of my institution.
    – M S
    Commented Jun 1, 2021 at 20:04
  • By the way, can I mark this closed somehow if there is no answer that I can accept? Can I accept comments as answers?
    – M S
    Commented Jun 1, 2021 at 20:07

1 Answer 1

0

Personally, using a vector notation with an upward slanting arrow positioned toward the center is not at all appealing to me. There are so many ways to write a vector in LaTeX. Here is a suggestion using esvect package with the c option. But you can choose any of the options you like from the link that I have added.

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage[c]{esvect}

\begin{document}
\(\vv{H}_{n,1}\)

\end{document}

enter image description here

This is with the option f similar to tikz-cd:

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath,amssymb}
\usepackage[f]{esvect}%%%%%%%%%%%%%%%% option f. 

\begin{document}
\(\vv{H}_{n,1}\)

\end{document}

enter image description here

2
  • 1
    thanks for the suggestion of the esvect package, these certainly look better than the arrows that \vec produces
    – M S
    Commented Jun 1, 2021 at 21:26
  • @MS I am glad to have helped you.
    – Sebastiano
    Commented Jun 1, 2021 at 21:28

You must log in to answer this question.

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