I have been using


to define bold letters in math mode. Is there a way I can define a general rule for any letters? Like I want a rule that allow

% For example \I -> \bm{I} etc....
  • 1
    just letters or do you want the whole expression bold, in which case \boldmath $ x+y$ Feb 6 '16 at 23:16

The following code defines \bmA to be \bm{A} for A running over all letters in the alphabet. Please do not use single letter macros, as these tend to have special meaning (accents, special symbols).

\@whilenum\value{letter}<27\do{% loop over all letters in the alphabet
  % \def\bmA{\bm{A}}, where A runs over all letters
  %   Remove letters `bm'  vv  if you don't care about breaking LaTeX
  \expandafter\edef\csname bm\Alph{letter}\endcsname{\noexpand\bm{\Alph{letter}}}
  \expandafter\edef\csname bm\alph{letter}\endcsname{\noexpand\bm{\alph{letter}}}
Hungarian umlaut \H{o}

Polish suppressed-L \L

Scandinavian O-with-slash \O

pilcrow \P

section symbol \S

$\bmA \bmZ \bma \bmz$

enter image description here

  • returning after about a year - how do you make the same rule for lower case as well? Jan 23 '17 at 23:13
  • 2
    @QuangThinhHa Just add another line in the loop, substituting \Alph by \alph for lowercase letters. See updated answer. Jan 24 '17 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.