
% Taken from macros22, 28/01/2007
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{Ppicture}

% Do not forget the command \psset{unit=.3cm} 

\usepackage{graphics}\usepackage{epic}
\usepackage{pstricks,pst-coil,pst-node}


\newlength{\xinitcoord}\newlength{\yinitcoord} \newlength{\xfincoord} \newlength{\yfincoord}
\newlength{\xfloatlength} \newlength{\yfloatlength}

% \arrowline{xinit}{yinit}{xfin}{yfin}
\newcommand\arrowline[4]{\psline(#1,#2)(#3,#4) 
\pssetlength{\xinitcoord}{#1} \pssetlength{\yinitcoord}{#2} \pssetlength{\xfincoord}{#3} \pssetlength{\yfincoord}{#4}
\pssetlength{\xfloatlength}{.5\xfincoord} \psaddtolength{\xfloatlength}{.5\xinitcoord} 
\pssetlength{\yfloatlength}{.5\yfincoord} \psaddtolength{\yfloatlength}{.5\yinitcoord}
\psline[arrowsize=2pt 8,arrowlength=.5,arrowinset=.7]{->}(#1,#2)(\xfloatlength ,\yfloatlength)
}

% \bigarrowto{xinit}{yinit}{xfin}{yfin}
\newcommand\bigarrowto[4]{
\pssetlength{\xinitcoord}{#1} \pssetlength{\yinitcoord}{#2} \pssetlength{\xfincoord}{#3} \pssetlength{\yfincoord}{#4}
\pssetlength{\xfloatlength}{.25\xfincoord} \psaddtolength{\xfloatlength}{.75\xinitcoord} 
\pssetlength{\yfloatlength}{.25\yfincoord} \psaddtolength{\yfloatlength}{.75\yinitcoord}
\psline[arrowsize=2pt 8,arrowlength=1,arrowinset=.3]{->}(#1,#2)(\xfloatlength ,\yfloatlength)
\psline(\xfloatlength ,\yfloatlength)(#3,#4)
}

% \bigarrowfrom{xinit}{yinit}{xfin}{yfin}
\newcommand\bigarrowfrom[4]{
\pssetlength{\xinitcoord}{#1} \pssetlength{\yinitcoord}{#2} \pssetlength{\xfincoord}{#3} \pssetlength{\yfincoord}{#4}
\pssetlength{\xfloatlength}{.25\xfincoord} \psaddtolength{\xfloatlength}{.75\xinitcoord} 
\pssetlength{\yfloatlength}{.25\yfincoord} \psaddtolength{\yfloatlength}{.75\yinitcoord}
\psline[arrowsize=2pt 8,arrowlength=1,arrowinset=.3]{-<}(#1,#2)(\xfloatlength ,\yfloatlength)
\psline(\xfloatlength ,\yfloatlength)(#3,#4)
}

% \mycoil{textposition}{text}
\newcommand \mycoil[2]{\pscoil[coilarm=0,linewidth=.05,coilaspect=0,coilwidth=.4,
coilheight=1.2](2.2,0) \rput[#1]{*0}(2.5,0){$#2$}}

% \thecoil(a,b)(c,d)
\newcommand \thecoil{\pscoil[coilarm=0,linewidth=.05,coilaspect=0,coilwidth=.4,
coilheight=1.2]}

% \mypoles{length}
\newcommand \mypoles[1]{\psdots[dotstyle=o,dotscale=1.5](0,0)
\psline[linestyle=dashed,dash=3pt 2pt](.15,0)(#1,0)}

% \mycut{length}
\newcommand \mycut[1]{\psdots[dotstyle=o,dotscale=1.5](0,0)
\pscoil[coilarm=0,linewidth=.03,coilaspect=0,coilwidth=.4, 
coilheight=1.2](.15,0)(#1,0) }

\newlength{\floatlength}

% \extline{textposition}{text}
\newcommand \extline[2]{\psline[linewidth=.1](2.2,0)\rput[#1]{*0}(2.5,0){$#2$}}

% \intline{textposition}{text}{length}
\newcommand \intline[3]{\pcline[linewidth=.1](0,0)(#3,0)
\pssetlength{\floatlength}{#3} \pssetlength{\floatlength}{.5\floatlength}
\rput[#1]{*0}(\floatlength,0.3){$#2$}}

% \mybdy{textposition}{text}{length}
\newcommand \mybdy[3]{\pcline[linewidth=.22](0,0)(#3,0)
\pssetlength{\floatlength}{#3} \pssetlength{\floatlength}{.5\floatlength}
\rput[#1]{*0}(\floatlength,0.3){$\scriptstyle #2$}}

% \bdy{length}
\newcommand\bdy[1]{\pspolygon[linecolor=white,fillstyle=hlines,hatchwidth=.5pt,hatchsep=2pt]
(0,0)(#1,0)(#1,-.3)(0,-.3) 
\pcline(0,0)(#1,0)}

% \degfield{textposition}{text}
\newcommand \degfield[2]{\psdots[dotscale=1.5,dotstyle=*](0,0)
\rput[#1]{*0}(0.4,0.4){$#2$}}

% \genfield{textposition}{text}
\newcommand \genfield[2]{\psdots[dotscale=1.8,dotstyle=+,dotangle=45](0,0)
\rput[#1]{*0}(0.4,0.4){$#2$}}

% Liouville blocks with two degenerate fields

\newcommand \blockverl[7]{
% \pspicture[](-3,-3)(3,3)
\rput[l]{20}(0,2.5){\extline{l}{#1}}
\rput[l]{160}(0,2.5){\extline{r}{#2}}
\rput[l]{-20}(0,-2.5){\extline{l}{#3}}
\rput[l]{-160}(0,-2.5){\extline{r}{#4}}
\rput[l]{180}(2.2,1.5){\mycoil{r}{\scriptstyle #5}}
\rput[l]{180}(2.2,-1.5){\mycoil{r}{\scriptstyle #6}}
\rput[l]{90}(0,-2.5){\intline{r}{#7}{5}}
%\endpspicture
}

\newcommand \blockhorl[7]{
%\pspicture[](-5,-3)(5,2.8)
\rput[l]{70}(2.5,0){\extline{l}{#3}}
\rput[l]{-70}(2.5,0){\extline{l}{#4}}
\rput[l]{110}(-2.5,0){\extline{r}{#1}}
\rput[l]{-110}(-2.5,0){\extline{r}{#2}}
\rput[l]{-90}(1.5,2.2){\mycoil{t}{\scriptstyle #6}}
\rput[l]{-90}(-1.5,2.2){\mycoil{t}{\scriptstyle #5}}
\rput[l]{180}(2.5,0){\intline{t}{#7}{5}}
%\endpspicture
}

% Blocks in H3 or any other theory

\newcommand \blockhorh[7]{
%\pspicture[](-5,-3)(5,2.8)
\rput[l]{70}(2.5,0){\extline{l}{#4}}
\rput[l]{-70}(2.5,0){\extline{l}{#3}}
\rput[l]{110}(-2.5,0){\extline{r}{#1}}
\rput[l]{-110}(-2.5,0){\extline{r}{#2}}
\rput[br]{0}(2.5,.3){$\scriptstyle #6$}
\rput[bl]{0}(-2.5,.3){$\scriptstyle #5$}
\rput[l]{180}(2.5,0){\intline{t}{#7}{5}}
%\endpspicture
}

\newcommand \blockverh[5]{
%\pspicture[](-3,-3)(3,3)
\rput[l]{20}(0,2.5){\extline{l}{#4}}
\rput[l]{160}(0,2.5){\extline{r}{#1}}
\rput[l]{-20}(0,-2.5){\extline{l}{#3}}
\rput[l]{-160}(0,-2.5){\extline{r}{#2}}
\rput[l]{90}(0,-2.5){\intline{r}{#5}{5}}
%\endpspicture
}

