I want to customize a command \myvec{arg}.
If the argument is a single character, then \bm{arg}
else then \vv{arg}
I want to customize a command \myvec{arg}.
If the argument is a single character, then \bm{arg}
else then \vv{arg}
Adapting code from:
the following seems to work:
\documentclass{article}
% This code by Hendrik Vogt https://tex.stackexchange.com/a/70562/2693
\newcommand*\ifsingle[3]{%
\setbox0\hbox{$\mathaccent"0362{#1}^H$}%
\setbox2\hbox{$\mathaccent"0362{\kern0pt#1}^H$}%
\ifdim\ht0=\ht2 #3\else #2\fi
}
\usepackage{bm}
\def\vv{} % define as needed
\newcommand*\myvec[1]{\ifsingle{#1}{\bm{#1}}{\vv{#1}}}
\begin{document}
$\myvec{a}$
$\myvec{aa}$
$\myvec{\alpha}$
$\myvec{\alpha\beta}$
\end{document}
\bmand\vvwere coming from by giving a minimal working example. – Alan Munn Apr 16 '17 at 00:27