# Consistent font size when using standalone TikZ pictures in a beamer presentation

I want to include a TikZ picture in a beamer presentation using the standalone package and I want a consistant size of the text in the picture and the rest of the frame.

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{standalone}

\usepackage{pgfplots}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}

\begin{document}
\begin{frame}[plain]{A frame}
\includestandalone[mode=tex,height=0.4\textwidth,keepaspectratio]{pic}
At some time $t$ there is a $\pi$ pulse along $z$\dots

{\footnotesize This is some small text.}
\end{frame}
\end{document}


This is pic.tex:

\documentclass[beamer]{standalone}

\usepackage{pgfplots}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}

\begin{document}
\begin{tikzpicture}[
scale=0.5,
wave/.style={decorate, decoration={snake,amplitude=0.6mm,segment length=2mm,post length=1.3mm}, ->, thick,->,>=stealth},
coordaxis/.style={->}
]

\draw[coordaxis] (0,0) -- +(1.5,0) node[midway,below] {\footnotesize $t$};
\draw[coordaxis] (0,0) -- +(0,1.5) node[midway,left] {\footnotesize $z$};

\draw[wave] (2,2) -- +(0,2) node[midway, right] {$\pi$};

\end{tikzpicture}
\end{document}


As you can see the font sizes are not consistent, i.e. normal and footnote sized symbols have different sizes within the picture and the rest of the text in the frame. How can I make the font sizes consistent?

Edit: Also, upon compiling TeXLive throws a warning that I don't know how to interpret:

/usr/share/texmf-dist/tex/latex/standalone/standalone.sty:259: File stack underflow! on input line 259.
./presentation.tex:8: File stack underflow! on line 8.

-
The cure may be worse than the disease. To force that, you can create pic.tex using \footnotesize text in it, but more importantly, when you import it, you must not scale the imported image with a modifier such as ,height=0.4\textwidth. In that way, uniform text size can be achieved. – Steven B. Segletes Feb 17 '14 at 19:41

If you want uniform size for fonts, then you have to remove the optional arguments \includestandalone[mode=tex,height=0.4\textwidth,keepaspectratio]{pic}. By specifying height=0.4\textwidth,keepaspectratio you are actually magnifying the image as told by Steven. Further, I have used the key font to declare normalsize for fonts. Change it if you want.

\documentclass{beamer}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{standalone}
\usepackage{filecontents}
\begin{filecontents*}{pic.tex}
\documentclass{standalone}

\usepackage{pgfplots}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}

\begin{document}
\begin{tikzpicture}[
scale=0.5,
wave/.style={decorate, decoration={snake,amplitude=0.6mm,segment length=2mm,post length=1.3mm}, ->, thick,->,>=stealth},
coordaxis/.style={->}
]

\draw[coordaxis] (0,0) -- +(1.5,0) node[midway,below,font=\normalsize] {$t$};      %% font key here
\draw[coordaxis] (0,0) -- +(0,1.5) node[midway,left,font=\normalsize] {$z$};      %% font key here

\draw[wave] (2,2) -- +(0,2) node[midway, right,font=\normalsize] {$\pi$};      %% font key here

\end{tikzpicture}
\end{document}
\end{filecontents*}

\usepackage{pgfplots}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations}

\begin{document}
\begin{frame}[plain]{A frame}
\includestandalone{pic}
At some time $t$ there is a $\pi$ pulse along $z$\dots

{\footnotesize This is some small text.}
\end{frame}
\end{document}


On the other hand, if you want bigger images with normal font size, simply change the coordinates in your tikzpicture like:

\draw[coordaxis] (0,0) -- +(6.5,0)...

-