减少Latex中节点标签的大小

时间:2018-05-21 20:30:58

标签: latex tikz

我有以下代码。我试图减少侧标签的大小以匹配节点内的标签(我不想增加内部标签的大小)。如果您有任何想法,请告诉我。感谢

\begin{tikzpicture}
[
    > = stealth, % arrow head style
    shorten > = 1pt, % don't touch arrow head to node
    auto,
    node distance = 2cm, % distance between nodes
    thick, dashed pattern=on % line style
    ]
    \tikzset{every state}=[
    draw = black,
    thick,
    fill = white,
    minimum size = 1mm
    ]


    \node[shape=circle,draw=black, label=right:$2$,scale=0.75] (4) at (0,0) {4};
    \node[shape=circle,draw=black, label=right:$5.75$, scale=0.75] (3) at (3,0.75) {3};
    \node[shape=circle,draw=black, label=right:$4.25$,scale=0.75] (2) at (2,4) {2};
    \node[shape=circle,draw=black, label=above:$7.75$,scale=0.75] (1) at (0,4) {1};

    \path [->] (1) edge node[left] {} (2);
    \path [->](2) edge node[left] {} (1);
    \path [->,draw, dotted, color=red](1) edge node[left] {} (4);
    \path [->,draw, dotted, color=red](4) edge node[left] {} (2);
    \path [->,draw, dotted, color=red](2) edge node[right] {} (3);
    \path [->,draw, dotted, color=red](3) edge node[left] {} (1);

\end{tikzpicture}

This is what I get

1 个答案:

答案 0 :(得分:0)

此代码有效。

  \begin{tikzpicture}
[
    > = stealth, % arrow head style
    shorten > = 1pt, % don't touch arrow head to node
    auto,
    node distance = 2cm, % distance between nodes
    thick, dashed pattern=on % line style
    ]

    \tikzset{every state}=[
    draw = black,
    thick,
    fill = white,
    minimum size = 1mm
    ]
\node[shape=circle,draw=black,label=right:$2$] (4) at (0,0) {4};
    \node[shape=circle,draw=black, label=right:$5.75$] (3) at (4.5,1.125) {3};
    \node[shape=circle,draw=black, label=right:$4.25$] (2) at (3,6) {2};
    \node[shape=circle,draw=black, label=above:$7.75$] (1) at (0,6) {1};


  \path [->] (1) edge node[left] {} (2);
    \path [->](2) edge node[left] {} (1);
    \path [->,draw, dotted, color=red](1) edge node[left] {} (4);
    \path [->,draw, dotted, color=red](4) edge node[left] {} (2);
    \path [->,draw, dotted, color=red](2) edge node[right] {} (3);
    \path [->,draw, dotted, color=red](3) edge node[left] {} (1);
\end{tikzpicture}