summaryrefslogtreecommitdiff
path: root/macros/generic/chemfig/chemfig.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/generic/chemfig/chemfig.tex')
-rw-r--r--macros/generic/chemfig/chemfig.tex317
1 files changed, 160 insertions, 157 deletions
diff --git a/macros/generic/chemfig/chemfig.tex b/macros/generic/chemfig/chemfig.tex
index bf66ce58d1..3764ace94d 100644
--- a/macros/generic/chemfig/chemfig.tex
+++ b/macros/generic/chemfig/chemfig.tex
@@ -4,9 +4,9 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
\def\CFname {chemfig} %
-\def\CFver {1.52} %
+\def\CFver {1.53} %
% %
-\def\CFdate {2020/04/14} %
+\def\CFdate {2020/04/27} %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -72,10 +72,7 @@
{\input chemfigold.tex\relax\endinput}%
%------------------------ Chargement simplekv ------------------------
-\unless\ifdefined\skvname
- \begingroup\def\CFtemp{\endgroup\input simplekv.tex\relax}%
- \expandafter\CFtemp
-\fi
+\input simplekv.tex
%-------------------------- Chargement tikz --------------------------
\unless\ifdefined\tikzpicture
@@ -129,12 +126,20 @@
\def\CF_ifnum#1{\ifnum#1\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
\def\CF_ifinsidetikz{\ifdefined\pgfpictureid\expandafter\CF_execfirst\else\expandafter\CF_execsecond\fi}
\def\CF_ifzerodim#1{%
- \setbox\CF_testbox\hbox{\printatom{#1}}%
+ \setbox\CF_testbox\hbox{\pgfinterruptpicture\printatom{#1}\endpgfinterruptpicture}% bugfix 1.53
\CF_ifnum{1\ifdim\wd\CF_testbox=\CF_zero0\fi\ifdim\ht\CF_testbox=\CF_zero0\fi\ifdim\dp\CF_testbox=\CF_zero0\fi=1000 }
}
\def\CF_doifempty#1{\ifx\empty#1\empty\expandafter\CF_id\else\expandafter\CF_gobarg\fi}
\def\CF_doifnotempty#1{\ifx\empty#1\empty\expandafter\CF_gobarg\else\expandafter\CF_id\fi}
\def\CF_gobtonil#1\_nil{}
+\def\CF_striplastsp#1{%
+ \long\def\CF_stripsp##1##2{\expanded{\CF_stripsp_i\_marksp##1\__nil\_marksp#1\_marksp\_nil{##2}}}%
+ \long\def\CF_stripsp_i##1\_marksp#1##2\_marksp##3\_nil{\CF_stripsp_ii##3##1##2\__nil#1\__nil\_nil}%
+ \long\def\CF_stripsp_ii##1#1\__nil##2\_nil{\CF_stripsp_iii##1##2\_nil}%
+ \long\def\CF_stripsp_iii##1##2\__nil##3\_nil##4{\unexpanded{##4{##2}}}%
+ \long\def\CF_striplastsp##1##2{\expanded{\CF_striplastsp_i\_marksp##1\__nil#1\__nil\_nil{##2}}}%
+ \long\def\CF_striplastsp_i##1#1\__nil##2\_nil{\CF_stripsp_iii##1\__nil\_nil}%
+}\CF_striplastsp{ }
\edef\CFhash{\string#}
\begingroup
\catcode`\_8
@@ -213,12 +218,6 @@
\CF_ifinstra#1\__nil#2\_nil
}
\def\CF_afterspace#1 #2\_nil{#2}
-\def\CF_valuetomacro[#1]#2[#3]#4{% #1=trousseau #2= macro #3=valeur défaut #4=clé
- \CF_eexpsecond{\def#2}{\useKV[#1]{#4}}%
- \CF_ifx#2\empty
- {\def#2{#3}}
- {}%
-}
%--------------------------- Substitution ----------------------------
\def\CF_ifstartwith#1#2{% #1=<texte> #2=<motif>
@@ -357,50 +356,84 @@
}
%---------------------------- Paramètres -----------------------------
-\def\setchemfig{\setKV[chemfig]}
-\def\resetchemfig{%
- \setKVdefault[chemfig]{%
- atom style ={},% code tikz mis à la fin de every node/.style
- chemfig style ={},% code tikz mis à la fin de l'arugment optionnel de \tikzpicture
- bond join =false,
- fixed length =false,
- cram rectangle =false,
- cram width =1.5ex,
- cram dash width =1pt,
- cram dash sep =2pt,
- atom sep =3em,
- bond offset =2pt,
- double bond sep =2pt,
- angle increment =45,
- node style ={},
- bond style ={},
- lewis | width =0.3ex,
- lewis sep =0.4ex,
- lewis length =1.5ex,
- lewis style ={},
- lewis dist =0.3em,
- lewis radius =0.15ex,
- lewis diag coeff =1,
- cycle radius coeff =0.75,
- stack sep =1.5pt,
- scheme debug =false,
- compound style ={},
- compound sep =5em,
- arrow offset =4pt,
- arrow angle =0,
- arrow coeff =1,
- arrow style ={},
- arrow double sep =2pt,
- arrow double coeff =0.6,
- arrow double harpoon=true,
- arrow label sep =3pt,
- arrow head =-CF,
- + sep left =0.5em,
- + sep right =0.5em,
- + vshift =0pt,
- }%
+\def\CF_defifempty#1#2#3{\CF_ifempty{#2}{\def#1{#3}}{\def#1{#2}}}
+\defKV[chemfig]{%
+ atom style = \def\CF_atomstyle {#1},
+ chemfig style = \def\CF_chemfigstyle {#1},
+ cram width = \CF_defifempty\CF_crambasewidth {#1}{1.5ex},
+ cram dash width = \CF_defifempty\CF_cramdashlength {#1}{1pt},
+ cram dash sep = \CF_defifempty\CF_cramdashsep {#1}{2pt},
+ atom sep = \CF_defifempty\CF_atomsep {#1}{3em},
+ bond offset = \CF_defifempty\CF_bondoffset {#1}{2pt},
+ double bond sep = \CF_defifempty\CF_doublesep {#1}{2pt},
+ angle increment = \CF_defifempty\CF_angleincrement {#1}{45},
+ node style = \def\CF_nodestyle {#1},
+ bond style = \def\CF_bondstyle {#1},
+ lewis | width = \CF_defifempty\CF_lewiswidthdouble {#1}{0.3ex},
+ lewis sep = \CF_defifempty\CF_lewisoffset {#1}{0.4ex},
+ lewis length = \CF_defifempty\CF_lewislength {#1}{1.5ex},
+ lewis style = \def\CF_lewisstyle {#1},
+ lewis dist = \CF_defifempty\CF_lewisdist {#1}{0.3em},
+ lewis radius = \CF_defifempty\CF_lewisradius {#1}{0.15ex},
+ lewis diag coeff = \CF_defifempty\CF_lewisdiagcoeff {#1}{1},
+ cycle radius coeff = \CF_defifempty\CF_cycleradiuscoeff {#1}{0.75},
+ stack sep = \CF_defifempty\CF_stacksep {#1}{1.5pt},
+ compound style = \def\CF_defaultcompoundstyle {#1},
+ compound sep = \CF_defifempty\CF_compoundsep {#1}{5em},
+ arrow offset = \CF_defifempty\CF_arrowoffset {#1}{1em},
+ arrow angle = \CF_defifempty\CF_arrowangle {#1}{0},
+ arrow coeff = \CF_defifempty\CF_arrowlength {#1}{1},
+ arrow style = \def\CF_defaultarrowstyle {#1},
+ arrow double sep = \CF_defifempty\CF_arrowdoublesep {#1}{2pt},
+ arrow double coeff = \CF_defifempty\CF_arrowdoubleposstart{#1}{0.6},
+ arrow label sep = \CF_defifempty\CF_arrowlabelsep {#1}{3pt},
+ arrow head = \CF_defifempty\CF_arrowhead {#1}{-CF},
+ + sep left = \CF_defifempty\CF_signspaceante {#1}{0.5em},
+ + sep right = \CF_defifempty\CF_signspacepost {#1}{0.5em},
+ + vshift = \CF_defifempty\CF_signvshift {#1}{0pt}
}
-\resetchemfig
+\def\setchemfig{\setKV[chemfig]}
+\def\resetchemfig{\restoreKV[chemfig]}
+\setKVdefault[chemfig]{%
+ atom style = {},% code tikz mis à la fin de every node/.style
+ chemfig style = {},% code tikz mis à la fin de l'arugment optionnel de \tikzpicture
+ bond join = false,
+ fixed length = false,
+ cram rectangle = false,
+ cram width = 1.5ex,
+ cram dash width = 1pt,
+ cram dash sep = 2pt,
+ atom sep = 3em,
+ bond offset = 2pt,
+ double bond sep = 2pt,
+ angle increment = 45,
+ node style = {},
+ bond style = {},
+ lewis | width = 0.3ex,
+ lewis sep = 0.4ex,
+ lewis length = 1.5ex,
+ lewis style = {},
+ lewis dist = 0.3em,
+ lewis radius = 0.15ex,
+ lewis diag coeff = 1,
+ cycle radius coeff = 0.75,
+ stack sep = 1.5pt,
+ scheme debug = false,
+ compound style = {},
+ compound sep = 5em,
+ arrow offset = 1em,
+ arrow angle = 0,
+ arrow coeff = 1,
+ arrow style = {},
+ arrow double sep = 2pt,
+ arrow double coeff = 0.6,
+ arrow double harpoon= true,
+ arrow label sep = 3pt,
+ arrow head = -CF,
+ + sep left = 0.5em,
+ + sep right = 0.5em,
+ + vshift = 0pt
+}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% D E S S I N M O L É C U L E S %%%
@@ -769,10 +802,10 @@
inner sep=0pt,%
outer sep=0pt,%
minimum size=0pt,%
- \unexpanded\CF_threeea{\useKV[chemfig]{atom style}}%
+ \unexpanded\expandafter{\CF_atomstyle}%
},%
baseline,%
- \unexpanded\CF_threeea{\useKV[chemfig]{chemfig style}}%
+ \unexpanded\expandafter{\CF_chemfigstyle}%
]%
}%
\begingroup% \endgroup rajouté en sortie de tracé par \CF_chemfigd
@@ -786,17 +819,6 @@
\ifboolKV[chemfig]{cram rectangle}
{\let\CF_clipcramornot\CF_gobtikzinstruction}
{\let\CF_clipcramornot\clip}%
- \CF_valuetomacro[chemfig]\CF_crambasewidth [1.5ex]{cram width}%
- \CF_valuetomacro[chemfig]\CF_cramdashlength [1pt]{cram dash width}%
- \CF_valuetomacro[chemfig]\CF_cramdashsep [2pt]{cram dash sep}%
- \CF_valuetomacro[chemfig]\CF_atomsep [3em]{atom sep}% espacement des atomes liés
- \CF_valuetomacro[chemfig]\CF_bondoffset [2pt]{bond offset}%
- \CF_valuetomacro[chemfig]\CF_doublesep [2pt]{double bond sep}%
- \CF_valuetomacro[chemfig]\CF_angleincrement [45]{angle increment}%
- \CF_valuetomacro[chemfig]\CF_nodestyle []{node style}%
- \CF_valuetomacro[chemfig]\CF_bondstyle []{bond style}%
- \CF_valuetomacro[chemfig]\CF_stacksep [1.5pt]{stack sep}%
- \CF_valuetomacro[chemfig]\CF_cycleradiuscoeff[0.75]{cycle radius coeff}% coeff multiplicateur du rayon des arcs dans les cycles
\CF_incyclefalse
\CF_cntgroup0
\let\CF_lastaction\CF_zero% 0=début du dessin 1=tracé d'un noeud 2=tracé d'une liaison
@@ -1575,47 +1597,49 @@
\def\CF_removehookb#1?[#2]#3\_nil#4{\CF_expsecond{\def#4}{\CF_gobarg#1#3}}
-\def\setcharge#{\setKV[charge]}
-\def\resetcharge{%
- \setKVdefault[charge]{%
- debug = false,% trace les contours des noeuds
- macro atom = \printatom,%macro qui prendra comme argument l'atome recevant la charge
- circle = false,% false => noeud atome = rectangle
- macro charge = ,% macro attendue (\printatom ou \ensuremath, par exemple) qui prendra comme argument la charge
- extra sep = 1.5pt,% séparation additionnelle entre le noeud (cercle ou rectangle) et la position des charges
- overlay = true,% charges en "surimpression"
- shortcuts = true,% raccourcis \. \: \| et \" actifs pour Lewis
- lewisautorot = true,% rotation auto charge Lewis
- .radius = 0.15ex,% rayon du point
- :sep = 0.3em,% séparation des deux points
- .style = {fill=black},% style des points
- "length = 1.5ex,% longueur rectangle
- "width = .3ex,% largeur rectangle
- "style = {black,line width=0.4pt},% style rectangle
- |style = {black,line width=0.4pt},% style ligne
- }%
+\defKV[charge]{%
+ .radius = \CF_defifempty\CF_dotradius {#1}{0.15ex},
+ :sep = \CF_defifempty\CF_dotsep {#1}{0.3em},
+ .style = \CF_defifempty\CF_dotstyle {#1}{fill=black},
+ "length = \CF_defifempty\CF_rectlength{#1}{1.5ex},
+ "width = \CF_defifempty\CF_rectwidth {#1}{.3ex}
}
-\resetcharge
+\def\setcharge#{\setKV[charge]}
+\def\resetcharge{\restoreKV[charge]}
+\setKVdefault[charge]{%
+ debug = false,% trace les contours des noeuds
+ macro atom = \printatom,%macro qui prendra comme argument l'atome recevant la charge
+ circle = false,% false => noeud atome = rectangle
+ macro charge = ,% macro attendue (\printatom ou \ensuremath, par exemple) qui prendra comme argument la charge
+ extra sep = 1.5pt,% séparation additionnelle entre le noeud (cercle ou rectangle) et la position des charges
+ overlay = true,% charges en "surimpression"
+ shortcuts = true,% raccourcis \. \: \| et \" actifs pour Lewis
+ lewisautorot = true,% rotation auto charge Lewis
+ .radius = 0.15ex,% rayon du point
+ :sep = 0.3em,% séparation des deux points
+ .style = {fill=black},% style des points
+ "length = 1.5ex,% longueur rectangle
+ "width = .3ex,% largeur rectangle
+ "style = {black,line width=0.4pt},% style rectangle
+ |style = {black,line width=0.4pt},% style ligne
+}%
\def\chargedot{\CF_testopt\chargedot_a{}}
\def\chargedot_a[#1]{%
\begingroup
\setKV[charge]{#1}%
- \CF_valuetomacro[charge]\CF_dotradius[0.15ex]{.radius}%
- \CF_eexpsecond{\tikz\draw[}{\useKV[charge]{.style}}](0,0)circle(\CF_dotradius);%
+ \CF_expafter{\tikz\draw[}{\CF_dotstyle}](0,0)circle(\CF_dotradius);%
\endgroup
}
\def\chargeddot{\CF_testopt\chargeddot_a{}}
\def\chargeddot_a[#1]{%
\begingroup
\setKV[charge]{#1}%
- \CF_valuetomacro[charge]\CF_dotsep [0.5ex] {:sep}%
- \CF_valuetomacro[charge]\CF_dotradius[.15ex]{.radius}%
\ifboolKV[charge]{lewisautorot}
{\pgfmathsetmacro\CF_lewisrot{90+\chargeangle}}
{\def\CF_lewisrot{0}}%
\pgfmathsetmacro\CF_halfsep{\CF_dotsep/2}%
\tikzpicture[anchor=center,rotate=\CF_lewisrot]%
- \CF_eexpsecond{\draw[}{\useKV[charge]{.style}}]%
+ \CF_expafter{\draw[}{\CF_dotstyle}]%
(-\CF_halfsep pt,0)circle(\CF_dotradius)%
(\CF_halfsep pt,0)circle(\CF_dotradius);%
\endtikzpicture
@@ -1625,8 +1649,6 @@
\def\chargerect_a[#1]{%
\begingroup
\setKV[charge]{#1}%
- \CF_valuetomacro[charge]\CF_rectlength[1.5ex]{"length}%
- \CF_valuetomacro[charge]\CF_rectwidth [0.3ex]{"width}%
\ifboolKV[charge]{lewisautorot}
{\pgfmathsetmacro\CF_lewisrot{90+\chargeangle}}
{\def\CF_lewisrot{0}}%
@@ -1641,11 +1663,10 @@
\def\chargeline_a[#1]{%
\begingroup
\setKV[charge]{#1}%
- \CF_valuetomacro[charge]\CF_linelength[1.5ex]{"length}%
\ifboolKV[charge]{lewisautorot}
{\pgfmathsetmacro\CF_lewisrot{90+\chargeangle}}
{\def\CF_lewisrot{0}}%
- \pgfmathsetmacro\CF_halflength{\CF_linelength/2}%
+ \pgfmathsetmacro\CF_halflength{\CF_rectlength/2}%
\tikzpicture[anchor=center,rotate=\CF_lewisrot]%
\CF_eexpafter{\draw[}{\useKV[charge]{|style}}](-\CF_halflength pt,0)--(\CF_halflength pt,0);% bugfix 1.51
\endtikzpicture
@@ -1730,7 +1751,7 @@
\def\charge_d#1={%
\CF_ifx\CF_quark{#1}%
{}
- {\expandafter\charge_e\expanded{\skv_removelastspaces{#1}}=}%
+ {\CF_striplastsp{#1}\charge_e}=%
}
\def\charge_e#1={%
\CF_ifinstr{#1}[
@@ -1743,14 +1764,14 @@
{\charge_g#1:0pt[#2]=}%
}
\def\charge_g#1:#2[#3]=#4,{% #1=angle, #2=offset, #3=code tikz charge, #4=charge
- \CF_eexpsecond\CF_ifinteger{\skv_removeextremespaces{#1}}
+ \CF_stripsp{#1}\CF_ifinteger
{\pgfmathsetmacro\chargeangle{mod(#1,360)}%
}
- {\pgfmathanglebetweenpoints{\pgfpointanchor{atom}{center}}{\pgfpointanchor{atom}{\skv_removeextremespaces{#1}}}%
+ {\pgfmathanglebetweenpoints{\pgfpointanchor{atom}{center}}{\CF_stripsp{#1}{\pgfpointanchor{atom}}}%
\let\chargeangle\pgfmathresult% incorrect si (atom.center==atom.#1) && (extra sep==0) TODO: mettre un warning ?
}%
\edef\CF_offset{\the\dimexpr#2+0pt}%
- \CF_distancebetweenpoints{atom}{center}{atom}{\skv_removeextremespaces{#1}}\CF_chargedistance
+ \CF_stripsp{#1}{\CF_distancebetweenpoints{atom}{center}{atom}}\CF_chargedistance
\CF_eexpafter{\node[anchor=center,}{\ifboolKV[charge]{overlay}{overlay,}{}}#3]%
at([shift=(\chargeangle:\CF_chargedistance pt+\CF_offset)]atom.center){\useKV[charge]{macro charge}{#4}};%
\charge_d
@@ -1771,13 +1792,6 @@
\def\CF_lewisa[#1]{%
\begingroup
\CF_doifnotempty{#1}{\setchemfig{#1}}%
- \CF_valuetomacro[chemfig]\CF_lewiswidthdouble[0.3ex]{lewis | width}%
- \CF_valuetomacro[chemfig]\CF_lewisoffset [0.4ex]{lewis sep}%
- \CF_valuetomacro[chemfig]\CF_lewislength [1.5ex]{lewis length}%
- \CF_valuetomacro[chemfig]\CF_lewisstyle []{lewis style}%
- \CF_valuetomacro[chemfig]\CF_lewisdist [0.3em]{lewis dist}%
- \CF_valuetomacro[chemfig]\CF_lewisradius [0.15ex]{lewis radius}%
- \CF_valuetomacro[chemfig]\CF_lewisdiagcoeff [1]{lewis diag coeff}%
\ifCF_lewisoverlay
\CF_addtomacro\CF_lewisstyle{,overlay}%
\fi
@@ -1990,10 +2004,10 @@
}
\def\CF_andb#1{%
- \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_signspaceante\CF_signspacepost\CF_signvshift
- \CF_doifempty\CF_signspaceante{\CF_valuetomacro[chemfig]\CF_signspaceante[0.5em]{+ sep left}}%
- \CF_doifempty\CF_signspacepost{\CF_valuetomacro[chemfig]\CF_signspacepost[0.5em]{+ sep right}}%
- \CF_doifempty\CF_signvshift{\CF_valuetomacro[chemfig]\CF_signvshift[0pt]{+ vshift}}%
+ \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_signspaceante_\CF_signspacepost_\CF_signvshift_
+ \CF_doifnotempty\CF_signspaceante_{\let\CF_signspaceante\CF_signspaceante_}%
+ \CF_doifnotempty\CF_signspacepost_{\let\CF_signspacepost\CF_signspacepost_}%
+ \CF_doifnotempty\CF_signvshift_{\let\CF_signvshift\CF_signvshift_}%
\raise\CF_signvshift\hbox{\kern\CF_signspaceante$+$\kern\CF_signspacepost}%
}
@@ -2004,23 +2018,14 @@
}
\def\CF_schemestarta[#1]{%
- \CF_valuetomacro[chemfig]\CF_defaultcompoundstyle[]{compound style}%
- \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_arrowangle\CF_arrowlength\CF_arrowstyle
- \CF_doifempty\CF_arrowangle{\CF_valuetomacro[chemfig]\CF_arrowangle[0]{arrow angle}}%
- \CF_doifempty\CF_arrowlength{\CF_valuetomacro[chemfig]\CF_arrowlength[1]{arrow coeff}}%
- \CF_valuetomacro[chemfig]\CF_defaultarrowstyle[]{arrow style}%
- \CF_valuetomacro[chemfig]\CF_arrowoffset[1em]{arrow offset}%
- \CF_valuetomacro[chemfig]\CF_compoundsep[5em]{compound sep}%
- \CF_valuetomacro[chemfig]\CF_arrowlabelsep[3pt]{arrow label sep}%
- \CF_valuetomacro[chemfig]\CF_arrowhead[-CF]{arrow head}%
+ \CF_setstyle#1,\CF_quark,\CF_quark\_nil\CF_arrowangle_\CF_arrowlength_\CF_arrowstyle_
+ \CF_doifnotempty\CF_arrowangle_{\let\CF_arrowangle\CF_arrowangle_}%
+ \CF_doifnotempty\CF_arrowlength_{\let\CF_arrowlength\CF_arrowlength_}%
\CF_eexpsecond{\def\CF_arrowtip}{\expandafter\CF_gobarg\CF_arrowhead}%
- \CF_eexpsecond{\CF_preaddtomacro\CF_defaultarrowstyle}{\useKV[chemfig]{arrow head},}%
- \CF_ifx\empty\CF_arrowstyle
- {\let\CF_arrowstyle\CF_defaultarrowstyle}
- {\CF_expsecond{\CF_preaddtomacro\CF_arrowstyle}{\CF_defaultarrowstyle,}}% se rajoute après le style par défaut
- \CF_valuetomacro[chemfig]\CF_arrowdoublesep[2pt]{arrow double sep}%
+ \CF_expsecond{\CF_preaddtomacro\CF_defaultarrowstyle}{\CF_arrowhead,}%
+ \let\CF_arrowstyle\CF_defaultarrowstyle
+ \CF_doifnotempty\CF_arrowstyle_{\CF_eaddtomacro\CF_arrowstyle{\expandafter,\CF_arrowstyle_}}%
\pgfmathsetmacro\CF_arrowdoublesep{\CF_arrowdoublesep/2}%
- \CF_valuetomacro[chemfig]\CF_arrowdoubleposstart[0.6]{arrow double coeff}%
\pgfmathsetmacro\CF_arrowdoubleposstart{(1-\CF_arrowdoubleposstart)/2}%
\pgfmathsetmacro\CF_arrowdoubleposend{1-\CF_arrowdoubleposstart}%
\ifboolKV[chemfig]{scheme debug}
@@ -2345,7 +2350,7 @@
{\def\CF_mergefromcoeff{#1}}%
\def\CF_mergetocoeff{0.5}%
\def\CF_mergesplitcoeff{0.5}%
- \CF_eexpsecond{\def\CF_mergestyle}{\useKV[chemfig]{arrow head}}%
+ \CF_expsecond{\def\CF_mergestyle}{\CF_arrowhead}%
\CF_iffirsttokmatch\CF_quark{#2\relax}
{}
{\CF_ifempty{#2}
@@ -2579,38 +2584,31 @@
\fi
}
-\def\CF_grabdelim#1#2#3\_nil{\def\CF_leftdelim{#1}\def\CF_rightdelim{#2}}
-\def\CF_resetdelim{%
- \setKVdefault[CFdelimiters]{
- delimiters = (),
- height = 10pt,
- depth = ,
- open xshift = 0pt,
- close xshift = ,
- h align = true,
- auto rotate = false,
- rotate = 0,
- indice = n
- }%
-}
-
-\CF_resetdelim
-
+\def\CF_grabdelim#1#2#3\_CFnil{\def\CF_leftdelim{#1}\def\CF_rightdelim{#2}}
+\defKV[CFdelimiters]{%
+ delimiters = \CF_grabdelim#1()\_CFnil,
+ height = \def\CF_delimheight{#1},
+ depth = \CF_expsecond{\CF_defifempty\CF_delimdepth{#1}}{\CF_delimheight},
+ open xshift = \edef\CF_leftdelimxshift{\the\dimexpr#1},
+ close xshift = \edef\CF_rightdelimxshift{\CF_ifempty{#1}{-\CF_leftdelimxshift}{-\the\dimexpr#1}}
+}
+\setKVdefault[CFdelimiters]{%
+ delimiters = (),
+ height = 10pt,
+ depth = ,
+ open xshift = 0pt,
+ close xshift = ,
+ h align = true,
+ auto rotate = false,
+ rotate = 0,
+ indice = n
+}%
\def\polymerdelim{\CF_ifnextchar[{\CF_polymerdelima}{\CF_polymerdelima[]}}
\def\CF_polymerdelima[#1]#2#3{%
- \CF_resetdelim
+ \restoreKV[CFdelimiters]%
\CF_doifnotempty{#1}{\setKV[CFdelimiters]{#1}}%
- \expandafter\expandafter\expandafter\CF_grabdelim\useKV[CFdelimiters]{delimiters}()\_nil
- \edef\CF_delimheight{\the\dimexpr\useKV[CFdelimiters]{height}}%
- \CF_eexpsecond\CF_ifempty{\useKV[CFdelimiters]{depth}}
- {\let\CF_delimdepth\CF_delimheight}
- {\edef\CF_delimdepth{\the\dimexpr\useKV[CFdelimiters]{depth}}}%
\edef\CF_delimhalfdim{\the\dimexpr(\CF_delimheight+\CF_delimdepth)/2}%
\edef\CF_delimvshift {\the\dimexpr(\CF_delimheight-\CF_delimdepth)/2}%
- \edef\CF_leftdelimxshift{\the\dimexpr\useKV[CFdelimiters]{open xshift}}%
- \CF_eexpsecond\CF_ifempty{\useKV[CFdelimiters]{close xshift}}
- {\edef\CF_rightdelimxshift{\the\dimexpr-\useKV[CFdelimiters]{open xshift}}}
- {\edef\CF_rightdelimxshift{\the\dimexpr-\useKV[CFdelimiters]{close xshift}}}%
\chemmove{%
\nulldelimiterspace0pt
\pgfextractx\CF_dim{\pgfpointanchor{#2}{center}}\edef\CF_leftdelimx{\the\CF_dim}%
@@ -3072,4 +3070,9 @@ v1.51 2020/04/06
----------------------------------------------------------------------
v1.52 2020/04/14
- bug : définition corrigée de \CFthesubmol dans \def_submolc pour
- qu'elle se développe en 1 coup seulement \ No newline at end of file
+ qu'elle se développe en 1 coup seulement
+----------------------------------------------------------------------
+v1.53 2020/04/27
+ - mise à jour en fonction des nouvelles fonctionnalités de
+ l'extension simplekv
+ - bug : \CF_ifzerodim interrompt maintenant le tracé dans la \hbox \ No newline at end of file