[pstricks] Pst-pdf and psmatrix ??

Herbert Voss LaTeX at zedat.fu-berlin.de
Fri Feb 10 22:53:15 CET 2006


Alain Matthes wrote:

>> split the command arbre in a TeX and PSTricks part.
>> tested with ps4pdf for Linux.
> 
> but why ? where is the problem ?

it depends on the package preview, which scans the
code for pstricks objects and psmatrix. But we need
also the new command abre to be scanned. And this
doesn't work. But you can make arbre a real PSTricks objectm
it should be anyway! And we define a new psmatrix, to
get the same with another name. Then it works.

Herbert

\documentclass{article}

\usepackage{pstricks,pst-node}
\usepackage{pst-pdf}
\usepackage[upright]{fourier} %permet d'éviter /text et est bien joli !
\usepackage{amsmath} % pour \text événement complémentaire avec overline
\usepackage[frenchb]{babel}

\let\pmat\psmatrix
\let\endpmat\endpsmatrix

\makeatletter
\newcounter{nb}

\def\arbre{\pst at object{arbre}}
\def\arbre at i#1#2#3#4{%
   \setcounter{nb}{0}
%
\@for\liste:=#1\do{%
   \ifcase\thenb
    \edef\@S{\liste}%
      \or
     \edef\@E{\liste}%
     \fi
      \stepcounter{nb}%
   }%fin du do
%
\setcounter{nb}{0}
%
  \@for\liste:=#2\do{%
   \ifcase\thenb
      \edef\@SS{\liste}%
      \or
      \edef\@SE{\liste}%
       \or
      \edef\@ES{\liste}%
     \or
      \edef\@EE{\liste}%
     \fi
      \stepcounter{nb}%
   }%fin du do
%
\setcounter{nb}{0}
%
  \@for\liste:=#3\do{%
   \ifcase\thenb
      \edef\@PS{\liste}%
      \or
      \edef\@PE{\liste}%
      \fi
     \stepcounter{nb}%
   }%fin du do
%
\setcounter{nb}{0}
%
  \@for\liste:=#4\do{%
   \ifcase\thenb
      \edef\@PSS{\liste}%
      \or
      \edef\@PSE{\liste}%
       \or
      \edef\@PES{\liste}%
     \or
      \edef\@PEE{\liste}%
     \fi
      \stepcounter{nb}%
   }%fin du do
   \arbre at ii
}
\def\arbre at ii{%
   \begingroup
\pmat[rowsep=.2cm,colsep=2cm]
             &           & \@SS  \\
             & \@S      &         \\
             & \@SE    &         \\
$\bullet $  &          &          \\
             &           & \@ES  \\
             & \@E      &         \\
             &           & \@EE  \\
\endpmat
\scriptsize
\psset{shortput=nab,arrows=->,labelsep=2pt,nodesep=2pt,nrot=:U}
\ncline{4,1}{2,2}\ncput*{$\@PS$}
\ncline{4,1}{6,2}\ncput*{$\@PE$}
\ncline{2,2}{1,3}\ncput*{$\@PSS$}
\ncline{2,2}{3,3}\ncput*{$\@PSE$}
\ncline{6,2}{5,3}\ncput*{$\@PES$}
\ncline{6,2}{7,3}\ncput*{$\@PEE$}
\endgroup%
\ignorespaces
}
\makeatother
\PreviewMacro[{!!!!}]{\arbre}

\begin{document}
\DecimalMathComma

\arbre{A,$\overline{\text{B}}$}{E,F,G,H}{0 at 2,x}{0 at 3,y,z,0 at 8}

\arbre{A,$\overline{\text{B}}$}{E,F,G,H}{{0,2},x}{{$0,3$},y,z,{0,8}}

\end{document}





More information about the PSTricks mailing list