关于与 w1' 节点关联的循环箭头,我需要具有指定半径的完美圆形。我该怎么做?非常感谢!
\documentclass[a4paper,twoside,10pt]{memoir}
\usepackage{alphabeta}
\def\eng#1{\textlatin{#1}}
\usepackage{textcase}
\usepackage{silence}
\usepackage{kerkis}
\usepackage{color}
\usepackage[svgnames,x11names,named]{xcolor}
\WarningFilter*{mdframed}{You got a bad break}
\WarningFilter{latex}{Text page}
\usepackage[usetwoside]{mdframed}
\usepackage[LGR,T1]{fontenc}
\usepackage{anyfontsize}
\usepackage{lipsum}
\usepackage {tikz}
\usetikzlibrary {positioning,graphs,calc,decorations.pathmorphing,shapes,arrows.meta,arrows}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{systeme}
\usepackage{wrapfig}
\usepackage{afterpage}
\usepackage{tocloft}
\usepackage[figuresright]{rotating}
\usepackage{parskip}
\usepackage{caption}
\usepackage{enumitem}
\usepackage{titletoc}
\usepackage{calc}
\usepackage{pstricks}
\usepackage{bbm}
\usepackage{textcomp}
\usepackage{upgreek}
\usepackage{ifthen}
\usepackage{extramarks}
\usepackage{bm}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{colortbl}
\usepackage[symbol]{footmisc}
\begin{document}
\begin{center}
\tikzset{every loop/.style={min distance=15mm,looseness=10}}
\begin{tikzpicture}[-latex ,auto ,node distance =3cm and 4cm, on grid,semithick ,
state/.style ={circle, draw, color=black, fill=black, minimum width =4pt}]
\node[state] (w4) [label=above:$w4$] {};
\node[state] (w2) [below left=of w4][label=below:$w2$] {};
\node[state] (w1) [right =of w2] [label=above:$w1$] {};
\node[state,yshift=1cm] (w3) [below =of w2] [label=below:$w3$] {};
\node[state,xshift=3cm] (w1') [right =of w4] [label=right:$w1'$] {};
\node[state,xshift=3cm] (w2') [right =of w1] [label=below:$w2'$] {};
\path (w1') edge [loop above] node[left] {} (w1');
\path (w1') edge node {} (w2');
\path (w1) edge [bend left = 25] node {} (w3);
\path (w1) edge [bend left = -25] node {} (w2);
\path (w2) edge [bend left = -25] node {} (w1);
\path (w2) edge [bend left = 25] node {} (w4);
\path (w1') edge [bend left = 25,color=red,dashed] node[xshift=-1cm,yshift=-0.35cm] {$\bm{f_1}$} (w1);
\path (w2') edge [bend left = 25,color=red,dashed] node {$\bm{f_1}$} (w3);
\path (w1') edge [bend left = -15,color=blue,dashed] node[yshift=0.65cm] {$\bm{f_2}$} (w2);
\path (w2') edge [bend left = 25,color=blue,dashed] node [yshift=0.8cm] {$\bm{f_2}$} (w4);
\end{tikzpicture}
\end{center}
\end{document}
答案1
你可以画一个圆弧,上面有一个弯曲的箭头。(我利用这个机会将包和库精简为相关的部分。)
\documentclass[svgnames,x11names,border=3.14mm]{standalone}
\usepackage{bm}
\usepackage{tikz}
\usetikzlibrary{positioning}
% from https://tex.stackexchange.com/a/430239/121799
\usetikzlibrary{arrows.meta,bending,decorations.markings} %< added
\tikzset{% inspired by https://tex.stackexchange.com/a/316050/121799
arc arrow/.style args={%
to pos #1 with length #2}{
decoration={
markings,
mark=at position 0 with {\pgfextra{%
\pgfmathsetmacro{\tmpArrowTime}{#2/(\pgfdecoratedpathlength)}
\xdef\tmpArrowTime{\tmpArrowTime}}},
mark=at position {#1-\tmpArrowTime} with {\coordinate(@1);},
mark=at position {#1-2*\tmpArrowTime/3} with {\coordinate(@2);},
mark=at position {#1-\tmpArrowTime/3} with {\coordinate(@3);},
mark=at position {#1} with {\coordinate(@4);
\draw[-{Latex[length=#2,bend]}]
(@1) .. controls (@2) and (@3) .. (@4);},
},
postaction=decorate,
}
}
\begin{document}
\tikzset{every loop/.style={min distance=15mm,looseness=10}}
\begin{tikzpicture}[-latex ,auto ,node distance =3cm and 4cm, on grid,semithick ,
state/.style ={circle, draw, color=black, fill=black, minimum width =4pt}]
\node[state] (w4) [label=above:$w4$] {};
\node[state] (w2) [below left=of w4][label=below:$w2$] {};
\node[state] (w1) [right =of w2] [label=above:$w1$] {};
\node[state,yshift=1cm] (w3) [below =of w2] [label=below:$w3$] {};
\node[state,xshift=3cm] (w1') [right =of w4] [label=right:$w1'$] {};
\node[state,xshift=3cm] (w2') [right =of w1] [label=below:$w2'$] {};
\draw[-,arc arrow=to pos 0.525 with length 2mm] ([yshift=-2pt]w1'.north) arc(-90:270:1);
%\path (w1') edge [loop above] node[left] {} (w1');
\path (w1') edge node {} (w2');
\path (w1) edge [bend left = 25] node {} (w3);
\path (w1) edge [bend left = -25] node {} (w2);
\path (w2) edge [bend left = -25] node {} (w1);
\path (w2) edge [bend left = 25] node {} (w4);
\path (w1') edge [bend left = 25,color=red,dashed] node[xshift=-1cm,yshift=-0.35cm] {$\bm{f_1}$} (w1);
\path (w2') edge [bend left = 25,color=red,dashed] node {$\bm{f_1}$} (w3);
\path (w1') edge [bend left = -15,color=blue,dashed] node[yshift=0.65cm] {$\bm{f_2}$} (w2);
\path (w2') edge [bend left = 25,color=blue,dashed] node [yshift=0.8cm] {$\bm{f_2}$} (w4);
\end{tikzpicture}
\end{document}