[pstricks] psmatrix, new arrow type
Antoine Pairet
antoine at pairet.be
Sat Nov 1 23:12:44 CET 2008
Hi!
I'm a new user of the list and I'd like to receive some help. I defined
a new environment to represent the symmetry of tensors (used in
crystallography for example). The complete code is at the end of the
message.
Basically, it uses a forloop to generate a psmatrix. Then using \ncnode
I connect several nodes. This works pretty good. However, I'd like to
define a new arrow type: an arrow that ends with a circle with a dot in
its centre.
\ncline{°-°}{nodeA}{nodeB} would link the 2 nodes by a line ending by
two circles having a dot in their center.
Moreover, I'd like to have some advices concerning the definition of my
\nonZero macro. It must put a dot on a node of the psmatrix. I uses
\ncline[linestyle=none]{*-}{nodeA}{1,1}
Is there a better method?
And how about having better brackets than with my code?
Thanks a lot,
Antoine
\documentclass[a4paper,10pt]{report}
\usepackage{pstricks,pst-node,pst-plot}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{forloop}
\usepackage{ifthen}
\usepackage{amsmath}
\newenvironment{symmatrix}[2]{%
% Macro definitions
\newcommand{\equalValue}[2]{\ncline{*-*}{##1}{##2}}%
\newcommand{\oppositeValue}[2]{\ncline{*-o}{##1}{##2}}%
\newcommand{\halfValue}[2]{\ncline{##1}{##2}}%
\newcommand{\halfOppositeValue}[2]{TO BE DEFINED WITH THE NEW
ARROW TYPE}%
\newcommand{\nonZero}[1]{\ncline[linestyle=none]{*-}{##1}{1,1}}%IS
THERE A BETTER WAY TO ACHIEVE THAT?
%Counters for the loop
\newcounter{identRow}%
\newcounter{identCol}%
\newcounter{endMatrix}%
\setcounter{endMatrix}{#1}%
\addtocounter{endMatrix}{-1}%
\begin{equation*}%
\psset{arrowscale=2}
\left(%
\begin{psmatrix}[colsep=.5cm,rowsep=.25cm,mnode=dot,dotsize=1.5pt]%
\forloop{identRow}{0}{\value{identRow} < #1}{%
\forloop{identCol}{1}{\value{identCol} < #2}{&}%
\ifthenelse{\equal{\value{identRow}}{\value{endMatrix}}}{}{\\}%
}%
\end{psmatrix}%
\right)}%
{\end{equation*}}
\begin{document}
\begin{symmatrix}{3}{6}
\equalValue{2,3}{3,6}
\oppositeValue{2,1}{3,4}
\nonZero{2,5}
\end{symmatrix}
\end{document}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://tug.org/pipermail/pstricks/attachments/20081101/724a777f/attachment.bin
More information about the PSTricks
mailing list