From c932139e8b0f699766b5591dc6eb654a600f72a6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 5 Mar 2015 23:22:05 +0000 Subject: tikzorbital (5mar15) git-svn-id: svn://tug.org/texlive/trunk@36439 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/tikzorbital/README.rst | 31 ++++++ .../doc/latex/tikzorbital/tikzorbital.pdf | Bin 189684 -> 197618 bytes .../doc/latex/tikzorbital/tikzorbital.tex | 119 ++++++++++++--------- .../tex/latex/tikzorbital/tikzorbital.sty | 91 ++++++++++++++-- 4 files changed, 187 insertions(+), 54 deletions(-) create mode 100644 Master/texmf-dist/doc/latex/tikzorbital/README.rst diff --git a/Master/texmf-dist/doc/latex/tikzorbital/README.rst b/Master/texmf-dist/doc/latex/tikzorbital/README.rst new file mode 100644 index 00000000000..3a1efb94894 --- /dev/null +++ b/Master/texmf-dist/doc/latex/tikzorbital/README.rst @@ -0,0 +1,31 @@ +------------------- +tikzorbital package +------------------- + +:Licence: Latex project public licence http://www.latex-project.org/lppl.txt +:Author: Germain Salvato-Vallverdu +:Date: decembre 2012 +:CTAN: http://www.ctan.org/pkg/tikzorbital +:gitHub: https://github.com/gVallverdu/tikzorbital + +short description +----------------- + +The tikzorbital package provides several LaTeX macros in order to draw +easily molecular diagrams and atomic orbital of type s, p and d inside +tikzpicture environment. + +macros +------ + +All macros have to be used inside tikzpicture environment : + + * ``\drawLevel`` : draw a level with zero, one or two electrons drawn as up and arrows. This command is used for molecular orbital diagrams. + * ``\orbital`` : draw atomic orbital of type s, p or d. + * ``\satom`` : quickly place an atom with several lobes around it. + +bugs and suggestion +------------------- + +Feel free to contact me for any bugs, comments or suggestions. + diff --git a/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf index 771593b6f16..4810ace65b2 100644 Binary files a/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf and b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.pdf differ diff --git a/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex index 3053542a8e4..6f1d08ba14c 100644 --- a/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex +++ b/Master/texmf-dist/doc/latex/tikzorbital/tikzorbital.tex @@ -336,18 +336,25 @@ Example \ref{expl:all_OA} shows all atomic orbital types available. In order to \node[above] at (2,4) {p$_y$}; \orbital[pos = {(4,3)}]{pz} \node[above] at (4,4) {p$_z$}; - - \orbital[pos = {(0,0)}]{dxy} - \node[above] at (0,1) {d$_{xy}$}; - \orbital[pos = {(2,0)}]{dxz} - \node[above] at (2,1) {d$_{xz}$}; - \orbital[pos = {(4,0)}]{dyz} - \node[above] at (4,1) {d$_{yz}$}; - - \orbital[pos = {(0,-2)}]{dx2y2} - \node[below] at (0,-3) {d$_{x^2-y^2}$}; - \orbital[pos = {(2,-2)}]{dz2} - \node[below] at (2,-3) {d$_{z^2}$}; + + \orbital[pos = {(0,0)}]{-px} + \node[above] at (0,1) {-p$_x$}; + \orbital[pos = {(2,0)}]{-py} + \node[above] at (2,1) {-p$_y$}; + \orbital[pos = {(4,0)}]{-pz} + \node[above] at (4,1) {-p$_z$}; + + \orbital[pos = {(0,-3)}]{dxy} + \node[above] at (0,-2) {d$_{xy}$}; + \orbital[pos = {(2,-3)}]{dxz} + \node[above] at (2,-2) {d$_{xz}$}; + \orbital[pos = {(4,-3)}]{dyz} + \node[above] at (4,-2) {d$_{yz}$}; + + \orbital[pos = {(0,-5)}]{dx2y2} + \node[below] at (0,-6) {d$_{x^2-y^2}$}; + \orbital[pos = {(2,-5)}]{dz2} + \node[below] at (2,-6) {d$_{z^2}$}; \end{tikzpicture} \end{lstlisting} \end{minipage} @@ -366,18 +373,25 @@ Example \ref{expl:all_OA} shows all atomic orbital types available. In order to \node[above] at (2,4) {p$_y$}; \orbital[pos = {(4,3)}]{pz} \node[above] at (4,4) {p$_z$}; - - \orbital[pos = {(0,0)}]{dxy} - \node[above] at (0,1) {d$_{xy}$}; - \orbital[pos = {(2,0)}]{dxz} - \node[above] at (2,1) {d$_{xz}$}; - \orbital[pos = {(4,0)}]{dyz} - \node[above] at (4,1) {d$_{yz}$}; - - \orbital[pos = {(0,-2)}]{dx2y2} - \node[below] at (0,-3) {d$_{x^2-y^2}$}; - \orbital[pos = {(2,-2)}]{dz2} - \node[below] at (2,-3) {d$_{z^2}$}; + + \orbital[pos = {(0,0)}]{-px} + \node[above] at (0,1) {-p$_x$}; + \orbital[pos = {(2,0)}]{-py} + \node[above] at (2,1) {-p$_y$}; + \orbital[pos = {(4,0)}]{-pz} + \node[above] at (4,1) {-p$_z$}; + + \orbital[pos = {(0,-3)}]{dxy} + \node[above] at (0,-2) {d$_{xy}$}; + \orbital[pos = {(2,-3)}]{dxz} + \node[above] at (2,-2) {d$_{xz}$}; + \orbital[pos = {(4,-3)}]{dyz} + \node[above] at (4,-2) {d$_{yz}$}; + + \orbital[pos = {(0,-5)}]{dx2y2} + \node[below] at (0,-6) {d$_{x^2-y^2}$}; + \orbital[pos = {(2,-5)}]{dz2} + \node[below] at (2,-6) {d$_{z^2}$}; \end{tikzpicture} \end{minipage} \caption{All the atomic orbitals available from the command \cmd{orbital}.} @@ -387,15 +401,17 @@ Example \ref{expl:all_OA} shows all atomic orbital types available. In order to \clearpage \section{Atom and hybrid orbitals} -The package \package provides the command \cmd{atom} in order to quickly draw an atom with several orbital lobes around it. The general syntax of the command is : +The package \package provides the command \cmd{satom} in order to quickly draw an atom with several orbital lobes around it. The general syntax of the command is : -\cmd{atom}\opt{options}\{\marg{lobes}\} +\cmd{satom}\opt{options}\{\marg{lobes}\} The \marg{lobes} argument is a comma separated list of lobe definition with the syntax -\texttt{color/rotation-angle/anchor/number of electrons} +\texttt{color/rotation-angle/anchor/number of electrons/scale} -For each element of the list, the command \cmd{atom} draw a lobe at the given anchor, with the given color , rotation and number of electrons. +For each element of the list, the command \cmd{satom} draw a lobe at the given +anchor, with the given color, rotation, number of electrons and applies the +scaling factor. The following options are available in order to customize the drawing : @@ -411,58 +427,65 @@ The following options are available in order to customize the drawing : \item \opt{opacity} : opacity of the lobe drawn around the atom.\\ \texttt{default = 0.8} + + \item \opt{scale} : A global scaling factor of the whole atom and lobes.\\ + \texttt{default = 1.} \end{description} -Example \ref{exple:atom} show several applications of the command \cmd{atom}. +For backward compatibility the \cmd{atom} command is still available. It works +in the same way but without the possibility of applying a scaling factor +individually on each lobe. + +Example \ref{exple:atom} show several applications of the command \cmd{satom}. \begin{example}[htbp] \begin{minipage}{.78\textwidth} \begin{lstlisting} \begin{tikzpicture} - \atom[color = orange, name = S]{orange/0/east/2} + \satom[color=orange, name=S]{orange/0/east/2/1.} \end{tikzpicture} \end{lstlisting} \begin{lstlisting} \begin{tikzpicture} - \atom[name = Cl, color = blue]{ + \atom[name=Cl, color=blue, scale=1.2]{ blue/90/north/2, blue/0/east/1, blue/270/south/2, blue/180/west/2} - \atom[name = H, color = gray, pos = {(1.8,0)}]{gray/180/west/1} + \atom[name=H, color=gray, pos={(1.8,0)}, scale=.8]{gray/180/west/1} \end{tikzpicture} \end{lstlisting} \begin{lstlisting} \begin{tikzpicture} - \atom[name = B, color = green!50!black]{ - red/90/north/2, - blue/0/east/1, - orange/270/south/0, - green/180/west/1} + \satom[name=B, color=green!50!black]{ + red/90/north/2/.8, + blue/0/east/1/.9, + orange/270/south/0/1, + green/180/west/1/1.2} \end{tikzpicture} \end{lstlisting} \end{minipage} \begin{minipage}{.21\textwidth} \begin{tikzpicture} - \atom[color = orange, name = S]{orange/0/east/2} + \satom[color=orange, name=S]{orange/0/east/2/1.} - \atom[name = Cl, color = blue, pos = {(0,-3)}]{ + \atom[name=Cl, color=blue, pos={(0,-3)}, scale=1.2]{ blue/90/north/2, blue/0/east/1, blue/270/south/2, blue/180/west/2} - \atom[name = H, color = gray, pos = {(1.8,-3)}]{gray/180/west/1} + \atom[name=H, color=gray, pos={(1.8,-3)}, scale=.8]{gray/180/west/1} - \atom[name = B, color = green!50!black, pos = {(0,-7)}]{ - red/90/north/2, - blue/0/east/1, - orange/270/south/0, - green/180/west/1} + \satom[name=B, color=green!50!black, pos={(0,-7)}]{ + red/90/north/2/.8, + blue/0/east/1/0.9, + orange/270/south/0/1, + green/180/west/1/1.2} \end{tikzpicture} \end{minipage} -\caption{Utilization example of the \cmd{atom} command.} +\caption{Utilization example of the \cmd{satom} command.} \label{exple:atom} \end{example} @@ -530,6 +553,6 @@ no default are given. For example, the $d_{yz}$ atomic orbital is defined as fol \section{Source code} -\lstinputlisting{../../../tex/latex/tikzorbital/tikzorbital.sty} +\lstinputlisting{./tikzorbital.sty} -\end{document} \ No newline at end of file +\end{document} diff --git a/Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty b/Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty index e9bffcbe108..1794b184877 100644 --- a/Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty +++ b/Master/texmf-dist/tex/latex/tikzorbital/tikzorbital.sty @@ -14,6 +14,11 @@ % % Feel free to contact me if you have any ideas, suggestions or bugs report ! % +% Change +% ------ +% 27/02/2013 : add -px, -py, -pz orbital type +% 05/03/2015 : add satom macro, with scaling options for each lobe +% % ----------------------------------------------------------------------------- \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{tikzorbital}[2012/12/05 draw atomic orbitals and molecular diagrams with tikz] @@ -149,7 +154,7 @@ \begin{pgfonlayer}{background} \draw[draw = drawColor, outer color = #4, inner color = innerColor, opacity = #6, execute macro = \orbitalDrawing] - #1 .. controls ++ (#3 * 1, #3 * 1) and ++ (#3 * 1, - #3 * 1) .. #1; + #1 .. controls ++ (#3, #3) and ++ (#3, - #3) .. #1; \end{pgfonlayer} %Coordinates of the electrons @@ -240,16 +245,30 @@ \@alobe{\orbital@pos}{0}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} \@alobe{\orbital@pos}{180}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} }{ + \ifthenelse{\equal{\orbital@type}{-py}}{ + \@alobe{\orbital@pos}{180}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{0}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + }{ \ifthenelse{\equal{\orbital@type}{pz}}{ \@alobe{\orbital@pos}{90}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} \@alobe{\orbital@pos}{270}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} }{ + \ifthenelse{\equal{\orbital@type}{-pz}}{ + \@alobe{\orbital@pos}{270}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} + \@alobe{\orbital@pos}{90}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} + }{ \ifthenelse{\equal{\orbital@type}{px}}{ \node[base, outer color = \orbital@ncolor, scale = \orbital@scale * 1.8, xshift = 2pt, yshift = 2pt] at \orbital@pos {}; \node[base, outer color = \orbital@pcolor, scale = \orbital@scale * 1.8] at \orbital@pos {}; }{ + \ifthenelse{\equal{\orbital@type}{-px}}{ + \node[base, outer color = \orbital@pcolor, scale = \orbital@scale * 1.8, + xshift = 2pt, yshift = 2pt] at \orbital@pos {}; + \node[base, outer color = \orbital@ncolor, scale = \orbital@scale * 1.8] + at \orbital@pos {}; + }{ \ifthenelse{\equal{\orbital@type}{dyz}}{ \@alobe{\orbital@pos}{45}{\orbital@scale}{\orbital@pcolor}{0}{\orbital@opacity} \@alobe{\orbital@pos}{135}{\orbital@scale}{\orbital@ncolor}{0}{\orbital@opacity} @@ -294,7 +313,7 @@ at \orbital@pos {}; }{ \node[red] at \orbital@pos {orbital type unknown}; - }}}}}}}}}} + }}}}}}}}}}}}} \endgroup } @@ -323,7 +342,8 @@ % ----------------------------------------------------------------------------- % commande \atom[options]{lobes} % ----------------------------------------------------------------------------- -% quickly draw an atom with several orbital lobes around it +% quickly draw an atom with several orbital lobes around it. +% DEPRECATED, use satom insteed. % % argument % lobes : A comma separated list lobe definition with @@ -334,6 +354,7 @@ % name : name of the atom, also used to label the node % color : color of the atom % opacity : opacity of the orbital +% scale : scaling factor % ----------------------------------------------------------------------------- % define options @@ -350,8 +371,11 @@ % opacity of the orbitals opacity/.store in = \atom@opacity, opacity/.default = .8, +% scaling factor + scale/.store in = \atom@scale, + scale/.default = 1., % execute options - pos, name, color, opacity + pos, name, color, opacity, scale } % atom definition @@ -360,10 +384,65 @@ \pgfkeys{/tikzorbital/atom/.cd, #1} \colorlet{atomColor}{\atom@color} \node[shape = circle, thick, inner sep = 0pt, minimum size = 1.5em, - draw = atomColor!40, color = atomColor!70!gray, fill = atomColor!20] + draw = atomColor!40, color = atomColor!70!gray, fill = atomColor!20, + scale = \atom@scale] at \atom@pos (\atom@name) {\atom@name}; + \def\s{1.} \foreach \acolor/\rot/\anchor/\Ne in {#2} { - \@alobe{(\atom@name.\anchor)}{\rot}{1.5}{\acolor}{\Ne}{\atom@opacity} + \@alobe{(\atom@name.\anchor)}{\rot}{1.5*\atom@scale}{\acolor}{\Ne}{\atom@opacity} + } + \endgroup +} + +% ----------------------------------------------------------------------------- +% commande \satom[options]{lobes} +% ----------------------------------------------------------------------------- +% quickly draw an atom with several orbital lobes around it +% +% argument +% lobes : A comma separated list lobe definition with +% color/rotation-angle/anchor/number of electrons/scale +% +% options +% pos : position of the atom +% name : name of the atom, also used to label the node +% color : color of the atom +% opacity : opacity of the orbital +% scale : global scaling factor +% ----------------------------------------------------------------------------- + +% define options +\pgfkeys{/tikzorbital/satom/.cd, +% position of the atom + pos/.store in = \satom@pos, + pos/.default = {(0,0)}, +% atom name + name/.store in = \satom@name, + name/.default = X, +% color of the atom + color/.store in = \satom@color, + color/.default = green, +% opacity of the orbitals + opacity/.store in = \satom@opacity, + opacity/.default = .8, +% scaling factor + scale/.store in = \satom@scale, + scale/.default = 1., +% execute options + pos, name, color, opacity, scale +} + +% atom definition +\newcommand{\satom}[2][]{ + \begingroup + \pgfkeys{/tikzorbital/satom/.cd, #1} + \colorlet{atomColor}{\satom@color} + \node[shape = circle, thick, inner sep = 0pt, minimum size = 1.5em, + draw = atomColor!40, color = atomColor!70!gray, fill = atomColor!20, + scale = \satom@scale] + at \satom@pos (\satom@name) {\satom@name}; + \foreach \acolor/\rot/\anchor/\Ne/\s in {#2} { + \@alobe{(\satom@name.\anchor)}{\rot}{1.5*\s*\atom@scale}{\acolor}{\Ne}{\satom@opacity} } \endgroup } -- cgit v1.2.3