# Filling the space between two arcs between two nodes

I have the following code:

\begin{pspicture}(-1,-1)(2,2)
\psmatrix[rowsep=3cm,colsep=3cm,mnode=circle]
[name=A]A & [name=B]B
\endpsmatrix
\ncarc[arcangle=30]{A}{B} \naput{4}
\ncarc[liftpen=2,arcangle=30]{B}{A}\naput{5}
\end{pspicture}


How do I solidly fill in the central part between the 4 and the 5? adding a fill to the individual arcs will not give the correct result.

• Welcome to TeX.SX. Please add a full MWE, we can copy to our editors. – MaestroGlanz May 24 '16 at 22:15

\documentclass{article}
\usepackage{pst-node}
\begin{document}

\begin{pspicture}(-1,-2)(4,3)
\pnodes(0,0){A}(3,0){B}
\psset{arcangle=30}
\pscustom[fillstyle=solid,fillcolor=black!20,linestyle=none]{
\ncarc{A}{B}\ncarc{B}{A}
}
\pcarc(A)(B)\naput{4} \pcarc(B)(A)\naput{5}
\cnodeput[fillstyle=solid,fillcolor=white](A){A}{A}
\cnodeput[fillstyle=solid,fillcolor=white](B){B}{B}
\end{pspicture}

\end{document}


You can add a \pscustom command:

\documentclass[x11names]{standalone}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{ebgaramond}
\usepackage{array}
\usepackage{auto-pst-pdf}
\psset{unit = 2,dotsize = 2.5pt}

\begin{document}

\begin{pspicture}(-1,-1)(2,2)
\psmatrix[rowsep=3cm,colsep=3cm,mnode=circle]
[name=A]A & [name=B]B
\endpsmatrix
\ncarc[arcangle=30]{A}{B} \naput{4}
\ncarc[liftpen=2,arcangle=30]{B}{A}\naput{5}
\pscustom[fillstyle =solid,  fillcolor=Thistle3!30]{\ncarc[arcangle=30]{A}{B}\psarc(B){0.137}{150}{212}
\ncarc[arcangle=30]{B}{A}\psarc(A){0.145}{-30}{32}}
\end{pspicture}

\end{document}


• I suppose the arc radius could be preset to some fixed value to simplify that part, but is there a way to automatically determine the angles that \psarc needs? Or perhaps the arcs could be drawn to pnodes, filled, and then plop the circles on top. – cat May 25 '16 at 2:08
• For the arc radius, I'm afraid not: the circle radii are determined by the length framesep and depend on the dimensions of the box containing the text – which are variable. The angles should . The solution with pnodesbe ±arcangle mod 2π, but we need a small correction, due to the lines width. The solution with pnodes is a good solution. It is Herbert's solution, it seems (I didn't look into the details). – Bernard May 25 '16 at 9:12

I would draw the arc-fill first (using \pscustom), and then overlay the two end circles, each having a white fill to remove the end-points of the arc-fill:

\documentclass{article}

\usepackage{pst-node}

\begin{document}

\begin{pspicture}
\pnode(0,0){A}% Identify node A
\pnode(3cm,0){B}% Identify node B
\ncarc[arcangle=30]{A}{B}\naput{4}% Place arc labels
\ncarc[arcangle=30]{B}{A}\naput{5}
\pscustom[fillstyle=solid, fillcolor=black!10]{
\ncarc[arcangle=30]{A}{B}% Place arcs and fill
\ncarc[arcangle=30]{B}{A}
}
\pscircle[fillcolor=white,fillstyle=solid](A){3mm}% Place circles
\pscircle[fillcolor=white,fillstyle=solid](B){3mm}
\rput(A){A}\rput(B){B}% Place circle labels
\end{pspicture}

\end{document}

• It makes no sense to have the \naput in \pscustom – user2478 May 25 '16 at 7:04
• @Herbert: Sorry, that was left over from my trials; removed. – Werner May 25 '16 at 13:34