Is it possible to append switches to the existing settings for the TikZ font
key?
For example, suppose that I want all nodes to be in the \sffamily
typeface. This can be done by setting every node/.append style={font=\sffamily}
. I might later wish to have a node that inherits the every node
font
settings and, additionally, uses the italic shape \itshape
. Unfortunately, as the following shows, it does not work to simply add font=\itshape
; doing so overrides the previous font
setting, and the default type family (in italic) is used.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.append style={font=\sffamily}]
\node {Sans serif};
\node [font=\itshape] at (3,0) {Sans serif, italic};
\end{tikzpicture}
\end{document}
Digging through the manual, I found the <key>/.append
handler, which looked promising.
Key handler
<key>/.append={<append value>}
Adds the<append value>
at the end of the value stored in<key>
.
What if I used font/.append=\itshape
? Well, this does not work either:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.append style={font=\sffamily}]
\node {Sans serif};
\node [font/.append=\itshape] at (3,0) {Sans serif, italic};
\end{tikzpicture}
\end{document}
Thus, I have two questions:
- Why does
font/.append=\itshape
not work here? - How can I append switches to the existing settings for
font
?