すべての太字の数式文字のルールを定義する

すべての太字の数式文字のルールを定義する

私は使用しています

\def\H{\bm{H}}

数式モードで太字の文字を定義する方法。一般的なルールを定義する方法はありますか?どれでも文字?私は許可するルールが欲しい

\*anyletters*{\bm{*anyletter}*
% For example \I -> \bm{I} etc....

答え1

次のコードは、アルファベットのすべての文字を実行するため\bmAに を定義します。 単一文字のマクロは特別な意味 (アクセント、特殊記号) を持つ傾向があるため、使用しないでください。\bm{A}A

\documentclass{article}
\usepackage{bm}
\makeatletter
\newcounter{letter}
\setcounter{letter}{1}
\@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}}}
  \stepcounter{letter}%
}
\makeatother
\begin{document}
Hungarian umlaut \H{o}

Polish suppressed-L \L

Scandinavian O-with-slash \O

pilcrow \P

section symbol \S

$\bmA \bmZ \bma \bmz$
\end{document}

ここに画像の説明を入力してください

関連情報