[pstricks] Help with electron dots around atoms
Herbert Voss
Herbert.Voss at alumni.TU-Berlin.DE
Sun Feb 13 09:04:08 CET 2005
rossi at york.cuny.edu wrote:
> I am trying to place electron dots around an atom. The atom will then be used
> in xymtex to draw a large molecule.
>
> Can some one help me to place the electrons around an atom in an unequivocal
> way?
>
> For the code below, numbers 1 and 2 are OK because the left side and right side
> electrons are put around the atom separately.
>
> But number 3 is bad because the left and right electrons are placed at the same
> time, and the origin is shifted.
>
> Numbers 4, 5, and 6 are really bad.
>
> Is there a way to do this so the electrons are placed in an invariant manner?
use always pstricks
Herbert
\documentclass[a4paper,12pt]{article}
\usepackage{pstricks}
\usepackage{pst-node}
\usepackage{pst-slpe} % CTAN:graphics/pstricks/contrib/pst-slpe
\newsavebox\PBox
\def\TwoDots#1#2{%
\sbox\PBox{#1}%
\begin{pspicture}(\wd\PBox,\ht\PBox)
\rput[lb](0,0){#1}
\psset{dotsize=2pt, linecolor=black}
\ifcase#2
\psdots(1.1\wd\PBox,0.35\ht\PBox)(1.1\wd\PBox,0.65\ht\PBox)%r
\or\psdots(-0.05,0.35\ht\PBox)(-0.05,0.66\ht\PBox)%l
\or\psdots(0.35\wd\PBox,-0.1)(0.65\wd\PBox,-0.1)%b
\or\psdots(0.35\wd\PBox,1.2\ht\PBox)(0.65\wd\PBox,1.2\ht\PBox)%t
\or\psdots(1.1\wd\PBox,0.15)(1.1\wd\PBox,0.30)%r
\psdots(-0.05,0.35\ht\PBox)(-0.05,0.65\ht\PBox)%l
\or\psdots(0.35\wd\PBox,-0.1)(0.65\wd\PBox,-0.1)%b%b
\psdots(-0.05,0.35\ht\PBox)(-0.05,0.65\ht\PBox)%l
\psdots(0.35\wd\PBox,1.2\ht\PBox)(0.65\wd\PBox,1.2\ht\PBox)%t
\fi
\end{pspicture}}
\newlength\RCircle\newlength\PDiff\PDiff=5pt
\def\TwoDotsA#1#2{%
\RCircle=#1
\begin{pspicture}(-\RCircle,-\RCircle)(\RCircle,\RCircle)
\pscircle{\RCircle}
\psset{dotsize=2pt, linecolor=black}
\ifcase#2
\psdots(1.25\RCircle,0.5\PDiff)(1.25\RCircle,-0.5\PDiff)%r
\or\psdots(-1.25\RCircle,0.5\PDiff)(-1.25\RCircle,-0.5\PDiff)%l
\or\psdots(-0.5\PDiff,-1.25\RCircle)(0.5\PDiff,-1.25\RCircle)%b
\or\psdots(-0.5\PDiff,1.25\RCircle)(0.5\PDiff,1.25\RCircle)%t
\or\psdots(1.25\RCircle,0.5\PDiff)(1.25\RCircle,-0.5\PDiff)%r
\psdots(-1.25\RCircle,0.5\PDiff)(-1.25\RCircle,-0.5\PDiff)%l
\or\psdots(-0.5\PDiff,-1.25\RCircle)(0.5\PDiff,-1.25\RCircle)%b
\psdots(-1.25\RCircle,0.5\PDiff)(-1.25\RCircle,-0.5\PDiff)%l
\psdots(-0.5\PDiff,1.25\RCircle)(0.5\PDiff,1.25\RCircle)%t
\fi
\end{pspicture}}
\begin{document}
{\LARGE
\begin{enumerate}
\item \TwoDots{O}{0}%r
\item \TwoDots{O}{1}%l
\item \TwoDots{O}{4}%lr
\item \TwoDots{O}{2}%b
\item \TwoDots{O}{3}%t
\item \TwoDots{O}{5}%blt
\end{enumerate}
}
\begin{enumerate}
\item \TwoDotsA{10pt}{0}%r
\item \TwoDotsA{10pt}{1}%l
\item \TwoDotsA{10pt}{4}%lr
\item \TwoDotsA{10pt}{2}%b
\item \TwoDotsA{10pt}{3}%t
\item \TwoDotsA{10pt}{5}%blt
\end{enumerate}
\end{document}
--
http://TeXnik.de/
http://PSTricks.de/
ftp://ftp.dante.de/tex-archive/info/math/voss/Voss-Mathmode.pdf
http://www.dante.de/faq/de-tex-faq/
http://www.tex.ac.uk/cgi-bin/texfaq2html?introduction=yes
More information about the PSTricks
mailing list