I want all the text in a tikzpicture
environment to be sans serif by using a every node/.style={font=\sffamily}
command:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{backgrounds,fit,decorations.pathreplacing,calligraphy}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}[inner sep = 0pt,
every node/.style={font=\sffamily}]
\node[regular polygon, regular polygon sides=6, draw, inner sep=1.2cm, shape border rotate=30] (q) at (0,0) {};
\node at (q.corner 1) (q1) {};
\node at (q.corner 4) (q4) {};
\node[font=\small,fill=white,align=center,minimum size=1.4cm,shift={(-.2,0)}] at (q.east) {subset \\ 2};
\node[regular polygon, regular polygon sides=6, draw, inner sep=2cm, shape border rotate=30] (p) at (0,0) {};
\node at (p.corner 1) (p1) {}; \node at (p.corner 2) (p2) {};
\node at (p.corner 3) (p3) {}; \node at (p.corner 4) (p4) {};
\node at (p.corner 5) (p5) {}; \node at (p.corner 6) (p6) {};
\draw (p2) -- (p5); \draw (p3) -- (p6);
\draw (p1) -- (q1); \draw (p4) -- (q4);
\node[circle,fill=white,draw=black,align=center,minimum size=.5cm] at (p1) {1};
\node[circle,fill=none,align=center,above] at (p1) {category 1};
\node[circle,fill=none,align=center,left] at (p3) {category 2};
\end{tikzpicture}
\end{document}
But not all parts of the resulting figure use sans serif font. Why does this happen and what do I need to add? (I want to use sffamily
for just this tikzpicture environment in my report, so I can't do this)
font=\sffamily
gets overwritten withfont=\small
. A straight-forward way would be to place\sffamily
before thetikzpicture
(and wrap everything in a group).