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 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}
-
-
2Well 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
\begin{tikzpicture}[every node/.style={font=\footnotesize}]
. (Or whatever size you need.) – Count Zero Jul 3 '13 at 9:52\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 likerenewenviornment{tikzpicture}{\setFontSizeMagically\begin{tikzpicture}}{\end{tikzpicture}}
– ted Jul 3 '13 at 10:12