diff options
author | Karl Berry <karl@freefriends.org> | 2018-11-01 22:08:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-11-01 22:08:42 +0000 |
commit | 17df798d5ce5a412d77eb1d5d5689cd92d1f2e08 (patch) | |
tree | d40fbae67b5711f6961705138bee0c304e905294 /Master/texmf-dist/tex/generic/chemfig | |
parent | b08fa61853718d7612a3f72b90cf7fb873c1f8c9 (diff) |
chemfig (1nov18)
git-svn-id: svn://tug.org/texlive/trunk@49043 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/chemfig')
-rw-r--r-- | Master/texmf-dist/tex/generic/chemfig/chemfig.tex | 162 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex | 7 |
2 files changed, 89 insertions, 80 deletions
diff --git a/Master/texmf-dist/tex/generic/chemfig/chemfig.tex b/Master/texmf-dist/tex/generic/chemfig/chemfig.tex index d13ec65c9f7..d937d322bc8 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.32} % +\def\CFver {1.33} % % % -\def\CFdate {2018/08/23} % +\def\CFdate {2018/10/31} % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % @@ -356,81 +356,77 @@ \def\redefinesubmol{\CF@definesubmolfalse\def@submol} \def\def@submol#1{% - \begingroup - \def\CF@tmp@str{#1}% - \catcode`[\@ne\catcode`]\tw@ - \futurelet\CF@toks@a\CF@test@nxttok + \CF@cnt@atomingroup=0 % nombre d'arguments supposé + \def\CF@tmp@str{#1}% nom + \futurelet\CF@toks@a\CF@test@nxttok } \def\CF@test@nxttok{% \if[\noexpand\CF@toks@a\expandafter\CF@execfirst\else\expandafter\CF@execsecond\fi {\CF@exp@macroarg\CF@grab@optalias{\CF@tmp@str}}% - {\CF@exp@second{% - \endgroup - \begingroup - \CF@sanitize@catcode - \def@submol@a - }\CF@tmp@str{}% + {\afterassignment\CF@test@nxttok@a% pas d'argument entre crochet + \CF@cnt@atomingroup=0% cherche le nombre d'arguments éventuel }% } -\def\CF@grab@optalias#1#2{% - \endgroup - \begingroup - \everyeof{\@nil}\endlinechar-1 - \CF@sanitize@catcode - \expandafter\assign@tonil\expandafter\CF@tmp@str\scantokens{#2}% - \CF@exp@second{% - \CF@sanitize@catcode - \def@submol@a{#1}% - }\CF@tmp@str +\def\CF@test@nxttok@a{\futurelet\CF@toks@a\CF@test@nxttok@b} + +\def\CF@test@nxttok@b{% + \if[\noexpand\CF@toks@a\expandafter\CF@execfirst\else\expandafter\CF@execsecond\fi + {\CF@exp@macroarg\CF@grab@optalias{\CF@tmp@str}} + {\CF@exp@second{\def@submol@a}\CF@tmp@str{}}% } -\def\def@submol@a#1#2#3{% #1 nom, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche - \endgroup - \ifcat\relax\expandafter\noexpand\CF@firsttonil#1\@nil% si #1 est une séquence de contrôle - \expandafter\ifdefined\CF@firsttonil#1\@nil +\def\CF@grab@optalias#1[#2]#{\def@submol@a{#1}{#2}} + +\def\CF@make@listofargs#1{% + \toks\z@{}% + \CF@cnt@groupnumber#1\relax + \CF@make@listofargs@a1% +} + +\def\CF@make@listofargs@a#1{% + \unless\ifnum#1>\CF@cnt@groupnumber + \toks\z@\expandafter{\the\toks\z@###1}% + \expandafter\CF@make@listofargs@a\expandafter{\number\numexpr#1+1\expandafter}% + \fi +} + +\def\def@submol@a#1{% #1 nom + \ifcat\relax\expandafter\noexpand\CF@firsttonil#1\@nil\expandafter\CF@execfirst\else\expandafter\CF@execsecond\fi% si #1 est une séquence de contrôle + {\expandafter\ifdefined\CF@firsttonil#1\@nil \ifCF@definesubmol - \immediate\write-1{Package \CFname\space Warning: the macro \expandafter\string\CF@firsttonil#1\@nil\space is already defined, the previous definition is lost on input line \the\inputlineno.}% + \immediate\write-1{Package \CFname\space Warning: the submol \expandafter\string\CF@firsttonil#1\@nil\space is already defined, the previous definition is lost}% \fi \fi - \CF@ifempty{#2}% - {\CF@exp@second{\expandafter\def\CF@firsttonil#1\@nil}{\expandafter\empty\romannumeral-`\.\noexpand#3}} - {\expandafter\def\CF@firsttonil#1\@nil{% - \romannumeral-`\.% - \ifdim\CF@current@angle pt>90pt - \ifdim\CF@current@angle pt<270pt - \expandafter\expandafter\expandafter\CF@execfirst - \else - \expandafter\expandafter\expandafter\CF@execsecond - \fi - \else - \expandafter\CF@execsecond - \fi - {\noexpand#2}{\noexpand#3}}% - }% - \else - \ifcsname CF@@#1\endcsname + \def@submol@b{#1}% + } + {\ifcsname CF@@#1\endcsname \ifCF@definesubmol - \immediate\write-1{Package \CFname\space Warning:the submol "#1" is already defined, the previous definition is lost on input line \the\inputlineno.}% + \immediate\write-1{Package \CFname\space Warning:the submol "#1" is already defined, the previous definition is lost}% \fi \fi - \CF@ifempty{#2}% - {\CF@exp@second{\expandafter\def\csname CF@@#1\endcsname}{\expandafter\empty\romannumeral-`\.\noexpand#3}} - {\expandafter\def\csname CF@@#1\endcsname{% - \romannumeral-`\.% - \ifdim\CF@current@angle pt>90pt - \ifdim\CF@current@angle pt<270pt - \expandafter\expandafter\expandafter\CF@execfirst - \else - \expandafter\expandafter\expandafter\CF@execsecond - \fi + \expandafter\def@submol@b\csname CF@@#1\endcsname + }% +} + +\def\def@submol@b#1#2#3{% #1 nom sous forme de macro, #2 = code si liaison arrive de droite , #3 = code si liaison arrive de gauche, \CF@cnt@atomingroup = nombre d'arguments + \CF@make@listofargs\CF@cnt@atomingroup + \CF@ifempty{#2}% + {\CF@exp@after{\expandafter\def\CF@firsttonil#1\@nil}{\the\toks\z@}{\empty#3}} + {\CF@exp@after{\expandafter\def\CF@firsttonil#1\@nil}{\the\toks\z@}{% + \romannumeral + \ifdim\CF@current@angle pt>90pt + \ifdim\CF@current@angle pt<270pt + \expandafter\expandafter\expandafter\CF@execfirst \else - \expandafter\CF@execsecond + \expandafter\expandafter\expandafter\CF@execsecond \fi - {\noexpand#2}{\noexpand#3}}% - }% - \fi + \else + \expandafter\CF@execsecond + \fi + {\z@#2}{\z@#3}}% + }% } \def\CF@seek@node#1#2#3{% cherche un noeud au début de #1 l'assigne dans la sc #2 et met le reste dans #3 @@ -599,16 +595,19 @@ {\CF@eexp@second{\def\CF@remain@molecule}{\expandafter\CF@gobarg\CF@remain@molecule}% enlève le "!" \CF@ifx\empty\CF@remain@molecule{\errmessage{Package \CFname\space Error: no submol name found after "!"}}{}% \ifcat\relax\CF@three@ea\noexpand\expandafter\CF@firsttonil\CF@remain@molecule*\@nil - \CF@eexp@second{\CF@eexp@second{\def\CF@insert@submol}}{\expandafter\CF@firsttonil\CF@remain@molecule\@nil}% + \CF@eexp@second{\CF@exp@second{\def\CF@remain@molecule}}{\CF@remain@molecule}% \else - \CF@exp@second{\CF@eexp@second{\def\CF@insert@submol}}{\csname CF@@\expandafter\CF@firsttonil\CF@remain@molecule\@nil\endcsname}% + \expandafter\CF@seek@submol@a\CF@remain@molecule\@nil \fi - \CF@eexp@second{\def\CF@remain@molecule}{\csname CF@insert@submol\CF@three@ea\endcsname\csname @gobble\expandafter\endcsname\CF@remain@molecule}% \CF@seek@submol }% {}% } +\def\CF@seek@submol@a#1#2\@nil{% #1=nom + \CF@eexp@second{\CF@exp@second{\def\CF@remain@molecule}}{\csname CF@@#1\endcsname#2}% +} + \def\CF@insert@emptygroup#1{% insère {} au début de la sc #1 \CF@exp@second{\def#1}{\expandafter{\expandafter}#1}% } @@ -970,7 +969,7 @@ \or \CF@create@normnodes{#2@@}{#3@@}\CF@double@sep\CF@double@sep \CF@draw@axisbond{#2}{#3}% trace la liaison simple dans l'axe\CF@draw@bond@a(#2@@)--(#3@@); - \begingroup% ajuste éventuellement les longueurs des l(0,0iaisons doubles + \begingroup% ajuste éventuellement les longueurs des liaisons doubles \ifCF@incycle \ifdim\CF@start@offset=\z@ \CF@edefadd@tocs\CF@current@bondstyle{,shorten <=\CF@doublebond@lengthcorrection pt}% @@ -2262,25 +2261,31 @@ } \def\CF@grab@delim#1#2#3\@nil{\def\CF@left@delim{#1}\def\CF@right@delim{#2}} -\def\polymerdelim[#1]#2#3{% +\def\CF@resetdelim{% \setKVdefault[CFdelimiters] - {delimiters =(), - height =10pt, - depth ={}, - open xshift =0pt, - close xshift =0pt, - indice =n, - }% - \setKV[CFdelimiters]{#1}% + {delimiters =(), + height =10pt, + depth =, + open xshift =0pt, + close xshift=, + indice =n}% +} +\CF@resetdelim +\def\polymerdelim{\CF@ifnextchar[{\polymerdelim@a}{\polymerdelim@a[]}} +\def\polymerdelim@a[#1]#2#3{% + \CF@resetdelim + \CF@doifnotempty{#1}{\setKV[CFdelimiters]{#1}}% \expandafter\expandafter\expandafter\CF@grab@delim\useKV[CFdelimiters]{delimiters}()\@nil \edef\CF@delim@height{\the\dimexpr\useKV[CFdelimiters]{height}}% \CF@eexp@macroarg\CF@ifempty{\useKV[CFdelimiters]{depth}} {\let\CF@delim@depth\CF@delim@height} - {\edef\CF@delim@depth{\useKV[CFdelimiters]{depth}}}% + {\edef\CF@delim@depth{\the\dimexpr\useKV[CFdelimiters]{depth}}}% \edef\CF@delim@halfdim{\the\dimexpr(\CF@delim@height+\CF@delim@depth)/2}% \edef\CF@delim@vshift {\the\dimexpr(\CF@delim@height-\CF@delim@depth)/2}% - \edef\CF@leftdelim@xshift {\the\dimexpr\useKV[CFdelimiters]{open xshift}}% - \edef\CF@rightdelim@xshift{\the\dimexpr\useKV[CFdelimiters]{close xshift}}% + \edef\CF@leftdelim@xshift{\the\dimexpr\useKV[CFdelimiters]{open xshift}}% + \CF@eexp@macroarg\CF@ifempty{\useKV[CFdelimiters]{close xshift}} + {\edef\CF@rightdelim@xshift{\the\dimexpr-\useKV[CFdelimiters]{open xshift}}} + {\edef\CF@rightdelim@xshift{\the\dimexpr-\useKV[CFdelimiters]{close xshift}}}% \chemmove{% \nulldelimiterspace0pt \pgfextractx\CF@dim{\pgfpointanchor{#2}{center}}\edef\CF@leftdelim@x{\the\CF@dim}% @@ -2551,4 +2556,9 @@ v1.31 2018/04/05 ---------------------------------------------------------------------- v1.32 2018/08/23 - définition de \printatom, \CF@begin@tikzpicture et - \CF@end@tikzpicture dans le fichier t-chemfig.tex
\ No newline at end of file + \CF@end@tikzpicture dans le fichier t-chemfig.tex + ---------------------------------------------------------------------- +v1.33 2018/10/31 + - les macros définies par \definesubmol peuvent désormais avoir un ou + plusieurs arguments + - macro \polymerdelim documentée
\ No newline at end of file diff --git a/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex b/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex index 28b48bc01b3..c8a9e5c28d9 100644 --- a/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex +++ b/Master/texmf-dist/tex/generic/chemfig/t-chemfig.tex @@ -1,6 +1,5 @@ \usemodule[tikz]% \input chemfig.tex -\def\printatom#1{\mathematics{\mathrm#1}} -\setvalue{CF@begin@tikzpicture}{\starttikzpicture}% -\setvalue{CF@end@tikzpicture}{\stoptikzpicture} -\endinput
\ No newline at end of file +\expandafter\let\csname CF@begin@tikzpicture\endcsname\starttikzpicture +\expandafter\let\csname CF@end@tikzpicture\endcsname\stoptikzpicture +\endinput |