有没有办法让这些 tikz-tree 变得更小?

有没有办法让这些 tikz-tree 变得更小?

我对我的 tikz-tree 确实有一个小问题,您可以在下面的照片中看到。如果您将它画在纸上,它会相当大,几乎占据了半张 A4 纸。现在我的问题是:是否有可能将树缩小?我尝试了不同的方法,但问题是文本,它仍然保持相同的大小。我唯一可以更改的是行上的文本。在那里我可以使用 \footnotesize 调整字体。但在我看来,这些尺寸仍然太大了。还有一些数字我应该缩小,但我真的不知道该怎么做。有没有办法让整个树变小,还是我必须接受这样的结果?感谢您的帮助!!

在此处输入图片描述

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

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

答案1

您可以将 添加scale=xxx到任何tikz-picture。只需确保也将比例添加到任何节点标签即可。由于您scope在此处使用 ,因此您必须第三次将其添加到此范围的节点。

% arara: pdflatex

\documentclass[12pt, oneside]{scrbook}
\usepackage[ngerman]{babel}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usepackage{mathtools}

\begin{document}    
\begin{center}
    \begin{tikzpicture}[%
        ,scale=.6
        ,every node/.style={scale=.6}
        ,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,scale=.6}]

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

答案2

如果您还想要较小的文本,这\scalebox似乎是最简单的解决方案。(语言选项在此处被注释为毫无意义):

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

\begin{document}

\begin{center}
\scalebox{0.8}{
\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}]

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

相关内容