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?

  • 1
    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{tikzpicture}} – 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.

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

    \draw (0,0) -- (10ex,0);

    \draw (0,0) -- (10ex,0);

    \draw (0,0) -- (10ex,0);


enter image description here

  • how can I enter arbitrary values i.e. 10pt? – ted Jul 3 '13 at 11:44
  • 2
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.