:
\newcommand{\b}[1]{\mathbf{
as Crowley says, and similar for all other alphabets. However, if you really want to do this with LaTeX code, it seems to work here:
\documentclass{article}
\usepackage{amssymb}
\newcounter{char}
\setcounter{char}{1}
\loop\ifnum\value{char}<27
\edef\c{\Alph{char}}
\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\csname\expandafter\expandafter\expandafter b\expandafter\c\expandafter\endcsname\expandafter{\expandafter\mathbb\expandafter{\c}}
\addtocounter{char}{1}
\repeat
\begin{document}
\(\bZ\)
\end{document}
I lost track of how much "expands after that!" To get lowercase letters, replace Alph with a letter.
source
share