TikZ Styles that set Nodepart Styles
You can choose the font for a node part by using the normal TikZ key font=<font switch like \bfseries>
. Note that the default Computer Modern font does not have a bold typewriter font. You can use the Courier font for that (see Using \ttfamily with \bfseries (or how to enable bold in fixed-width font)).
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usetikzlibrary{arrows}
\usetikzlibrary{calc}
\usepackage{aeguill}
\newcommand*{\stereotype}[1]{
\guillemotleft {#1}\guillemotright%
}
\tikzset{class or interface/.style={%
draw,%
shape=rectangle split,%
rectangle split parts=3,%
rectangle split part align={center,left,left},%
rectangle split part fill={#1!30!white,#1!20!white,#1!10!white},
every two node part/.style={align=center, font=\ttfamily},
every three node part/.style={align=left, font=\ttfamily},
node distance=2
},
interface/.style={
class or interface=green,
every one node part/.style={align=center, font=\ttfamily\itshape}
},
concrete class/.style={
class or interface=red,
every one node part/.style={align=center, font=\ttfamily\bfseries}
}
}
\newtheorem{exercise}{Exercise}
\begin{document}
\renewcommand{\ttdefault}{pcr} % Choose typewriter font that supports bold
%
%
\begin{frame}[fragile]
\frametitle{Class Diagram of the Observer Pattern}
\begin{tikzpicture}]
\path (0,0) node(Subject)[interface,anchor=east]
{\nodepart{one}
\stereotype{interface}\\
Subject
\nodepart{two}
\nodepart{three}\tabular{@{}l}
attach( Observer o )\\
detach( Observer o )\\
notify( )
\endtabular}
(Subject.south)
+(+0.0,-1.5)node(ConcreteSubject)[concrete class,anchor=north]
{\nodepart{one}
ConcreteSubject
\nodepart{two}
Observer[] observers
\nodepart{three}\tabular{@{}l}
attach( Observer o )\\
detach( Observer o )\\
notify( )
\endtabular};
\end{tikzpicture}
\end{frame}
%
%
\end{document}