# Condition on text vs math symbol [duplicate]

I'd like to have a conditional macro that emboldens symbols, using different commands depending on whether the argument is a math symbol or text. Specifically, I'd like to use \bm for math symbols and \mathbf for alphanumeric characters. Thus it would look something like

\def\vec#1{\ifthenelse{\ismathsymbol{#1}}{\bm{#1}}{\mathbf{#1}}


Problem is I don't know of a test such as \ismathsymbol. Obviously, it would be just fine if there were a test for alphanumeric characters.

• \newcommand\vec[1]{\mathbf{\bm{#1}}} – David Carlisle Jul 17 '15 at 0:56
• @DavidCarlisle And don't load amssymb? – cfr Jul 17 '15 at 1:35
• Math symbol vs text? You mean v, \nu, AB are math symbols but shift is text? How can TeX Tell the difference between the last two? – Symbol 1 Jul 17 '15 at 3:32