Change default font within all tikzpicture environments

Here is a simple solution (if you don't already use every picture style). Add the following line in your preamble:

\tikzset{every picture/.style={/utils/exec={\sffamily}}}

Example:

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\tikzset{every picture/.style={/utils/exec={\sffamily}}}
\begin{document}
\begin{tikzpicture}
  \node [font=\sffamily\itshape] {I should be in sans italic or sans oblique};
  \node [font=\itshape,below] {I should be in sans italic or sans oblique};
\end{tikzpicture}
\end{document}

This changes the definition of the TikZ font option and adds an additional base font option. It is (almost) completely untested. It is probably extremely fragile. It may cause your cat to do as you say or otherwise destroy the world as you know it.

Caveat emptor

\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\makeatletter
\tikzoption{base font}{\def\tikz@base@textfont{#1}}
\tikzoption{font}{\def\tikz@textfont{\tikz@base@textfont#1}}
\tikzset{
  base font=\sffamily,
}
\makeatother
\begin{document}
\begin{tikzpicture}
  \node [font=\sffamily\itshape] {I should be in sans italic or sans oblique};
  \node [font=\itshape, below] {I should be in sans italic or sans oblique};
\end{tikzpicture}
\end{document}

all sans

Tags:

Fonts

Tikz Pgf