# set fontsize for TikZ figure

I have made many figures with tikz and want to include them in a template. Unfortunately I used ex as a measure and the template I have to use redefines the font size. THis leads to wrong distances in the figures. is there a way to set the font size for all tikz figures in a document, so I do not have to adjust my figures?

-
You could use \begin{tikzpicture}[every node/.style={font=\footnotesize}]. (Or whatever size you need.) –  Count Zero Jul 3 '13 at 9:52
@CountZero: the problem is not with the text size but with mixing e.g. \draw (3,3) -- (2ex,0); (its not mixed that directly but i place some nodes at e.g. (0,0) add text above and want to draw a line above that. since I did quite a lot, I dont want to adjust the figures, I would rather to do something like renewenviornment{tikzpicture}{\setFontSizeMagically\begin{tikzpicture}}{\end{ti‌​kzpicture}} –  ted Jul 3 '13 at 10:12

You can enforce a font command at the start of each picture which would make the fontsize consistent.

\documentclass{article}
\usepackage{tikz}
\tikzset{every picture/.style={font issue=\footnotesize},
font issue/.style={execute at begin picture={#1\selectfont}}
}

\begin{document}
\begin{tikzpicture}[baseline]
\draw (0,0) -- (10ex,0);
\end{tikzpicture}A

\Huge
\begin{tikzpicture}[baseline]
\draw (0,0) -- (10ex,0);
\end{tikzpicture}A

\tiny
\begin{tikzpicture}[baseline]
\draw (0,0) -- (10ex,0);
\end{tikzpicture}A

\end{document}


-
how can I enter arbitrary values i.e. 10pt? –  ted Jul 3 '13 at 11:44
Well arbitrary is not possible in TeX if the fonts do not support but I think you are aware of it, so you can use font issue={\fontsize{10}{12}} above. –  percusse Jul 3 '13 at 11:51
thanks a lot, works like a charm. For thosw hwo are unaware as I was about selecting arbitrary font sizes, this awnser is a good read. –  ted Jul 3 '13 at 11:56