diff options
author | Karl Berry <karl@freefriends.org> | 2020-07-13 21:10:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2020-07-13 21:10:07 +0000 |
commit | 1f17cf107fbe98a4f0e280b82af0768266bc3446 (patch) | |
tree | aca26a205eb0f17ed57c26025654539bf8caad67 /Master/texmf-dist/tex/generic | |
parent | b5ace0fe467478d11be04649421226e574f4b556 (diff) |
chemfig (13jul20)
git-svn-id: svn://tug.org/texlive/trunk@55828 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r-- | Master/texmf-dist/tex/generic/chemfig/chemfig.tex | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/Master/texmf-dist/tex/generic/chemfig/chemfig.tex b/Master/texmf-dist/tex/generic/chemfig/chemfig.tex index 456b400edb3..6c743b24e36 100644 --- a/Master/texmf-dist/tex/generic/chemfig/chemfig.tex +++ b/Master/texmf-dist/tex/generic/chemfig/chemfig.tex @@ -4,9 +4,9 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % \def\CFname {chemfig} % -\def\CFver {1.55} % +\def\CFver {1.56} % % % -\def\CFdate {2020/06/15} % +\def\CFdate {2020/07/13} % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -56,22 +56,18 @@ %-------------------- Vérification des prérequis --------------------- \def\CF_error#1{\errmessage{Package \CFname\space Error: #1.}} \def\CF_warning#1{\immediate\write-1{Package \CFname\space Warning: #1^^J}} -\def\CF_checkprimitive#1#2#3{% Vérifie que #1 est une primitive et sinon, émet le message #2 et exécute #3 +\def\CF_checkprimitive#1#2{% Vérifie que #1 est une primitive et sinon, émet le message #2 et exécute \endinput \begingroup \edef\__tempa{\meaning#1}\edef\__tempb{\string#1}\expandafter \endgroup \ifx\__tempa\__tempb\else \CF_error{#2}% - \def\CF_temp{\CFrestorecatcode#3}% + \def\CF_temp{\CFrestorecatcode\endinput}% \expandafter\CF_temp \fi } -\CF_checkprimitive\eTeXversion - {You are not using an eTeX engine, \CFname\space cannot work.} - {\endinput}% -\CF_checkprimitive\expanded - {the \string\expanded\space primitive is not provided by your TeX engine, \CFname\space cannot work.} - {\endinput}% +\CF_checkprimitive\eTeXversion{You are not using an eTeX engine, \CFname\space cannot work.} +\CF_checkprimitive\expanded{the \string\expanded\space primitive is not provided by your TeX engine, \CFname\space cannot work.} %------------------------ Chargement simplekv ------------------------ \input simplekv.tex @@ -88,6 +84,7 @@ \newcount\CF_cntgroup \newcount\CF_cntatom \newcount\CF_cntcycle +\newcount\CF_cntcyclebonds \newcount\CF_cntcompound \newif\ifCF_incycle @@ -185,7 +182,7 @@ \def\CF_ifinteger#1{% \begingroup \afterassignment\CF_afterinteger - \CF_cntcycle0#1\relax + \CF_cntcyclebonds0#1\relax } \def\CF_afterinteger#1\relax{% \endgroup @@ -434,7 +431,9 @@ arrow head = -CF, + sep left = 0.5em, + sep right = 0.5em, - + vshift = 0pt + + vshift = 0pt, + autoreset cntcycle = true, + show cntcycle = false, }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -823,6 +822,9 @@ {\let\CF_clipcramornot\clip}% \CF_incyclefalse \CF_cntgroup0 + \ifboolKV[chemfig]{autoreset cntcycle} + {\global\CF_cntcycle0 } + {}% \let\CF_lastaction\CF_zero% 0=début du dessin 1=tracé d'un noeud 2=tracé d'une liaison \let\CF_startoffset\empty \let\CF_endoffset\empty @@ -854,7 +856,7 @@ \ifCF_incycle \def\CF_defaultangle{0}% \else - \ifnum\CF_cntcycle=0 % si c'est le début d'un cycle + \ifnum\CF_cntcyclebonds=0 % si c'est le début d'un cycle \pgfmathsetmacro\CF_defaultangle{\CF_previousangle+180+\CF_cycleanglecorrection}% on met la liaison à +180° + correction \else \pgfmathsetmacro\CF_defaultangle{\CF_previousangle-90+180/\CF_cyclenum}% sinon à la bissectrice du sommet du cycle @@ -884,13 +886,16 @@ \let\CF_currenttikz\CF_defaulttikz \ifCF_incycle% si on commence un cycle \let\CF_currentangle\CF_previousangle + \pgfmathsetmacro\CF_cyclearcinitangle{\CF_currentangle+\CF_initcycleangle+180/\CF_cyclenum+90}% + \pgfmathsetmacro\CF_centeroffset{\CF_currentlength*\CF_atomsep/(2*sin(180/\CF_cyclenum))}% + \node[at=(\CF_bondoutnode),shift=(\CF_cyclearcinitangle:\CF_centeroffset pt),anchor=center](cyclecenter\number\CF_cntcycle){};% le centre du cycle + \ifboolKV[chemfig]{show cntcycle} + {\node[at=(cyclecenter\number\CF_cntcycle),anchor=center,overlay]{\tiny\number\CF_cntcycle};} + {}% \ifCF_cyclearc% on doit tracer l'arc de cercle dans le cycle ? \pgfmathsetmacro\CF_cyclearcradius{\CF_cycleradiuscoeff*\CF_currentlength*\CF_atomsep/(2*tan(180/\CF_cyclenum))}% - \pgfmathsetmacro\CF_cyclearcinitangle{\CF_currentangle+\CF_initcycleangle+180/\CF_cyclenum+90} - \pgfmathparse{\CF_currentlength*\CF_atomsep/(2*sin(180/\CF_cyclenum))}% - \node[at=(\CF_bondoutnode),shift=(\CF_cyclearcinitangle:\pgfmathresult pt)](arccenter){};% le centre de l'arc - \node[at=(arccenter),shift=(\CF_cyclearcstartangle:\CF_cyclearcradius pt)](initarc){};% le début de l'arc - \CF_expafter{\draw[}\CF_cyclearcdirecttikz](initarc) arc (\CF_cyclearcstartangle:\CF_cyclearcendangle:\CF_cyclearcradius pt); + \node[at=(cyclecenter\number\CF_cntcycle),shift=(\CF_cyclearcstartangle:\CF_cyclearcradius pt)](initarc){};% le début de l'arc + \CF_expafter{\draw[}\CF_cyclearcdirecttikz](initarc) arc (\CF_cyclearcstartangle:\CF_cyclearcendangle:\CF_cyclearcradius pt);% \fi \else \let\CF_currentangle\CF_defaultangle @@ -934,16 +939,16 @@ \edef\CF_bondoutnode{\CF_bondoutnode}% \else \ifCF_incycle - \advance\CF_cntcycle1 + \advance\CF_cntcyclebonds1 \fi \CF_expsecond\CF_analysebond{\CF_molecule}\CF_bondtype \edef\CF_bondoutnode{\CF_bondoutnode}% \let\CF_molecule\CF_remainafterbond \ifCF_incycle - \ifnum\CF_cntcycle=\CF_cyclenum\relax + \ifnum\CF_cntcyclebonds=\CF_cyclenum\relax \CF_threeea\CF_execfirst \else - \ifnum\CF_cntcycle=1 + \ifnum\CF_cntcyclebonds=1 \let\CF_cyclefirsttikz\CF_currenttikz \CF_doifnotempty\CF_startoffset{\let\CF_cyclejoinlast\CF_zero}% \fi @@ -1006,13 +1011,14 @@ {\expandafter\CF_cycleparsepreamble\CF_molecule\_nil% \begingroup inclus \CF_cyclearcfalse }% - \CF_cntcycle0 + \CF_cntcyclebonds0 \edef\CF_hookcycle{\CF_bondoutnode}% \let\CF_hookatomgroup\CF_previousatomgroup \CF_ifzerodim\CF_hookatomgroup {\def\CF_cyclejoinlast{1}}% joindre le dernier {\def\CF_cyclejoinlast{0}}% \CF_incycletrue + \global\advance\CF_cntcycle1 \ifnum\CF_lastaction=3 \pgfmathsetmacro\CF_initcycleangle{360/\CF_lastcyclenum-180}% c'est un cycle dans un cycle \else @@ -1234,12 +1240,12 @@ \def\CF_drawaxisbondnojoin#1#2{\CF_drawbonda(#1@@)--(#2@@);} \def\CF_drawaxisbondjoin#1#2{% dessine une liaison simple dans l'axe avec raccord rétrograde - \ifCF_incycle\ifnum\CF_cntcycle=\CF_cyclenum\relax + \ifCF_incycle\ifnum\CF_cntcyclebonds=\CF_cyclenum\relax \let\CF_nexttikz\CF_cyclefirsttikz \fi\fi \ifnum\CF_joinbond=0 \ifCF_incycle - \ifnum\CF_cntcycle=\CF_cyclenum\relax + \ifnum\CF_cntcyclebonds=\CF_cyclenum\relax \ifnum\CF_cyclejoinlast=1 \CF_drawbonda(#1@@)--(#2@@)--% ([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@); @@ -1262,7 +1268,7 @@ } {\ifdim\CF_startoffset=0pt \ifCF_incycle - \ifnum\CF_cntcycle=\CF_cyclenum\relax + \ifnum\CF_cntcyclebonds=\CF_cyclenum\relax \ifnum\CF_cyclejoinlast=1 \CF_ifx\CF_cyclefirsttikz\CF_currenttikz {\CF_drawbonda([shift=(\CF_previousbondangle:-.5\pgflinewidth)]#1@@)--(#1@@)--(#2@@)--% @@ -1287,7 +1293,7 @@ {\CF_drawbonda(#1@@)--(#2@@);}% } {\ifCF_incycle - \ifnum\CF_cntcycle=\CF_cyclenum\relax + \ifnum\CF_cntcyclebonds=\CF_cyclenum\relax \ifnum\CF_cyclejoinlast=1 \CF_ifx\CF_nexttikz\CF_currenttikz {\CF_drawbonda(#1@@)--(#2@@)--([shift=(\CF_previousbondangle+2*\CF_cycleincrementangle:.5\pgflinewidth)]#2@@);}% @@ -3086,4 +3092,8 @@ v1.54 2020/05/21 v1.55 2020/06/15 - chemfig est incompatible avec conTeXt, vu que ce moteur redéfinit des primitives telles que \expanded, \unexpanded et peut être - d'autres.
\ No newline at end of file + d'autres. +---------------------------------------------------------------------- +v1.56 2020/07/13 + - le centre des cycles est désormais accessible via un noeud + spécifique pour chacun d'eux.
\ No newline at end of file |