summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-03-01 22:32:19 +0000
committerKarl Berry <karl@freefriends.org>2021-03-01 22:32:19 +0000
commitda764e6f9f0f5e222a9011bcf9156c4a1001e52d (patch)
tree7969422e36f7698675b78e21752b470b70563f79 /Master/texmf-dist/tex/generic
parentbb3652537c68dfde314390df8e3abbe9682d56f2 (diff)
chemfig (1mar21)
git-svn-id: svn://tug.org/texlive/trunk@58014 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic')
-rw-r--r--Master/texmf-dist/tex/generic/chemfig/chemfig-lewis.tex129
-rw-r--r--Master/texmf-dist/tex/generic/chemfig/chemfig.tex199
2 files changed, 202 insertions, 126 deletions
diff --git a/Master/texmf-dist/tex/generic/chemfig/chemfig-lewis.tex b/Master/texmf-dist/tex/generic/chemfig/chemfig-lewis.tex
new file mode 100644
index 00000000000..d713eecf68b
--- /dev/null
+++ b/Master/texmf-dist/tex/generic/chemfig/chemfig-lewis.tex
@@ -0,0 +1,129 @@
+\ifdefined\CFname\else
+ \errmessage{Chemfig is not loaded, lewis cannot work}%
+ \expandafter\endinput
+\fi
+
+\csname lewisloadonce\endcsname
+\let\lewisloadonce\endinput
+
+\begingroup
+ \def\X#1{\catcode\number`#1=\number\catcode`#1\relax}
+ \xdef\CFrestorecatcode{\X\[\X\]\X\:\X\(\X\)\X\,\X\-\X\=\X\~\X\!\X\?\X\<\X\>\X\;\X\*\X\|\X\@\X\ \X\_}%
+\endgroup
+
+\catcode`\[12 \catcode`\]12 \catcode`\:12 \catcode`\(12
+\catcode`\)12 \catcode`\,12 \catcode`\-12 \catcode`\=12
+\catcode`\~12 \catcode`\!12 \catcode`\?12 \catcode`\<12
+\catcode`\>12 \catcode`\;12 \catcode`\*12 \catcode`\|12
+\catcode`\@12 \catcode`\#6 \catcode`\ 10 \catcode`\_11
+
+\newif\ifCF_lewisoverlay
+\newbox\CF_boxlewis
+
+\defKV[chemfig]{%
+ 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}
+ }
+\setKVdefault[chemfig]{%
+ 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
+ }
+
+\def\Lewis{%
+ \CF_lewisoverlayfalse
+ \CF_testopt\CF_lewisa{}%
+}
+
+\def\lewis{%
+ \CF_lewisoverlaytrue
+ \CF_testopt\CF_lewisa{}%
+}
+
+\def\CF_lewisa[#1]{%
+ \begingroup
+ \CF_doifnotempty{#1}{\setchemfig{#1}}%
+ \ifCF_lewisoverlay
+ \CF_addtomacro\CF_lewisstyle{,overlay}%
+ \fi
+ \CF_lewisb
+}
+
+\def\CF_lewisb#1{%
+ \CF_lewisc#1\_nil
+ \endgroup
+}
+
+\def\CF_lewisc#1,#2\_nil{%
+ \setbox\CF_boxlewis\hbox{\printatom{#2}}% mettre en dehors de tikzpicture (si \printatom ne passe pas en mode math)
+ \CF_ifinsidetikz
+ {\pgfinterruptpicture
+ \let\CF_atendoflewis\endpgfinterruptpicture
+ }
+ {\let\CF_atendoflewis\relax
+ }%
+ \tikzpicture[every node/.style={anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline]%
+ \CF_makeother;\CF_makeother:%
+ \node(CF_lewis@anchor){};
+ \def\CF_lewisremainpos{#1}%
+ \let\CF_lewispreviouspos\empty
+ \loop
+ \unless\ifx\CF_lewisremainpos\empty
+ \edef\CF_lewiscurrentpos{\expandafter\CF_firsttonil\CF_lewisremainpos\_nil}%
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\wd\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF_boxlewis/2)}%
+ \pgfmathsetmacro\CF_lewisy{\ht\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF_boxlewis/2\ifnum\CF_lewiscurrentpos>4 +\dp\CF_boxlewis\fi)}%
+ \edef\CF_lewisxoffset{\ifcase\CF_lewiscurrentpos\space1\or0.70711\or0\or-0.70711\or-1\or-0.70711\or0\or0.70711\fi}%
+ \edef\CF_lewisyoffset{\ifcase\CF_lewiscurrentpos\space0\or0.70711\or1\or0.70711\or0\or-0.70711\or-1\or-0.70711\fi}%
+ \ifodd\CF_lewiscurrentpos\relax
+ \pgfmathsetmacro\CF_lewiscurrentoffset{\CF_lewisoffset*\CF_lewisdiagcoeff}%%
+ \else
+ \let\CF_lewiscurrentoffset\CF_lewisoffset
+ \fi
+ \if.\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
+ (\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset,\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset)circle(\CF_lewisradius);%
+ \else
+ \if|\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[}\CF_lewisstyle]%
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt)--cycle;%
+ \else
+ \if:\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
+ \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
+ (\CF_lewisx pt+\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius)%
+ (\CF_lewisx pt-\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius);%
+ \else
+ \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
+ \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
+ \CF_expafter{\draw[}\CF_lewisstyle]%
+ (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--%
+ (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt);%
+ \fi
+ \fi
+ \fi
+ \repeat
+ \node[anchor=base west]at(CF_lewis@anchor){\box\CF_boxlewis};%
+ \endtikzpicture
+ \CF_atendoflewis
+}
+\CFrestorecatcode
+\endinput \ No newline at end of file
diff --git a/Master/texmf-dist/tex/generic/chemfig/chemfig.tex b/Master/texmf-dist/tex/generic/chemfig/chemfig.tex
index 6c743b24e36..576108ae287 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.56} %
+\def\CFver {1.6a} %
% %
-\def\CFdate {2020/07/13} %
+\def\CFdate {2021/02/28} %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -17,17 +17,17 @@
% Package URL: https://www.ctan.org/pkg/chemfig |
% Bug tracker: https://framagit.org/unbonpetit/chemfig/issues |
% Repository : https://framagit.org/unbonpetit/chemfig/tree/master |
-% Copyright : Christian Tellechea 2010-2020 |
+% Copyright : Christian Tellechea 2010-2021 |
% Licence : Released under the LaTeX Project Public License v1.3c |
% or later, see http://www.latex-project.org/lppl.txt |
% Files : 1) chemfig.tex |
% 2) chemfig.sty |
-% 3) t-chemfig.tex |
-% 4) README |
-% 5) chemfig_doc_fr.tex |
-% 6) chemfig_doc_fr.pdf |
-% 7) chemfig_doc_en.tex |
-% 8) chemfig_doc_fr.pdf |
+% 3) README |
+% 4) chemfig_doc_fr.tex |
+% 5) chemfig_doc_fr.pdf |
+% 6) chemfig_doc_en.tex |
+% 7) chemfig_doc_fr.pdf |
+% 8) chemfig-lewis.tex |
%--------------------------------------------------------------------
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -92,13 +92,12 @@
\newif\ifCF_definesubmol
\newif\ifCF_adjustnamedp
\newif\ifCF_macrofixedbondlength
-\newif\ifCF_lewisoverlay
+\newif\ifCF_compound_is_chemfig
\newdimen\CF_dim
\newdimen\CF_arrowsize
\newdimen\CF_zero \CF_zero=0pt
-\newbox\CF_boxlewis
\newbox\CF_box
\newbox\CF_boxstuff
\newbox\CF_testbox
@@ -277,9 +276,11 @@
\let\CF_substnogroups\CF_substnogrouponly
\CF_ifnum{#1>0 }
{\let\CF_testifx\empty
- \foreach\CF_x in {1,...,#1}{\xdef\CF_testifx{\unexpanded\expandafter{\CF_testifx}\unexpanded\expandafter{\expandafter\ifx\CF_x\CF_nexttok1\fi}}}%
+ \foreach\CF_x in {1,...,#1}
+ {\xdef\CF_testifx{\unexpanded\expandafter{\CF_testifx}\unexpanded\expandafter{\expandafter\ifx\CF_x\CF_nexttok1\fi}}}%
\let\CF_testif\empty
- \foreach\CF_x in {1,...,#1}{\xdef\CF_testif{\unexpanded\expandafter{\CF_testif}\unexpanded\expandafter{\expandafter\if\CF_x\CF_nexttok1\fi}}}%
+ \foreach\CF_x in {1,...,#1}
+ {\xdef\CF_testif{\unexpanded\expandafter{\CF_testif}\unexpanded\expandafter{\expandafter\if\CF_x\CF_nexttok1\fi}}}%
\CF_expsecond\CF_substi#2%
}
{\CF_substall#2%
@@ -368,13 +369,6 @@
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},
@@ -408,15 +402,11 @@
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,
+ autoreset cntcycle = true,
+ show cntcycle = false,
+ debug =false,
scheme debug = false,
compound style = {},
compound sep = 5em,
@@ -432,8 +422,6 @@
+ sep left = 0.5em,
+ sep right = 0.5em,
+ vshift = 0pt,
- autoreset cntcycle = true,
- show cntcycle = false,
}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1365,7 +1353,7 @@
\global\advance\CF_cntgroup1
\let\CF_currentatom\empty
\global\let\CF_hookdrawlist\empty
- \CF_cntatomgroup0
+ \CF_cntatomgroup0 % est le nombre d'atome dans le groupe que va calculer \CF_drawatomgroupa
\CF_iffirsttokmatch{#3}?
{\CF_drawatomgroupa{{}#3}}
{\CF_drawatomgroupa{#3}}%
@@ -1422,7 +1410,12 @@
\let\CF_moveatomname\empty
}
{}%
- \CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \ifboolKV[chemfig]{debug}
+ {\CF_expafter{\node[}\CF_optstring,draw=gray](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \CF_show_debug_atom
+ }
+ {\CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ }%
\let\CF_nodestrut\empty
\advance\CF_cntatom1
\edef\CF_optstring{anchor=base \ifnum\CF_flipstate=1 east\else west\fi,at=(n\number\CF_cntgroup-\number\numexpr\CF_cntatom-1.base \ifnum\CF_flipstate=1 west\else east\fi),\CF_nodestyle}%
@@ -1446,13 +1439,31 @@
\let\CF_moveatomname\empty
}
{}%
- \CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \ifboolKV[chemfig]{debug}
+ {\CF_expafter{\node[}\CF_optstring,draw=gray](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ \CF_show_debug_atom
+ }
+ {\CF_expafter{\node[}\CF_optstring](n\number\CF_cntgroup-\number\CF_cntatom){\CF_nodecontent};%
+ }%
\repeat
+ \ifboolKV[chemfig]{debug}
+ \CF_show_debug_atomgroup
+ {}%
\CF_hookdrawall
\edef\CF_lastgroupnumber{\number\CF_cntgroup}%
\let\CF_previousatomgroup\CF_currentatomgroup
}
+\def\CF_show_debug_atom{%
+ \node[at=(n\number\CF_cntgroup-\number\CF_cntatom.south),anchor=north,outer sep=1pt,overlay]{$\scriptscriptstyle\color{gray}\number\CF_cntatom$};%
+}
+
+\def\CF_show_debug_atomgroup{%
+ \draw[red,overlay] ([xshift=-.5pt,yshift=.5pt]n\number\CF_cntgroup-1.north west) rectangle ([xshift=.5pt,yshift=-.5pt]n\number\CF_cntgroup-\number\CF_cntatomgroup.south east);%
+ \path (n\number\CF_cntgroup-1.north west) -- (n\number\CF_cntgroup-\number\CF_cntatomgroup.north east)
+ node [midway,yshift=1pt,overlay] {$\scriptscriptstyle\color{red}\number\CF_cntgroup$};
+}
+
\def\CF_keepmovearg @#1#2\_nil{\def\CF_currentatom{@{#1}}}
\def\CF_drawatomgroupa#1{% transforme #1 en un groupe d'atomes
@@ -1785,95 +1796,6 @@
\charge_d
}
-\def\Lewis{%
- \CF_warning{\string\Lewis\space is unmaintained and is likely to be removed in a near future. Please, use \string\Charge.}%
- \CF_lewisoverlayfalse
- \CF_testopt\CF_lewisa{}%
-}
-
-\def\lewis{%
- \CF_warning{\string\lewis\space is unmaintained and is likely to be removed in a near future. Please, use \string\charge.}%
- \CF_lewisoverlaytrue
- \CF_testopt\CF_lewisa{}%
-}
-
-\def\CF_lewisa[#1]{%
- \begingroup
- \CF_doifnotempty{#1}{\setchemfig{#1}}%
- \ifCF_lewisoverlay
- \CF_addtomacro\CF_lewisstyle{,overlay}%
- \fi
- \CF_lewisb
-}
-
-\def\CF_lewisb#1{%
- \CF_lewisc#1\_nil
- \endgroup
-}
-
-\def\CF_lewisc#1,#2\_nil{%
- \setbox\CF_boxlewis\hbox{\printatom{#2}}% mettre en dehors de tikzpicture (si \printatom ne passe pas en mode math)
- \CF_ifinsidetikz
- {\pgfinterruptpicture
- \let\CF_atendoflewis\endpgfinterruptpicture
- }
- {\let\CF_atendoflewis\relax
- }%
- \tikzpicture[every node/.style={anchor=base,inner sep=0pt,outer sep=0pt,minimum size=0pt},baseline]%
- \CF_makeother;\CF_makeother:%
- \node(CF_lewis@anchor){};
- \def\CF_lewisremainpos{#1}%
- \let\CF_lewispreviouspos\empty
- \loop
- \unless\ifx\CF_lewisremainpos\empty
- \edef\CF_lewiscurrentpos{\expandafter\CF_firsttonil\CF_lewisremainpos\_nil}%
- \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
- \pgfmathsetmacro\CF_lewisx{\wd\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space1\or1\or0\or-1\or-1\or-1\or0\or1\fi*(\wd\CF_boxlewis/2)}%
- \pgfmathsetmacro\CF_lewisy{\ht\CF_boxlewis/2+\ifcase\CF_lewiscurrentpos\space0\or1\or1\or1\or0\or-1\or-1\or-1\fi*(\ht\CF_boxlewis/2\ifnum\CF_lewiscurrentpos>4 +\dp\CF_boxlewis\fi)}%
- \edef\CF_lewisxoffset{\ifcase\CF_lewiscurrentpos\space1\or0.70711\or0\or-0.70711\or-1\or-0.70711\or0\or0.70711\fi}%
- \edef\CF_lewisyoffset{\ifcase\CF_lewiscurrentpos\space0\or0.70711\or1\or0.70711\or0\or-0.70711\or-1\or-0.70711\fi}%
- \ifodd\CF_lewiscurrentpos\relax
- \pgfmathsetmacro\CF_lewiscurrentoffset{\CF_lewisoffset*\CF_lewisdiagcoeff}%%
- \else
- \let\CF_lewiscurrentoffset\CF_lewisoffset
- \fi
- \if.\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
- \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
- \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
- (\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset,\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset)circle(\CF_lewisradius);%
- \else
- \if|\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
- \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
- \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
- \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
- \CF_expafter{\draw[}\CF_lewisstyle]%
- (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--
- (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
- (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt+\CF_lewisxoffset*\CF_lewiswidthdouble,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt+\CF_lewisyoffset*\CF_lewiswidthdouble)--
- (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt)--cycle;%
- \else
- \if:\expandafter\CF_firsttonil\CF_lewisremainpos\relax\_nil
- \edef\CF_lewisremainpos{\expandafter\CF_gobarg\CF_lewisremainpos}%
- \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
- \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
- \CF_expafter{\draw[fill,black,}{\CF_lewisstyle]}%
- (\CF_lewisx pt+\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius)%
- (\CF_lewisx pt-\CF_lewisdist*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewisdist*\CF_lewisxoffset/2 pt)circle(\CF_lewisradius);%
- \else
- \pgfmathsetmacro\CF_lewisx{\CF_lewisx pt+\CF_lewisxoffset*\CF_lewiscurrentoffset}%
- \pgfmathsetmacro\CF_lewisy{\CF_lewisy pt+\CF_lewisyoffset*\CF_lewiscurrentoffset}%
- \CF_expafter{\draw[}\CF_lewisstyle]%
- (\CF_lewisx pt+\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy-\CF_lewislength*\CF_lewisxoffset/2 pt)--%
- (\CF_lewisx pt-\CF_lewislength*\CF_lewisyoffset/2 pt,\CF_lewisy+\CF_lewislength*\CF_lewisxoffset/2 pt);%
- \fi
- \fi
- \fi
- \repeat
- \node[anchor=base west]at(CF_lewis@anchor){\box\CF_boxlewis};%
- \endtikzpicture
- \CF_atendoflewis
-}
-
\def\Chembelow{\begingroup\let\CF_temp\CF_gobarg\CF_chembelowa}
\def\chembelow{\begingroup\let\CF_temp\CF_id\CF_chembelowa}
@@ -2074,20 +1996,34 @@
\CF_iffirsttokina{\arrow\schemestop\merge}%
{}
{\CF_ifx\CF_toksa\bgroup
- {\CF_addnextarg
+ {\ifCF_compound_is_chemfig% bugfix 1.6
+ \edef\CF_restore_hashcatcode{\catcode\number`\#=\number\catcode`\# \relax}%
+ \catcode`\#12 % TODO ou carrément mettre # à 12 dans tout l'environnement ?
+ \fi
+ \CF_addnextarg
}
{\CF_ifx\CF_toksa\CF_sptoken
{\CF_addtomacro\CF_compound{ }%
\CF_schemestartd
}
- {\afterassignment\CF_schemestartc
+ {\CF_ifx\CF_toksa\chemfig
+ \CF_compound_is_chemfigtrue% mettre le flag à vrai
+ {}%
+ \afterassignment\CF_schemestartc
\CF_addtomacro\CF_compound
}%
}%
}%
}
-\def\CF_addnextarg#1{\CF_addtomacro\CF_compound{{#1}}\CF_schemestartc}
+\def\CF_addnextarg#1{%
+ \CF_addtomacro\CF_compound{{#1}}%
+ \ifCF_compound_is_chemfig% bugfix 1.6
+ \CF_restore_hashcatcode
+ \CF_compound_is_chemfigfalse% mettre le flag à faux
+ \fi
+ \CF_schemestartc
+}
\def\CF_displaycompound#1#2{% #1 = nom et #2 = style
\CF_doifnotempty\CF_compound
@@ -3088,7 +3024,7 @@ v1.53 2020/04/27
v1.54 2020/05/21
- chemfig ne peut plus fonctionner sans \expanded
- bug : un signe "=" laissé par erreur dans le flux
- ----------------------------------------------------------------------
+----------------------------------------------------------------------
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
@@ -3096,4 +3032,15 @@ v1.55 2020/06/15
----------------------------------------------------------------------
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
+ spécifique pour chacun d'eux.
+----------------------------------------------------------------------
+v1.6 2021/02/26
+ - les macros des formules de Lewis sont retirées et placées dans
+ le fichier séparé "lewis.tex" que l'utilisateur peut charger
+ s'il le souhaite
+ - ajout d'une clé <debug> pour le trousseau [chemfig]
+ - à l'intérieur d'un schéma, le token '#' est permis dans
+ l'argument de \chemfig
+----------------------------------------------------------------------
+v1.6a 2021/02/28
+ - le fichier lewis.tex a été renommé chemfig-lewis.tex