tikz 트리의 글꼴 크기를 변경하는 방법

tikz 트리의 글꼴 크기를 변경하는 방법

다음 트리의 줄에 있는 텍스트의 글꼴 크기를 변경할 수 있습니까? 나무가 그렇게 크게 보이지 않도록 줄여보고 싶습니다. 누군가가 나를 도울 수 있기를 바랍니다. 감사합니다!!

여기에 이미지 설명을 입력하세요

\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}

답변1

노드에서 texz의 글꼴 크기를 더 작게 만드는 것은 매우 간단합니다. 내 마음에는 두 가지 가능한 해결책이 있습니다.

  • edgenode/.style = {above,sloped,font=\small}그에 따라 노드 이름을 지정하는 것과 같은 노드 스타일을 정의합니다 . 예를 들어node[edgenode] {....}

  • 범위 내의 모든 노드에 대해 위에서 정의한 범위 내의 해당 노드를 수집합니다.

두 번째 옵션의 전체 코드는 다음과 같습니다.

\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}    

여기에 이미지 설명을 입력하세요

관련 정보