Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
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

1 Answer 1

up vote 11 down vote accepted

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}

enter image description here

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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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