tags:

views:

357

answers:

2
+2  A: 

What you're specifically proposing would have to be done with Javascript, however you could do it with CSS if you used a background image for the arrow.

Something like:

span.vector {
    background: url(arrow.png) no-repeat top;
}
roryf
Ah, I should have thought of that. Thanks!
PreciousBodilyFluids
Borgar has a very good point about the arrow being part of the content, I'd consider using his solution instead.
roryf
+3  A: 

The arrow is a part of the content and belongs in the HTML. You should be able to remove the JavaScript and CSS and the text should still make sense (let's say you decide to print out the page).

You should use the COMBINING RIGHT ARROW ABOVE with the vector letter to represent the full vector glyph.

I propose the following markup:

<var class="vector">v<span>&#8407;</span></var>

For extra nice representation you can then shift the symbol back over the letter with a touch of CSS:

var.vector {
  font-style : normal;
}
var.vector span {
  margin-left: -.55em;   /* shift the arrow back over the letter */
  vertical-align : .2em; /* tune the arrow vertical position */
}

Here is a jsbin example.

Borgar
I was just about to type up something like this. But you don't need all that CSS. The arrow needs to go *after* the letter: `x⃗`, not before it.
mercator
Good catch. I have updated the answer with the correct order. Initially I thought that the arrow letter should have 0 width (because that is what "Non-Spacing" in means to me); I put it in front as I have more experience with fonts and letters than with math notation. Apparently still failing at both though. :-)
Borgar