I want to typeset vectors with \rightharpoonup
heads. I found that the most ideal solution is this answer, where the author uses -
to fill the overline when the body is lengthy.
However, I'm now using math time professional 2, and due to its bigger looking plus/minus sign, I had redefined the minus sign, -
, borrowing from txfonts
. The code is:
\DeclareSymbolFont{vvsymbols}{OMS}{txsy}{m}{n}
\SetSymbolFont{vvsymbols}{bold}{OMS}{txsy}{bb}{n}
\DeclareMathSymbol{-}{\mathbin}{vvsymbols}{0}
And then the bar became splits.
How can I solve this? Should I redefine the command \relbar
? Or should I temporarily specify the -
to be the original one within that vector command? How to do that?
Code
\documentclass[12pt,a4paper,openany,fleqn]{book}
\usepackage[margin=2cm, top=2cm]{geometry}
\usepackage{amsmath}
\usepackage[subscriptcorrection,nofontinfo,zswash,mtphrb]{mtpro2} %this could be commented
\parindent=0pt
\makeatletter
\newcommand*\MY@leftharpoonupfill@{%
\arrowfill@\leftharpoonup\relbar\relbar
}
\newcommand*\MY@rightharpoonupfill@{%
\arrowfill@\relbar\relbar\rightharpoonup
}
% These are not needed, for now:
% \newcommand*\MY@leftharpoondownfill@{%
% \arrowfill@\lefttharpoondown\relbar\relbar
% }
% \newcommand*\MY@rightharpoondownfill@{%
% \arrowfill@\relbar\relbar\rightharpoondown
% }
\newcommand*\overleftharpoon{%
\mathpalette{\overarrow@\MY@leftharpoonupfill@}%
}
\newcommand*\overrightharpoon{%
\mathpalette{\overarrow@\MY@rightharpoonupfill@}%
}
% Support for smaller size arrows:
\newcommand*\@dblsty@mathpalette[2]{%
% Works like "\mathpalette", but macro passed in #1 must take
% (at least) three arguments, of which the first _two_ are
% style selections.
\mathchoice
{#1\displaystyle \scriptstyle {#2}}%
{#1\textstyle \scriptstyle {#2}}%
{#1\scriptstyle \scriptscriptstyle {#2}}%
{#1\scriptscriptstyle \scriptscriptstyle {#2}}%
}
\newcommand*\@dblsty@overarrow@[4]{%
% #1 := stretchable covering arrow
% #2 := base style
% #3 := style for covering arrow
% #4 := base symbol
\vbox{\ialign{##\crcr
#1#3\crcr
\noalign{\nointerlineskip}%
$\m@th\hfil #2#4\hfil$\crcr
}}%
}
\newcommand*\smalloverleftharpoon{%
\@dblsty@mathpalette{\@dblsty@overarrow@\MY@leftharpoonupfill@}%
}
\newcommand*\smalloverrightharpoon{%
\@dblsty@mathpalette{\@dblsty@overarrow@\MY@rightharpoonupfill@}%
}
\newcommand*\myvec{%
\@dblsty@mathpalette{\@dblsty@overarrow@\MY@leftharpoonupfill@}%
}
\makeatother
\DeclareSymbolFont{vvsymbols}{OMS}{txsy}{m}{n}
\SetSymbolFont{vvsymbols}{bold}{OMS}{txsy}{bb}{n}
\DeclareMathSymbol{-}{\mathbin}{vvsymbols}{0}
\begin{document}
$1+1=2=3-1$ (You can see the minus sign became smaller.)\\
$\overrightharpoon{AB}:=\overrightharpoon{\textit{counter}}$
\end{document}