命令 \nccurve 的问题

命令 \nccurve 的问题
\documentclass[12pt,a4paper]{article}
\usepackage{amsmath,amssymb}
\usepackage[utf8]{vietnam}
\usepackage{pstricks,pst-node} % required package
\usepackage{auto-pst-pdf} 
\begin{document}
\begin{pspicture}    
\psmatrix[linecolor=red,mnode=Circle,radius=3mm,colsep=1.25cm,rowsep=1.25cm]
   [name=2] 2 &  & [name=3] 3 \\
              &[name=5] 5 \\
   [name=1] 1 &  & [name=4] 4
\psset{linecolor=blue,arrowscale=1.5}

\ncline{->}{3}{2}
\ncline{->}{4}{3}
\ncline{->}{4}{5} 
\ncline{->}{5}{3}
\ncline{->}{5}{1}
\ncline{->}{1}{4}

\nccurve[angleA=80,angleB=25,ncurv=5]{->}{3}{3}

\ncarc[arcangle=22]{->}{1}{2}
\ncarc[arcangle=22]{->}{2}{1}
\endpsmatrix 

\end{pspicture}
\end{document}

如何绘制图片1就像图片2?(我明白了,2 比 1 更漂亮)

如何压缩\ncline或者我们只能手动输入?这意味着是否有类似的宏\ncline{->}{3}{2}{->}{4}{3}{->}{4}{5}...

图片1

enter image description here

图片2

enter image description here

图片2的代码(使用tikz)

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}
[every node/.style={circle,draw=red},
 every path/.style={blue,-latex,thick}]
\def\a{2}
\node (5) at (0,0) {$5$};
\node (1) at (-\a,-\a) {$1$};
\node (2) at (-\a,\a) {$2$};
\node (3) at (\a,\a) {$3$};
\node (4) at (\a,-\a) {$4$};
\draw (1)--(4); \draw (4)--(3);
\draw (3)--(2); \draw (5)--(3);
\draw (5)--(1); \draw (4)--(5);
\draw (2) to[out=-70,in=70] (1);
\draw (1) to[out=110,in=-110] (2);
\draw (3) .. controls +(80:1) and +(30:1) .. (3); % <<<---- notice!
\end{tikzpicture}
\end{document}

答案1

定义自己的宏并在循环中使用相对于 45 度的对称角度:

\documentclass{article}
\usepackage{pst-node} % required package
\usepackage{auto-pst-pdf} 

\makeatletter
\newcommand\NCline[3]{\ncline{#1}{#2}{#3}\@ifnextchar\bgroup\NCline{}}
\makeatother
\begin{document}
 \psmatrix[linecolor=red,mnode=Circle,radius=3mm,colsep=1.25cm,rowsep=1.25cm]
    [name=2] 2 &            & [name=3] 3 \\
               &[name=5] 5 \\
    [name=1] 1 &            & [name=4] 4
\psset{linecolor=blue,arrowscale=1.5}
\NCline{->}{3}{2}{->}{4}{3}{->}{4}{5}{->}{5}{3}{->}{5}{1}{->}{1}{4}
\nccurve[angleA=75,angleB=15,ncurv=6]{->}{3}{3}

\ncarc[arcangle=22]{->}{1}{2}
\ncarc[arcangle=22]{->}{2}{1}
\endpsmatrix 

\end{document}

enter image description here

相关内容