# how to change font-size of a tikz tree

Is there a possibility to change the font size of the text right on the line of the following tree? I would like to reduce it, so that the tree does not appear such big. I hope someone may help me. Thank you!!

\documentclass[a4paper, 12pt, oneside, titlepage]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{qtree}
\usepackage{tikz}
\usetikzlibrary{fit}
\usepackage{acronym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multirow,array}
\usepackage{colortbl}
\usepackage{anyfontsize}

\begin{document}

\begin{center}
\begin{tikzpicture}[
dot/.style={circle, fill=black, inner sep=0pt, minimum size=7pt},
ring/.style={circle, draw, inner sep=0pt, minimum size=7pt}
]

\node[dot,pin=90:{Spieler 1}] (n11) at (0,0) {};

\node[dot,pin=135:{Spieler 2}] (n21) at (-4,-1) {};
\node[ring] (n22) at (4,-1) {};

\node[dot,label=-90:{$(0,0)$}] (n31) at (-6,-4) {};
\node[ring] (n32) at (-2,-4) {};
\node[dot,label=-90:{$(-1,1)$}] (n33) at (2,-4) {};
\node[dot,pin=50:{Spieler 2}] (n34) at (6,-4) {};

\node[dot,label=-90:{$(1,-1)$}] (n41) at (-4,-7) {};
\node[dot,label=-90:{$(-2,2)$}] (n42) at (0,-7) {};
\node[ring] (n43) at (4,-7) {};
\node[dot,label=-90:{$(0.5,-0.5)$}] (n44) at (8,-7) {};

\node[dot,label=-90:{$(1,-1)$}] (n51) at (2,-10) {};
\node[dot,label=-90:{$(0,0)$}] (n52) at (6,-10) {};

\draw (n11) -- node[above,sloped] {passen} (n21);
\draw[dotted] (n11) -- node[above,sloped] {drehen} (n22);

\draw (n21) -- node[above,sloped] {passen} (n31);
\draw (n21) -- node[above,sloped] {drehen} (n32);
\draw (n22) -- node[above,sloped] {Schuss} node[below,sloped]{$\tfrac{1}{6}$} (n33);
\draw (n22) -- node[above,sloped] {kein Schuss} node[below,sloped]{$\tfrac{5}{6}$} (n34);

\draw (n32) -- node[above,sloped] {Schuss} node[below,sloped]{$\tfrac{1}{6}$} (n41);
\draw (n32) -- node[above,sloped] {kein Schuss} node[below,sloped]{$\tfrac{5}{6}$} (n42);
\draw[dotted] (n34) -- node[above,sloped] {drehen} (n43);
\draw (n34) -- node[above,sloped] {passen} (n44);

\draw (n43) -- node[above,sloped] {Schuss} node[below,sloped]{$\tfrac{1}{6}$} (n51);
\draw (n43) -- node[above,sloped] {kein Schuss} node[below,sloped]{$\tfrac{5}{6}$} (n52);
\end{tikzpicture}
\end{center}

\end{document}

• This looks like a very inefficient way to make a tree, you're doing everything manually. Anyway, you can set a new style like alongpath/.style={above, sloped, font=\tiny} or \scriptsize, then replace all your \node[above, sloped] ... with \node[alongpath] ... – Alenanno Feb 8 '16 at 17:20
• Thank you for your help! I do not have much experiences with latex and that is why everything is new for me. What I can do other? : ) – hpz1719 Feb 9 '16 at 16:49

Make font size of texz in nodes smaller is quit simple. Two possible solution cross my mind:

• define node style, something like edgenode/.style = {above,sloped,font=\small} and than named nodes accordingly, for example node[edgenode] {....}

• collect those nodes in scope, in it define above for every node inside scope.

Complete code for second option is:

\documentclass[a4paper, 12pt, oneside, titlepage]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{qtree}
\usepackage{tikz}
\usetikzlibrary{fit}
\usepackage{acronym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{multirow,array}
\usepackage{colortbl}
\usepackage{anyfontsize}

\begin{document}
\begin{center}
\begin{tikzpicture}[
dot/.style={circle, fill=black, inner sep=0pt, minimum size=7pt},
ring/.style={circle, draw, inner sep=0pt, minimum size=7pt}
]

\node[dot,pin=90:{Spieler 1}] (n11) at (0,0) {};

\node[dot,pin=135:{Spieler 2}] (n21) at (-4,-1) {};
\node[ring] (n22) at (4,-1) {};

\node[dot,label=-90:{$(0,0)$}] (n31) at (-6,-4) {};
\node[ring] (n32) at (-2,-4) {};
\node[dot,label=-90:{$(-1,1)$}] (n33) at (2,-4) {};
\node[dot,pin=50:{Spieler 2}] (n34) at (6,-4) {};

\node[dot,label=-90:{$(1,-1)$}] (n41) at (-4,-7) {};
\node[dot,label=-90:{$(-2,2)$}] (n42) at (0,-7) {};
\node[ring] (n43) at (4,-7) {};
\node[dot,label=-90:{$(0.5,-0.5)$}] (n44) at (8,-7) {};

\node[dot,label=-90:{$(1,-1)$}] (n51) at (2,-10) {};
\node[dot,label=-90:{$(0,0)$}] (n52) at (6,-10) {};

\begin{scope}[every node/.style={above,sloped,
font=\footnotesize% <-- desired size
}]
\draw (n11) -- node {passen} (n21);
\draw[dotted] (n11) -- node {drehen} (n22);

\draw (n21) -- node {passen} (n31);
\draw (n21) -- node {drehen} (n32);
\draw (n22) -- node {Schuss} node[below,sloped]{$\tfrac{1}{6}$} (n33);
\draw (n22) -- node {kein Schuss} node[below,sloped]{$\tfrac{5}{6}$} (n34);

\draw (n32) -- node {Schuss} node[below,sloped]{$\tfrac{1}{6}$} (n41);
\draw (n32) -- node {kein Schuss} node[below,sloped]{$\tfrac{5}{6}$} (n42);
\draw[dotted] (n34) -- node {drehen} (n43);
\draw (n34) -- node {passen} (n44);

\draw (n43) -- node {Schuss} node[below,sloped]{$\tfrac{1}{6}$} (n51);
\draw (n43) -- node {kein Schuss} node[below,sloped]{$\tfrac{5}{6}$} (n52);
\end{scope}
\end{tikzpicture}
\end{center}
\end{document}


• May I ask you another question? Do you know what I can do in that case? – hpz1719 Feb 8 '16 at 18:03
• You can ask me, of course, unfortunately, I do not understand you. Which case? In given link is some table. Regarding your decision tree, I would look trees library, if it is more convenient to you (with it you don't care about absolute coordinates). Many people here prefer to use forest package (I still not learn it .-( ...). Be more specific. – Zarko Feb 8 '16 at 18:13
• Sorry for my bad description : ). Well beside these trees here I do also need some payoff matrix. But the content of the cells in the matrix mentioned is not vertically centered and it disturbs me but I do not know how to fix it. I hope you see what I mean. I know that the matrix does not look very fine, but there is no other possibility I found. Thank you! – hpz1719 Feb 8 '16 at 18:19