# How to ensure equal font sizes in all included TikZ/pgfplots figures?

I would like to have many tikzpictures in my document. Since each tikzpicture has its own size, I don't know how to manage the font size among all the pictures. Some of tikzpictures are of size \textwidth, some are 0.5\textwidth, and some are 0.4\textwidth. Could someone help me find the best way to have all the font sizes of the ticks, labels, and texts of the picture the same size? When I look at the document, I don't see a consistency among the pictures. How can I standardize all the pictures? I would love to have other's opinions.

As an exmaple, suppose the following pictures.

As can be seen, there are different font size after scaling the tikzpicture to 0.5 and 1.0. For scale=0.5, it is hard to read the picture. Having said this, suppose there are two completely different pictures in a document. How should I force the font size of these two pictures the same? In my document, one picture has the x-axis range from 1 to 10 and another one is 2 to 3. In order to accomodate the picture for example I have to use 0.5\textwidth. I want to have for example the font size of the xtick and ytick to be the same for all the pictures in my document. I am looking for a way to achieve this goal.

-
Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Jubobs Mar 8 '13 at 9:17
Exactly how do you include your tikzpictures? They are standard having the TeX font size, so I highly doubt that you have inconsistent font sizes (unless you use the external library, or scale the pictures including nodes scaling???). Please provide a MWE which illustrates your problem. –  zeroth Mar 8 '13 at 9:18
You have to show us how you generated those figures, and do you use the external library? Note what has been posted in the answer, and in my previous comment, TikZ does not on its own change the font size. So you must be doing something else than \begin{document}\begin{tikzpicture}\begin{axis}...\end{axis}\end{tikzpicture}\e‌​nd{document}, and we need to see what, in order to help you. –  zeroth Mar 8 '13 at 9:51
I put the tikzpicture in my document by using \begin{figure} \centering \input{myTikZFile.tikz} \caption{} \label{fig:Asymm} \end{figure} –  A2009 Mar 8 '13 at 10:07

Based on the way you are creating such plots in your other posts, you can pass a width option to your axis command, which will scale the plot to the specified width without affecting the text.

% arara: pdflatex: { shell: yes }
\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.7}

\begin{document}

\begin{tikzpicture}
\begin{axis}[width=5cm,
axis on top,
xmin=-1, xmax=1,
ymin=-1, ymax=1,
view={0}{90},
xlabel = {$x$},
ylabel = {$\sigma$},
]
contour gnuplot = {contour label style={
nodes={text=black},
/pgf/number format/fixed,
/pgf/number format/fixed zerofill=true,
/pgf/number format/precision=1,}},
contour/draw color={black},
contour/label distance=1000pt,
]
{exp(-(x^2+y^2)};
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{axis}[width=5cm,
axis on top,
xmin=0, xmax=4,
ymin=0, ymax=3,
view={0}{90},
xlabel = {$x$},
ylabel = {$\sigma$},
]
contour gnuplot = {contour label style={
nodes={text=black},
/pgf/number format/fixed,
/pgf/number format/fixed zerofill=true,
/pgf/number format/precision=1,}},
contour/draw color={black},
contour/label distance=1000pt,
]
{exp(-(x^2+y^2)};
\end{axis}
\end{tikzpicture}

\end{document}

-
Note that pgfplots has some predefined styles like tiny or small which do not only choose a smaller width, they also change the fonts to \small, \footnotesize or whatever is suitable. These styles also reduce the distance of ticks etc. –  Christian Feuersänger Mar 8 '13 at 19:11

I'm not sure what you're talking about. One of the strengths of TikZ is that, unless you use transform canvas, consistency is maintained in terms of font size across all tikzpicture environments in the document. As an example:

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tabular}{cc}
\begin{tikzpicture}[scale=5]
\draw (0,0) rectangle (1,1);
\draw (.5,.5) node {hello};
\end{tikzpicture}
&
\begin{tikzpicture}[scale=3]
\draw (0,0) rectangle (1,1);
\draw (.5,.5) node {hello};
\end{tikzpicture}
\end{tabular}
\end{document}


You should post a minimal working example (MWE) that illustrates your problem clearly.

-
I make the PDF of each tikzpicture because some of them are time-consuming to be created (I use gnuplot for some of them). I then insert the PDF into my document and then use \textwidth to scale the picture to appropriate size. Please let me know if this explanation is not clear. –  A2009 Mar 8 '13 at 9:32
I don't use GNUplot myself, in part because I was raised on TikZ/PGF and in part because I've been told you quickly run into font-size issues with GNUplot. If you care about font-size consistency, I advise you to stick to TikZ/PGF as much as possible. And if some tikzpicture take too long to compile, you should build them on the side, in a different file, and add them at the last moment, when the rest of the document is ready. Alternatively, you can use the draft document-class option, which leaves pictures out of the document. –  Jubobs Mar 8 '13 at 9:40
You should not produce PDF of the tikzpicture and add them using \includegraphics with a different scale, or you're bound to run into scaling issues indeed. See my previous comment. –  Jubobs Mar 8 '13 at 9:53
@Ahmad this means that you use the external library! When you do that, you must not include them and rescale the pictures, your saved pdf must be in the size you want them to be. –  zeroth Mar 8 '13 at 9:53
@Ahmad You provided no minimal working example (MWE). I just assumed you were using one of the most common classes, such as article. –  Jubobs Mar 8 '13 at 10:16