PSTricks and psmatrix

Denis Girou Denis.Girou at
Mon Mar 20 18:34:05 CET 2000

This is the PSTricks mailing list, devoted to discussions about computational
graphics in (La)TeX using the PSTricks package from Timothy van Zandt.
For help using this mailing list, see instructions at the end of message.

The following message is a courtesy copy of an article
that has been posted to comp.text.tex as well.

>>>>> "Jonas.Grave" == Jonas Grave <jonas_grave at> writes:

    Jonas.Grave> Hello,
    Jonas.Grave> I have started using PSTricks with LaTeX. I don't understand why there
    Jonas.Grave> is a difference in alignment inside a psmatrix environment and outside
    Jonas.Grave> with respect to connecting nodes with arrows. The code at the end of
    Jonas.Grave> this post shows what I mean. Two diamond shaped boxes are drawn at the
    Jonas.Grave> same row but different column and connected with an arrow. But this
    Jonas.Grave> arrow does not start and end exactly at the tip of the diamonds. The
    Jonas.Grave> arrow is a bit below. However, drawing the same outside the psmatrix
    Jonas.Grave> environment, the arrow is exactly where it should be. What am I doing
    Jonas.Grave> wrong??

    Jonas.Grave> Jonas

    Jonas.Grave> \documentclass[a4paper]{article}

    Jonas.Grave> \usepackage{pst-node}
    Jonas.Grave> \usepackage{times}

    Jonas.Grave> \pagestyle{empty}

    Jonas.Grave> \begin{document}

    Jonas.Grave> \begin{psmatrix}
    Jonas.Grave>       \psdiabox{Diamond 1} & \psdiabox{Diamond 2}
    Jonas.Grave>       \ncline[arrowscale=2]{->}{1,1}{1,2}
    Jonas.Grave> \end{psmatrix}

    Jonas.Grave> \rput(1.8,-1){\dianode{A}{Diamond 1}}
    Jonas.Grave> \rput(6.8,-1){\dianode{B}{Diamond 2}}
    Jonas.Grave> \ncline[arrowscale=2]{->}{A}{B}

    Jonas.Grave> \end{document}

  The difference of position you notice is tiny and noticeable only with
careful verification, but it exist and become more evident if we increase
the scale factor. It give also a different result if we use a different string
like "Diamond q" in place of "Diamond 1".

  The reason of the difference between your two versions is not only that the
underlying mechanism is completely different. This is also because in the
second case you use a node of type \dianode and in the first case a node of
type \Rnode (which is the default for the "psmatrix" environment - see manual
page 27, file And \Rnode is mainly provided to align strings,
using the "vref" parameter to position vertically it content (see manual
page 7, file It is not well suited for the diamond boxes that
you use.

  So, in your case you must use, in the "psmatrix" environment, the "r" type
of nodes (which will use the \rnode macro), or the "dia" type if most of your
nodes have the diamond type.





  \psdiabox{Diamond 1} & \psdiabox{Diamond 2}

  \psdiabox{Diamond q} & \psdiabox{Diamond q}

  \psdiabox{Diamond 1} & \psdiabox{Diamond 2}

  Diamond 1 & Diamond 2

  \rput(1,0){\dianode{A}{Diamond 1}}
  \rput(3.4,0){\dianode{B}{Diamond 2}}


Denis Girou
Institut du Développement et des Ressources en Informatique Scientifique |
Centre National de la Recherche Scientifique                             |
Bâtiment 506 - B.P. 167 - 91403 Orsay Cedex - France                     |

The list interface (subscription, information, access to the archives) is on:
Otherway to unsubscribe, send mail to pstricks-request at
with a blank subject and in body the line unsubscribe <email-address>

More information about the PSTricks mailing list