[pstricks] No Tips?
Denis Girou
Denis.Girou at idris.fr
Fri May 17 21:25:55 CEST 2002
>>>>> "Jorge.Luis.Llanio" == Jorge Luis Llanio <jolla at ci.uc.pt> writes:
Jorge.Luis.Llanio> I am new with PStricks. Perhaps, one of my first "creations" was (Linux
Jorge.Luis.Llanio> box):
Jorge.Luis.Llanio> ...
Jorge.Luis.Llanio> \rput(5,9){\rnode{Oa}{{\LARGE ${\rm \bf O_{a}}$}}}
Jorge.Luis.Llanio> \rput(9,9){\rnode{Ob}{{\LARGE ${\rm \bf O_{b}}$}}}
Jorge.Luis.Llanio> \rput(11,6){\rnode{Oc}{{\LARGE ${\rm \bf O_{c}}$}}}
Jorge.Luis.Llanio> \rput(14.2,4.6){\rnode{Od}{{\LARGE ${\rm \bf O_{d}}$}}}
Jorge.Luis.Llanio> ...
In few words:
- think of (graphical) parametrized objects,
- think of a diagram as composition of these objects,
- think by algorithms,
- for structured diagrams where objects are put on a virtual grid,
the "psmatrix" environment is well suited,
- avoid to use multiple absolute coordinates like your list of \rput(.,.),
- avoid to use obsolete commands (like \rm and \bf in LaTeX 2e).
Jorge.Luis.Llanio> Well, I read a paper in Journal of Chemical Physics and one picture from
Jorge.Luis.Llanio> there interested me, then I scanned it and I am sending it to the list.
Jorge.Luis.Llanio> I would like to recreate this picture within a slide environment, like
Jorge.Luis.Llanio> my firt "PStricks creation". Any Tips?
Despite it great qualities, I do not believe that PSTricks is the best
answer for all kinds of graphics. There are better suited tools in many
various specialized fields, as here to draw molecules. It would be really
difficult to draw complex molecules, and it already exist sophisticated
softwares (that I never used myself) which do that well (I can believe).
Anyway, as your example here is "simple", this is rather easy to redo it
with PSTricks. Just use it as a pedagogical example of how to think with a
higher level of abstraction. Look at "The LaTeX Graphics Companion",
"TeX Unbound" and to some other documentations available and to the examples
in the PSTricks Web pages for other such examples.
\documentclass[a4paper]{article}
\usepackage{pstcol}
\usepackage{pst-node}
\usepackage{pst-slpe} % CTAN:graphics/pstricks/contrib/pst-slpe
\def\OneDot{\psdot(0,0)}
\def\TwoDots{\psdots(0,0.2)(0,-0.2)}
\def\ObjectA{%
\pscircle[fillstyle=ccslope,slopebegin=white,slopeend=black,
slopecenter=0.2 0.5](0.5,0.5){0.55}}
\def\ObjectB{%
\psccurve[fillstyle=ccslope,slopebegin=white,slopeend=black,
slopecenter=0.9 0.5]
(0,0.3)(0.2,0)(0.8,0.1)(1,0.2)(1,0.8)(0.8,0.9)(0.2,1)(0,0.8)}
\def\ObjectC#1{%
\psccurve[fillstyle=solid,fillcolor=white]
(0,0.3)(0.2,0)(0.8,0.1)(1,0.2)(1,0.8)(0.8,0.9)(0.2,1)(0,0.8)
\rput(0.5,0.5){#1}}
\def\ObjectD#1{%
\pscircle[fillstyle=solid,fillcolor=white](0.5,0.5){0.55}
\rput(0.5,0.5){#1}}
\def\Molecule#1#2#3{%
\pspicture(3,1.1)
\psset{dotscale=1.5}%
\rput(1.3,0.1){\ObjectA}
\rput(0.1,0.1){#1}
\rput{180}(2.9,1.1){#2}
\rput(1,0){\ObjectD{#3}}
\endpspicture}
\def\MoleculeA{\Molecule{\ObjectB}{\ObjectC{\TwoDots}}{\OneDot}}
\def\MoleculeB{\Molecule{\ObjectB}{\ObjectC{\OneDot}}{\TwoDots}}
\def\MoleculeC{\Molecule{\ObjectC{\OneDot}}{\ObjectB}{\TwoDots}}
\def\MoleculeD{\Molecule{\ObjectC{\TwoDots}}{\ObjectB}{\OneDot}}
\begin{document}
\begin{psmatrix}[colsep=0.5]
[name=MoleculeA] \MoleculeA \\[0pt]
[name=MoleculeB] \MoleculeB & [name=MoleculeC] \MoleculeC \\
& [name=MoleculeD] \MoleculeD
\end{psmatrix}
% Connections and labels
\psset{arrowscale=2}
\ncline[offset=0.2,linewidth=0.15]{MoleculeA}{MoleculeB}
\ncline[offset=0.2,linewidth=0.15]{MoleculeC}{MoleculeD}
\ncarc[offset=-0.4,arcangle=60]{MoleculeB}{MoleculeC}
\naput{\psline[linestyle=dashed]{<-}(1,2)
\rput[l](1.2,2){singlet coupling}}
\ncbar[linestyle=dashed,angleA=-60,angleB=-135,armB=0]{<->}
{MoleculeB}{MoleculeC}
\nbput[npos=0.9]{lone pair repulsion}
\nbput[npos=0.2]{$\pi_2$}
\nbput[npos=1.8]{$\pi_3$}
\end{document}
D.G.
More information about the PSTricks
mailing list