How to control font sizes in pgf / tikz to latex graphics?

I am creating graphics in pgf / tikz. When I use them in my document, they scale, some of them are in the environment of the mini-disk / subfig. When this happens, the font size is scaled with the graphics, which makes them very small or unreadable. I went through the leadership, but still have not been successful in my attempts to control this.

Is there a way to set the font size directly? What are the options?

The following is one of the tips below on how to use the \ tikzstyle font parameter to specify the font size in tikzpicture.

Now I am using:

\beginppgfgraphicnamed{graph} \input{graph.tex} \endpgfgraphicnamed 

The input file uses the tikzpicture environment. Do I need to specify the font size in the setting I'm using? Perhaps this is a problem? The graph.tex file is automatically generated through another program.

In addition to setting the font size for a single graphic, would it be ideal to have a parameter to globally set the font size for all tikz graphics? I think the problem is scaling in minipage or subfig.

Thank you very much,

Jay

+57
latex tikz pgf
Feb 10 2018-10-10
source share
5 answers
 \begin{tikzpicture} \tikzstyle{every node}=[font=\small] \end{tikzpicture} 

will give you control of the font size on each node.

+84
Feb 10 '10 at 16:35
source share

I found that the best control would be to use the scalefnt package:

 \usepackage{scalefnt} ... {\scalefont{0.5} \begin{tikzpicture} ... \end{tikzpicture} } 
+28
Nov 02 '10 at 9:27 a.m.
source share

I believe that the method of mica deserves the rank of an answer, since it is not sufficiently noticeable as a comment:

 \begin{tikzpicture}[font=\small] 
+15
Jun 15 '13 at 17:08
source share

You can also use:

 \usepackage{anyfontsize} 

The huge advantage of anyfontsize package over scalefnt is that you don’t need to embed the entire {tikzpicture} using the \scalefont environment.

Just adding \usepackage{anyfontsize} to the preamble is all that is required for the font scaling magic.

+1
Feb 20 '14 at 18:14
source share
 \begin{tikzpicture} \tikzstyle{every node}=[font=\fontsize{30}{30}\selectfont] \end{tikzpicture} 
0
Jul 12 '19 at 3:27
source share



All Articles