答案1
好吧,对于起点(作为众多可能的解决方案之一)可以提供以下 MWE:
\documentclass[border=3mm,tikz]{standalone}
\usetikzlibrary{arrows,automata,positioning}
\begin{document}
\begin{tikzpicture}[
node distance=12mm,
>=stealth, auto,
every state/.style={draw=none, inner sep=0pt}
]
\node[state] (q14) {$14$};
\node[state] (q12) [above right=of q14] {$12$};
\node[state] (q23) [below right=of q12] {$23$};
\node[state] (q34) [below right=of q14] {$34$};
\begin{scope}[bend left]%
\path[->] (q14) edge node {c} (q12)
(q12) edge node {c} (q23)
(q23) edge node {c} (q34)
(q34) edge node {c} (q14);
\end{scope}
\end{tikzpicture}
\begin{tikzpicture}[
node distance=12mm,
>=stealth, auto,
every state/.style={draw=none}
]
\node[state] (q12) {$14$};
\node[state] (q24) [below=of q12] {$34$};
\begin{scope}[bend left]%
\path[->] (q12.south east) edge node {c} (q24.north east)
(q24.north west) edge node {c} (q12.south west);
\end{scope}
\end{tikzpicture}
\end{document}
答案2
答案3
无论如何,这里介绍如何在 Asymptote 中绘制图表。
% file: foo.tex
% to compile: pdflatex --shell-escape foo
%
% For MikTeX users: Asymptote requires a separate program that cannot be installed
% by the package manager. You can get the installation file from
% https://sourceforge.net/projects/asymptote/files/2.35/
% (specifically, the file ending in setup.exe).
\documentclass{standalone}
\usepackage{asypictureB}
\begin{asyheader}
settings.outformat = "pdf";
\end{asyheader}
\begin{document}
\begin{asypicture}{name=cycles}
import flowchart;
unitsize(1cm);
block northnode = rectangle("$12$", center=N, drawpen=invisible);
block eastnode = rectangle("$23$", center=E, drawpen=invisible);
block southnode = rectangle("$34$", center=S, drawpen=invisible);
block westnode = rectangle("$14$", center=W, drawpen=invisible);
draw(northnode);
draw(eastnode);
draw(southnode);
draw(westnode);
real anglefudge = 10; // shift 10 degrees away from straight right, down, etc.
add(new void(picture pic, transform t) {
draw(pic, northnode.right(t) {dir(0-anglefudge)} .. {dir(-90+anglefudge)} eastnode.top(t),
L=Label("$c$", align=LeftSide),
arrow=Arrow(TeXHead));
draw(pic, eastnode.bottom(t) {dir(-90-anglefudge)} .. {dir(180+anglefudge)} southnode.right(t),
L=Label("$c$", align=LeftSide),
arrow=Arrow(TeXHead));
draw(pic, southnode.left(t) {dir(180-anglefudge)} .. {dir(90+anglefudge)} westnode.bottom(t),
L=Label("$c$", align=LeftSide),
arrow=Arrow(TeXHead));
draw(pic, westnode.top(t) {dir(90-anglefudge)} .. {dir(0+anglefudge)} northnode.left(t),
L=Label("$c$", align=LeftSide),
arrow=Arrow(TeXHead));
});
currentpicture = shift(-3, 0) * currentpicture;
block topnode = rectangle("$13$", center=(0,1), drawpen=invisible);
block bottomnode = rectangle("$24$", center=(0,-1), drawpen=invisible);
draw(topnode);
draw(bottomnode);
real angleshift = 20;
real positionshift = 0.2;
add(new void(picture pic, transform t) {
draw(pic,
topnode.position(0.5+positionshift,t) {dir(-90+angleshift)}
.. {dir(-90-angleshift)} bottomnode.position(2.5-positionshift,t),
L=Label("$c$", align=LeftSide),
arrow=Arrow(TeXHead));
draw(pic,
bottomnode.position(2.5+positionshift,t) {dir(90+angleshift)}
.. {dir(90-angleshift)} topnode.position(0.5-positionshift,t),
L=Label("$c$", align=LeftSide),
arrow=Arrow(TeXHead));
});
\end{asypicture}
\end{document}