7

I'm interested in an accent similar to a vector accent with the difference that the vector's origin (namely, the left edge of the arrow) would be emphasized with a full circle, and additionally the accent would stretch when it would be over multiple letters, something similar to a vector accent over a single letter with an emphasized origin, and a vector accent over multiple letters with an emphasized origin.

How can such an accent be achieved?

This accent is intended to represent a vector that includes its origin, whereas the same accent sans the full circle: a vector accent over a single letter, a vector accent over a multiple letters will represent a vector that doesn't include its origin. Alternatively, I may change the full circle to an empty circle and use this version to stand for a vector that doesn't include its origin, whereas the circle-less version will be used for a vector that includes its origin.

1
  • 1
    As a physics prof, I like this idea. Commented Sep 11, 2022 at 17:52

1 Answer 1

10

Here's a possibility that creates the arrows from \circ and \bullet together with \rightarrow and some clipping and resizing.

enter image description here

Two macros are created: \ovec{} and \cvec{} for the "open" and "closed" vectors. Note, at the moment this does not work for subscripts. Other fonts will probably require adjusting.

Here's the code:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{calc} % for subtracting lengths
\usepackage{adjustbox} % \adjustbox, \clipbox, \scalebox

\newcommand{\oarrow}{\scalebox{.4}{$\circ\hspace{-.42em}\rightarrow$}}
\newcommand{\ovec}[1]{\settoheight{\myheight}{\ensuremath{#1}}%
   \adjustbox{raise=.5pt+\myheight,rlap}{%
   \clipbox*{0 0 {.3em} {1.1\height}}{$\oarrow$}%
   \resizebox{\widthof{\ensuremath{#1}}-.5em}{\height}
   {\clipbox*{{.3em} 0 {\width-.2em} {1.5\height}}{$\oarrow$}}%
      \clipbox*{{\width-.2em} {-.5ex} {\width} {1.5\height}}{$\oarrow$}%
   }#1}
\newcommand{\carrow}{\scalebox{.4}{$\bullet\hspace{-.42em}\rightarrow$}}
\newcommand{\cvec}[1]{\settoheight{\myheight}{\ensuremath{#1}}%
   \adjustbox{raise=.5pt+\myheight,rlap}{%
   \clipbox*{0 0 {.3em} {1.1\height}}{$\carrow$}%
   \resizebox{\widthof{\ensuremath{#1}}-.5em}{\height}
   {\clipbox*{{.3em} 0 {\width-.2em} {1.5\height}}{$\carrow$}}%
      \clipbox*{{\width-.2em} {-.5ex} {\width} {1.5\height}}{$\carrow$}%
   }#1}

\newlength{\myheight}

\begin{document}

$\ovec{x}\quad\ovec{xy}$

$\cvec{x}\quad\cvec{xy}$

\end{document}

An alternative using TikZ is much easier, and gives you much greater flexibility:

enter image description here

You can change Stealth to a different arrow shape, adjust sizes, height, thickness, color, etc. You can use Computer Modern Rightarrow[slant=.25, angle=80:1.5pt] to get a good approximation of the default \vec arrow.

Here is the image using the \vec imitation and slightly larger open circle (open,length=1.7pt):

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}
\tikzset{myarrow/.tip={Stealth[length=2pt]}}
%\tikzset{myarrow/.tip={Computer Modern Rightarrow[slant=.25, angle=80:1.5pt]}} % similar to \vec 

\newcommand{\cvec}[1]{\tikz[baseline, anchor=base]{
    \node[inner sep=0pt, outer sep=1pt](A){$#1$};
    \draw[{Circle[length=1.5pt]}-myarrow]
        ([shift={(1.1pt,1pt)}]A.north west)--([shift={(-1.1pt,1pt)}]A.north east);}}
\newcommand{\ovec}[1]{\tikz[baseline, anchor=base]{
    \node[inner sep=0pt, outer sep=1pt](A){$#1$};
    \draw[{Circle[open,length=1.5pt]}-myarrow]
        ([shift={(1.1pt,1pt)}]A.north west)--([shift={(-1.1pt,1pt)}]A.north east);}}

\begin{document}

Vector \cvec{x}. Vector \cvec{xy}.

Vector \ovec{x}. Vector \ovec{xy}.

\end{document}

You must log in to answer this question.

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