diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-03 22:59:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-03 22:59:06 +0000 |
commit | 3bbe1d88307bb986d9472f0c2f2acbef3cb7b046 (patch) | |
tree | 41919bef12683ce8dfca763c22024ea527b82b61 /Master/texmf-dist/tex/latex/chemfig | |
parent | 232c31c3e8372ee6cbf87806f4e82af57950f4f4 (diff) |
chemfig 0.2 (1sep10)
git-svn-id: svn://tug.org/texlive/trunk@19578 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/chemfig')
-rw-r--r-- | Master/texmf-dist/tex/latex/chemfig/chemfig.sty | 306 |
1 files changed, 199 insertions, 107 deletions
diff --git a/Master/texmf-dist/tex/latex/chemfig/chemfig.sty b/Master/texmf-dist/tex/latex/chemfig/chemfig.sty index b594c97f38a..4931fe7f2cc 100644 --- a/Master/texmf-dist/tex/latex/chemfig/chemfig.sty +++ b/Master/texmf-dist/tex/latex/chemfig/chemfig.sty @@ -1,11 +1,11 @@ -% _________________________________________________________________ -% | | -% | | -% | chemfig v0.1 | -% | | -% | June 23, 2010 | -% | | -% |_________________________________________________________________| +% __________________________________________________________________ +% | | +% | | +% | chemfig v0.2 | +% | | +% | August 31, 2010 | +% | | +% |__________________________________________________________________| % % This is chemfig.sty, the code of the "chemfig" package. % @@ -16,12 +16,13 @@ % later, see http://www.latex-project.org/lppl.txt % Copyright : Christian Tellechea 2010 % -% The "chemfig" package consists of the 4 following files: +% The "chemfig" package consists of the 6 following files: % chemfig.sty (this file) % README +% chemfig_doc_en.tex, chemfig_doc_en.pdf (english manual) % chemfig_doc_fr.tex, chemfig_doc_fr.pdf (manual in french) % -% ------------------------------------------------------------------- +% -------------------------------------------------------------------- % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 % of this license or (at your option) any later version. @@ -31,15 +32,15 @@ % % and version 1.3 or later is part of all distributions of LaTeX % version 2005/12/01 or later. -% ------------------------------------------------------------------- +% -------------------------------------------------------------------- % This work has the LPPL maintenance status `maintained'. % % The Current Maintainer of this work is Christian Tellechea -% ------------------------------------------------------------------- -\newcommand*\CF@ver {0.1} -\newcommand*\CF@date {2010/06/23} -\newcommand*\CF@fr@date {23 juin 2010} -\newcommand*\CF@en@date {June 23, 2010} +% -------------------------------------------------------------------- +\newcommand*\CF@ver {0.2} +\newcommand*\CF@date {2010/08/31} +\newcommand*\CF@fr@date {31 ao\^ut 2010} +\newcommand*\CF@en@date {August 31, 2010} \newcommand*\CF@package@name{chemfig} \ProvidesPackage\CF@package@name[\CF@date\space v\CF@ver\space Draw molecule with an easy syntax] @@ -63,7 +64,7 @@ \newbox\CF@box@boxa \newbox\CF@box@boxb -\newcommand*\CF@display@chem[1]{\ensuremath{\mathrm{#1}}} +\newcommand*\printatom[1]{\ensuremath{\mathrm{#1}}} \def\CF@empty@node{{}} @@ -147,13 +148,22 @@ \csname @\ifx\CF@toks@a\CF@toks@b first\else second\fi oftwo\endcsname } -\newcommand*\CF@if@firsttokin[2]{% teste si le token qui commence #1 appartient aux tokens mis dans #2 - \ifx\@empty#2\@empty% +\newcommand*\CF@if@firsttokin[1]{% teste si le token qui commence #1 appartient aux tokens mis dans #2 + \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil + \CF@if@firsttokin@i +} + +\newcommand*\CF@if@firsttokin@i[1]{% + \ifx\@empty#1\@empty \expandafter\@secondoftwo \else - \CF@if@firsttokmatch{#1}{#2}% - {\expandafter\@firstoftwo}% - {\CF@swap@fi\CF@expand@second{\CF@if@firsttokin{#1}}{\@gobble#2}}% + \futurelet\CF@toks@b\CF@gobble@tonil#1\relax\@nil + \ifx\CF@toks@a\CF@toks@b + \expandafter\expandafter\expandafter\@firstoftwo + \else + \CF@swap@fi\CF@swap@fi + \expandafter\CF@if@firsttokin@i\expandafter{\@gobble#1}% + \fi \fi } @@ -162,25 +172,41 @@ \CF@if@instr@i#1\@@nil#2\@nil } +\def\CF@after@space#1 #2\@nil{#2} + +\newcommand\CF@if@spacefirst[1]{% + \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil + \csname @\ifx\CF@toks@a\@sptoken first\else second\fi oftwo\endcsname +} + \newcommand*\CF@seek@node[3]{% cherche un noeud au début de #1 l'assigne dans la sc #2 et met le reste dans #3 \let#2\@empty \def#3{#1}% - \CF@seek@node@i{#1}#2#3% + \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil + \csname @\ifx\CF@toks@a\@sptoken first\else second\fi oftwo\endcsname + {\expandafter\CF@seek@node@i\expandafter{\CF@after@space#1\@nil}#2#3}% ignore l'espace qui commence un groupe d'atome + {\CF@seek@node@i{#1}#2#3}% } \newcommand*\CF@seek@node@i[3]{% \ifx\@empty#1\@empty \let#3\@empty \else - \CF@if@firsttokmatch{#1}\bgroup - {\CF@expadd@tocs#2{\expandafter{\@car#1\@nil}}% - \CF@swap@fi\CF@expand@second\CF@seek@node@i{\@gobble#1}#2#3% + \futurelet\CF@toks@a\CF@gobble@tonil#1\relax\@nil + \csname @\ifx\CF@toks@a\@sptoken first\else second\fi oftwo\endcsname + {\CF@add@tocs#2{ }% + \CF@swap@fi\CF@expand@second\CF@seek@node@i{\CF@after@space#1\@nil}#2#3% }% - {\CF@expand@second\CF@if@firsttokin{\@car#1\@nil}{-=\CF@char@triplebond<>(!*}% - {\def#3{#1}}% - {\CF@expadd@tocs#2{\@car#1\@nil}% + {\csname @\ifx\CF@toks@a\bgroup first\else second\fi oftwo\endcsname + {\CF@expadd@tocs#2{\expandafter{\@car#1\@nil}}% \CF@swap@fi\CF@expand@second\CF@seek@node@i{\@gobble#1}#2#3% }% + {\CF@if@firsttokin@i{-=(*<>!\CF@char@triplebond}% + {\def#3{#1}}% + {\CF@expadd@tocs#2{\@car#1\@nil}% + \CF@swap@fi\CF@expand@second\CF@seek@node@i{\@gobble#1}#2#3% + }% + }% }% \fi } @@ -353,12 +379,13 @@ \fi \let\CF@default@angle\pgfmathresult \fi + \let\CF@default@stringangle\@empty \else \def\CF@default@angle{0}% + \def\CF@default@stringangle{:0}% angle pris par défaut si le champ est vide \fi% angle par défaut \let\CF@current@angle\CF@default@angle - \def\CF@default@stringangle{:0}% - \def\CF@default@length{1}% longueur de la liaison par défaut + \ifCF@incycle\else\def\CF@default@length{1}\fi% longueur de la liaison par défaut sauf pour un cycle où on prend celle en cours \let\CF@default@fromatom\@empty% numero de l'atome d'où partent les liaisons par défaut \let\CF@default@toatom\@empty% numéro de l'atome où arrivent les laisons par défaut \let\CF@default@tikz\@empty @@ -410,7 +437,8 @@ \fi \else\CF@current@fromatom \fi}% - \CF@expand@second\CF@if@firsttokin\CF@remain@molecule{-=<>\CF@char@triplebond}% la suite est une liaison + \expandafter\futurelet\expandafter\CF@toks@a\expandafter\CF@gobble@tonil\CF@remain@molecule\relax\@nil + \CF@if@firsttokin@i{-=<>\CF@char@triplebond}% la suite est une liaison {\ifnum\CF@last@action=\tw@% c'est la deuxième liaison consécutive ? \CF@insert@emptygroup\CF@remain@molecule% insère un groupe vide \edef\CF@bond@outnode{\CF@bond@outnode}% @@ -426,17 +454,19 @@ oftwo% \endcsname {\let\CF@next@scan\endgroup - \CF@draw@bond\CF@bond@type{\CF@bond@outnode}{\CF@hook@cycle}\CF@previous@atomgroup\CF@hook@atomgroup}% + \CF@draw@bond\CF@bond@type{\CF@bond@outnode}{\CF@hook@cycle}\CF@previous@atomgroup\CF@hook@atomgroup + }% {\node[at=(\CF@bond@outnode),shift=(\CF@current@angle:\CF@current@length*\CF@atom@sep)](CF@node){}; \let\CF@previous@angle\CF@current@angle - \let\CF@last@action\tw@}% + \let\CF@last@action\tw@ + }% \fi \ifx\CF@remain@molecule\@empty% plus rien après la liaison -> insère un groupe vide \CF@insert@emptygroup\CF@remain@molecule \fi }% {\edef\CF@bond@outnode{\CF@bond@outnode}% évalue le l'atome de départ de liaison - \CF@expand@second\CF@if@firsttokmatch\CF@remain@molecule(% une parenthèse pour commencer ? + \csname @\ifx(\CF@toks@a first\else second\fi oftwo\endcsname% une parenthèse pour commencer ? {\ifnum\CF@last@action=\tw@% il y avait une liaison juste avant ? \CF@insert@emptygroup\CF@remain@molecule \else @@ -451,7 +481,7 @@ {\ifx\CF@remain@molecule\@empty \let\CF@next@scan\endgroup \else% ce qui reste après le noeud courant n'est pas vide, ne commence pas par "-=~", ni par une parenthèse - \CF@expand@second\CF@if@firsttokmatch\CF@remain@molecule*% un cycle ? + \csname @\ifx*\CF@toks@a first\else second\fi oftwo\endcsname% un cycle ? {\ifnum\CF@last@action=\tw@ \CF@insert@emptygroup\CF@remain@molecule% insère un groupe vide \else @@ -590,6 +620,8 @@ \ifnum\CF@doublebond@type=\z@ \let\CF@doublebond@type\@ne \fi + \pgfmathparse{\CF@double@sep*tan(180/\CF@cycle@num)}% + \let\CF@doublebond@lengthcorrection\pgfmathresult \fi \ifcase\CF@doublebond@type \CF@create@normnodes{#2@@}{#3@@}{\CF@double@sep/2}{\CF@double@sep/2}% @@ -598,11 +630,31 @@ \or \CF@create@normnodes{#2@@}{#3@@}\CF@double@sep\CF@double@sep \CF@draw@bond@i(#2@@)--(#3@@); - \CF@draw@bond@i(#2@@1)--(#3@@1); + \begingroup% ajuste éventuellement les longueurs des liaisons doubles + \ifCF@incycle + \ifdim\CF@start@offset=\z@ + \CF@add@tocs\CF@current@tikz{,shorten <=\CF@doublebond@lengthcorrection pt}% + \fi + \ifdim\CF@end@offset=\z@ + \CF@add@tocs\CF@current@tikz{,shorten >=\CF@doublebond@lengthcorrection pt}% + \fi + \fi + \CF@draw@bond@i(#2@@1)--(#3@@1); + \endgroup \or \CF@create@normnodes{#2@@}{#3@@}\CF@double@sep\CF@double@sep \CF@draw@bond@i(#2@@)--(#3@@); - \CF@draw@bond@i(#2@@2)--(#3@@2); + \begingroup% ajuste éventuellement les longueurs des liaisons doubles + \ifCF@incycle + \ifdim\CF@start@offset=\z@ + \CF@add@tocs\CF@current@tikz{,shorten <=-\CF@doublebond@lengthcorrection pt}% + \fi + \ifdim\CF@end@offset=\z@ + \CF@add@tocs\CF@current@tikz{,shorten >=-\CF@doublebond@lengthcorrection pt}% + \fi + \fi + \CF@draw@bond@i(#2@@2)--(#3@@2); + \endgroup \fi \or% 3 = liaison triple \CF@create@normnodes{#2@@}{#3@@}\CF@double@sep\CF@double@sep @@ -664,6 +716,9 @@ \def\CF@extract@atom#1-#2\@nil{#2}% transforme le bound@outnode en n° de l'atome +\newcommand\setnodestyle{\def\CF@node@style} +\setnodestyle{} + \newcommand*\CF@draw@atomgroup[3]{% #1=angle d'arrivée de la liaison #2=numero atome sur lequel arrive la liaison #3=groupe d'atomes \expandafter\let\expandafter\CF@bond@outcontent% assigne le contenu de l'atome d'où part la liaison \csname\ifdefined\CF@bond@outnode atom@\expandafter\CF@extract@atom\CF@bond@outnode\@nil\else @empty\fi\endcsname @@ -701,14 +756,14 @@ \else \def\CF@node@strut{\vphantom\CF@bond@outcontent}% \fi - \def\CF@node@content{\expandafter\CF@display@chem\expandafter{\csname atom@\number\CF@cnt@atomnumber\endcsname\CF@node@strut}}% - \edef\CF@opt@string{anchor=\ifnum\CF@last@action=\z@ base\else center\fi,at=(CF@node)}% premier atome de la molécule affiché + \def\CF@node@content{\expandafter\printatom\expandafter{\csname atom@\number\CF@cnt@atomnumber\endcsname\CF@node@strut}}% + \edef\CF@opt@string{anchor=\ifnum\CF@last@action=\z@ base\else center\fi,at=(CF@node),\CF@node@style}% premier atome de la molécule affiché \loop \unless\ifnum\CF@cnt@atomnumber>\CF@cnt@atomingroup \expandafter\node\expandafter[\CF@opt@string](n\number\CF@cnt@groupnumber-\number\CF@cnt@atomnumber){\CF@node@content};% \let\CF@node@strut\@empty \advance\CF@cnt@atomnumber\@ne - \edef\CF@opt@string{anchor=base west,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber-1.base east)}% + \edef\CF@opt@string{anchor=base west,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber-1.base east),\CF@node@style}% \repeat \CF@cnt@atomnumber\CF@hook@atomnumber \ifnum\CF@last@action=\tw@% s'il faut tracer une liaison @@ -719,7 +774,7 @@ \loop \ifnum\CF@cnt@atomnumber>\@ne \advance\CF@cnt@atomnumber\m@ne - \edef\CF@opt@string{anchor=base east,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber+1.base west)}% + \edef\CF@opt@string{anchor=base east,at=(n\number\CF@cnt@groupnumber-\number\numexpr\CF@cnt@atomnumber+1.base west),\CF@node@style}% \expandafter\node\expandafter[\CF@opt@string](n\number\CF@cnt@groupnumber-\number\CF@cnt@atomnumber){\CF@node@content};% \repeat \CF@hook@drawall @@ -732,9 +787,17 @@ \else \advance\CF@cnt@atomingroup\@ne \CF@if@firsttokmatch{#1}\egroup - {\CF@expand@second{\def\CF@current@atom}{\expandafter{\@car#1\@nil}}}% - {\CF@expand@second{\def\CF@current@atom}{\@car#1\@nil}}% prend le 1er car - \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}% + {\CF@expand@second{\def\CF@current@atom}{\expandafter{\@car#1\@nil}}% + \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}% + }% + {\CF@if@spacefirst{#1}% + {\def\CF@current@atom{ }% + \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\CF@after@space#1\@nil}% + }% + {\CF@expand@second{\def\CF@current@atom}{\@car#1\@nil}% + \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}% + }% + }% \fi } @@ -743,35 +806,40 @@ \expandafter\let\csname atom@\number\CF@cnt@atomingroup\endcsname\CF@current@atom \let\CF@current@atom\@empty \else - \CF@if@firsttokmatch{#1}\bgroup - {\CF@expadd@tocs\CF@current@atom{\expandafter{\@car#1\@nil}}% - \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}% - }% - {\CF@expand@second\CF@ifcar@isupperletter{\@car#1\@nil}% - {\expandafter\let\csname atom@\number\CF@cnt@atomingroup\endcsname\CF@current@atom - \let\CF@current@atom\@empty - \CF@swap@fi\CF@draw@atomgroup@i{#1} + \CF@if@spacefirst{#1}% + {\CF@expadd@tocs\CF@current@atom{ }% + \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\CF@after@space#1\@nil}% + } + {\CF@if@firsttokmatch{#1}\bgroup + {\CF@expadd@tocs\CF@current@atom{\expandafter{\@car#1\@nil}}% + \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}% }% - {\CF@if@firsttokmatch{#1}?% - {\expandafter\CF@if@firsttokmatch\expandafter{\@gobble#1}[% un crochet après le "?" - {\expandafter\CF@grab@optarg\@gobble#1\@nil\CF@after@hook}% - {\expandafter\CF@grab@optarg\expandafter[\expandafter]\@gobble#1\@nil\CF@after@hook}% - \CF@expand@second{\CF@expand@second\CF@if@instr\CF@hook@list}{\expandafter(\CF@hook@currentname)}% crochet déjà défini ? - {\expandafter\CF@hook@parselist\expandafter{\CF@hook@currentname}% va chercher les caractéristiques du crochet sauvegardé - \CF@edefadd@tocs\CF@hook@drawlist{% - [\CF@hook@currentname,\CF@hook@currentlink,\CF@hook@currenttikz]{\CF@hook@savedcoord}{n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup}}% - \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@hook@savedcontent}}% - \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@current@atom}}% ajoute les 4 arguments à la liste des crochets à tracer - \CF@global@let\CF@hook@drawlist\CF@hook@drawlist + {\CF@expand@second\CF@ifcar@isupperletter{\@car#1\@nil}% + {\expandafter\let\csname atom@\number\CF@cnt@atomingroup\endcsname\CF@current@atom + \let\CF@current@atom\@empty + \CF@swap@fi\CF@draw@atomgroup@i{#1} + }% + {\CF@if@firsttokmatch{#1}?% + {\expandafter\CF@if@firsttokmatch\expandafter{\@gobble#1}[% un crochet après le "?" + {\expandafter\CF@grab@optarg\@gobble#1\@nil\CF@after@hook}% + {\expandafter\CF@grab@optarg\expandafter[\expandafter]\@gobble#1\@nil\CF@after@hook}% + \CF@expand@second{\CF@expand@second\CF@if@instr\CF@hook@list}{\expandafter(\CF@hook@currentname)}% crochet déjà défini ? + {\expandafter\CF@hook@parselist\expandafter{\CF@hook@currentname}% va chercher les caractéristiques du crochet sauvegardé + \CF@edefadd@tocs\CF@hook@drawlist{% + [\CF@hook@currentname,\CF@hook@currentlink,\CF@hook@currenttikz]{\CF@hook@savedcoord}{n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup}}% + \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@hook@savedcontent}}% + \CF@expadd@tocs\CF@hook@drawlist{\expandafter{\CF@current@atom}}% ajoute les 4 arguments à la liste des crochets à tracer + \CF@global@let\CF@hook@drawlist\CF@hook@drawlist + }% + {\CF@edefadd@tocs\CF@hook@list{(\CF@hook@currentname)|n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup|}% + \CF@expadd@tocs\CF@hook@list{\CF@current@atom|}% + \CF@global@let\CF@hook@list\CF@hook@list + }% + \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii\CF@after@hook }% - {\CF@edefadd@tocs\CF@hook@list{(\CF@hook@currentname)|n\number\CF@cnt@groupnumber-\number\CF@cnt@atomingroup|}% - \CF@expadd@tocs\CF@hook@list{\CF@current@atom|}% - \CF@global@let\CF@hook@list\CF@hook@list + {\CF@expadd@tocs\CF@current@atom{\@car#1\@nil}% + \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}% }% - \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii\CF@after@hook - }% - {\CF@expadd@tocs\CF@current@atom{\@car#1\@nil}% - \CF@swap@fi\CF@expand@second\CF@draw@atomgroup@ii{\@gobble#1}% }% }% }% @@ -824,43 +892,52 @@ \newcommand*\setlewis[3]{% \ifx\@empty#1\@empty\def\CF@lewis@offset{1.5pt}\else\def\CF@lewis@offset{#1}\fi - \ifx\@empty#2\@empty\def\CF@lewis@length{8pt}\else\def\CF@lewis@length{#2}\fi - \ifx\@empty#3\@empty\def\CF@lewis@style{}\else\def\CF@lewis@style{#3}\fi} + \ifx\@empty#2\@empty\def\CF@lewis@length{1.5ex}\else\def\CF@lewis@length{#2}\fi + \ifx\@empty#3\@empty\def\CF@lewis@style{}\else\def\CF@lewis@style{#3}\fi +} + \setlewis{}{}{} \newcommand*\lewis[1]{\begingroup\@makeother;\CF@lewis@i#1\@nil} \def\CF@lewis@i#1,#2\@nil% {% - \setbox\CF@lewis@box\hbox{\CF@display@chem{#2}}% + \setbox\CF@lewis@box\hbox{\printatom{#2}}% \def\CF@lewis@remainpos{#1}% \let\CF@lewis@previouspos\@empty \loop \unless\ifx\CF@lewis@remainpos\@empty - \edef\CF@lewis@currentpos{\expandafter\@car\CF@lewis@remainpos\@nil}% - \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}% - \pgfmathparse{\wd\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF@lewis@box/2+\CF@lewis@offset)}% - \let\CF@lewis@x\pgfmathresult - \pgfmathparse{\ht\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF@lewis@box/2\ifnum\CF@lewis@currentpos>4 +\dp\CF@lewis@box\fi+\CF@lewis@offset)}% - \let\CF@lewis@y\pgfmathresult - \edef\CF@lewis@xoffset{\ifcase\CF@lewis@currentpos\space0\or0.7071\or1\or0.7071\or0\or-0.7071\or-1\or-0.7071\fi}% - \edef\CF@lewis@yoffset{\ifcase\CF@lewis@currentpos\space-1\or-0.7071\or0\or0.7071\or1\or0.7071\or0\or-0.7071\fi}% - \if.\expandafter\@car\CF@lewis@remainpos\relax\@nil + \edef\CF@lewis@currentpos{\expandafter\@car\CF@lewis@remainpos\@nil}% \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}% - \tikz \draw[overlay,fill,black] ([xshift=-\CF@lewis@yoffset*0.8,yshift=\CF@lewis@xoffset*0.8]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt);% - \else - \if|\expandafter\@car\CF@lewis@remainpos\relax\@nil + \pgfmathparse{\wd\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF@lewis@box/2+\CF@lewis@offset)}% + \let\CF@lewis@x\pgfmathresult + \pgfmathparse{\ht\CF@lewis@box/2+\ifcase\CF@lewis@currentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF@lewis@box/2\ifnum\CF@lewis@currentpos>4 +\dp\CF@lewis@box\fi+\CF@lewis@offset)}% + \let\CF@lewis@y\pgfmathresult + \edef\CF@lewis@xoffset{\ifcase\CF@lewis@currentpos\space0\or0.7071\or1\or0.7071\or0\or-0.7071\or-1\or-0.7071\fi}% + \edef\CF@lewis@yoffset{\ifcase\CF@lewis@currentpos\space-1\or-0.7071\or0\or0.7071\or1\or0.7071\or0\or-0.7071\fi}% + \if.\expandafter\@car\CF@lewis@remainpos\relax\@nil \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}% - \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]% - (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)-- - ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x-\CF@lewis@xoffset*\CF@lewis@length/2 pt,\CF@lewis@y-\CF@lewis@yoffset*\CF@lewis@length/2 pt)-- - ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)-- - (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)--cycle;% + \tikz \draw[overlay,fill,black] ([xshift=-\CF@lewis@yoffset*0.8,yshift=\CF@lewis@xoffset*0.8]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt);% \else - \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]% - (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)--% - (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt);% - \fi + \if|\expandafter\@car\CF@lewis@remainpos\relax\@nil + \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}% + \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]% + (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)-- + ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x-\CF@lewis@xoffset*\CF@lewis@length/2 pt,\CF@lewis@y-\CF@lewis@yoffset*\CF@lewis@length/2 pt)-- + ([xshift=-\CF@lewis@yoffset*2,yshift=\CF@lewis@xoffset*2]\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)-- + (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt)--cycle;% + \else + \if:\expandafter\@car\CF@lewis@remainpos\relax\@nil + \edef\CF@lewis@remainpos{\expandafter\@gobble\CF@lewis@remainpos}% + \tikz \draw[overlay,fill,black] + ([xshift=-2*\CF@lewis@xoffset,yshift=-2*\CF@lewis@yoffset]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt)% + ([xshift=2*\CF@lewis@xoffset,yshift=2*\CF@lewis@yoffset]\CF@lewis@x pt,\CF@lewis@y pt)circle(0.8pt);% + \else + \expandafter\tikz\expandafter\draw\expandafter[\CF@lewis@style,overlay]% + (\CF@lewis@x-\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y-\CF@lewis@length*\CF@lewis@yoffset/2 pt)--% + (\CF@lewis@x+\CF@lewis@length*\CF@lewis@xoffset/2 pt,\CF@lewis@y+\CF@lewis@length*\CF@lewis@yoffset/2 pt);% + \fi + \fi \fi \repeat \box\CF@lewis@box @@ -868,13 +945,13 @@ } \newcommand*\chembelow[3][1.5pt]{% - \setbox\CF@box@boxa\hbox{\CF@display@chem{#2}}\setbox\CF@box@boxb\hbox{\CF@display@chem{#3}}% + \setbox\CF@box@boxa\hbox{\printatom{#2}}\setbox\CF@box@boxb\hbox{\printatom{#3}}% \vtop{% - \hbox{\CF@display@chem{#2}}% + \hbox{\printatom{#2}}% \hrule width0pt depth0pt height#1\relax \hbox{% \hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax - \CF@display@chem{#3}% + \printatom{#3}% \hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax }% \vskip-\dimexpr\ht\CF@box@boxb+\dp\CF@box@boxb+#1\relax @@ -882,13 +959,13 @@ } \newcommand*\chemabove[3][1.5pt]{% - \setbox\CF@box@boxa\hbox{\CF@display@chem{#2}}\setbox\CF@box@boxb\hbox{\CF@display@chem{#3}}% + \setbox\CF@box@boxa\hbox{\printatom{#2}}\setbox\CF@box@boxb\hbox{\printatom{#3}}% \vtop{% - \hbox{\CF@display@chem{#2}}% + \hbox{\printatom{#2}}% \hrule width0pt depth0pt height-\dimexpr#1+\ht\CF@box@boxa+\ht\CF@box@boxb+\dp\CF@box@boxb\relax \hbox{% \hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax - \CF@display@chem{#3}% + \printatom{#3}% \hskip\dimexpr(\wd\CF@box@boxa-\wd\CF@box@boxb)/2\relax }% }% @@ -938,9 +1015,24 @@ \def\CF@remove@equichars#1<>#2\@nil{#1#2} \endinput -##################################################################### -# Historique # -##################################################################### - -v0.1 2010/06/23 Première version publique sur le CTAN ----------------------------------------------------------------------
\ No newline at end of file +###################################################################### +# Historique # +###################################################################### + +v0.1 2010/06/23 + - Première version publique sur le CTAN +---------------------------------------------------------------------- +v0.2 2010/08/31 + - Ajout de la documentation en anglais. + - Correction de bugs. + - \printatom est désormais une macro publique. + - Les espaces sont permis dans les molécules. Ils seront + ignorés par défaut puisque les atomes sont composés en mode + math par \printatom + - Une paire de Lewis peut être représentée ":". + - Dans les cycles, une correction de la longueur du trait + déporté des liaisons doubles est fait de telle sorte que si + l'on écrit \chemfig{*5(=====)}, on obtient deux polygones + réguliers concentriques. + - La séquence de contrôle \setnodestyle permet de spécifier le + style des nœuds dessinés par tikz.
\ No newline at end of file |